Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NestJS meetup Tokyo Opening Talk / What is Nest...
Search
potato4d(Takuma HANATANI)
November 29, 2019
Programming
11
3.9k
NestJS meetup Tokyo Opening Talk / What is NestJS? #nestjs_meetup
2019/11/29 に株式会社エウレカで開催された #nestjs_meetup のスライドです。
potato4d(Takuma HANATANI)
November 29, 2019
Tweet
Share
More Decks by potato4d(Takuma HANATANI)
See All by potato4d(Takuma HANATANI)
どうせキレイに書けない処理は逆にAIに書いてもらうほうが良い説 / #kyotojs 22
potato4d
3
330
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2.1k
Vue.js with TSX - From Vue 2.x to Vue 3 #v_tokyo11
potato4d
9
4.8k
終わりゆく Vue 2.x 時代の状態設計のアンサー - Vue 3 の Provider への期待 / The Last Architecture of the Vue 2.x
potato4d
25
6.8k
Web Worker を使ってブラウザ上でポケモンの画像を解析したい! / Pokemon recognition from screenshots in browser using web worker
potato4d
0
1.2k
Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy
potato4d
8
3.6k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
26k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.4k
気軽な Node.js バックエンド開発には TypeORM がちょうどいい #kng7 / introduce-typeorm
potato4d
9
4.5k
Other Decks in Programming
See All in Programming
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
770
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
5
1.2k
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
100
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
770
快速入門可觀測性
blueswen
0
360
Haze - Real time background blurring
chrisbanes
1
510
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
350
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
328
21k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Building Applications with DynamoDB
mza
91
6.1k
How STYLIGHT went responsive
nonsquared
95
5.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Facilitating Awesome Meetings
lara
50
6.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
A Philosophy of Restraint
colly
203
16k
Transcript
What is NestJS ? 2019.11.28 #nestjs_meetup Takuma HANATANI (@potato4d)
Takuma HANATANI (@potato4d) • Working at • Senior Front-End Engineer
at LINE Corp. • CEO at ElevenBack LLC. • Contributions • Vue.js and React.js Japanese document maintainer • Contributed to NestJS for the first time this month • I — • User Interface, Serverless, Cloud Native
ΧϨϯμʔࣗಈԽʹΑͬͯձܭཧ͔Βղ์͞ΕΔΫϥυʮ$BOEZʯϕʔλఏڙத IUUQTDBOEZBDDBNQBJHOCFUB
Topics 1. ͡Ίʹ 2. αʔόʔαΠυ Node.js ͷ՝ 3. ͳͥ NestJS
ͳͷ͔ɻಛͱັྗ 4. αʔόʔαΠυ Node.js ͷੈքͰ NestJS ʹظ͞ΕΔͷ
Topics 1. ͡Ίʹ 2. αʔόʔαΠυ Node.js ͷ՝ 3. ͳͥ NestJS
ͳͷ͔ɻಛͱັྗ 4. αʔόʔαΠυ Node.js ͷੈքͰ NestJS ʹظ͞ΕΔͷ
Q. NestJS ͬͨ͜ͱ͋Δʁ
NestJS Official website (https://nestjs.com/)
ࣄલΞϯέʔτ݁Ռ ࣄͰ͍ͬͯΔ ਓ ྆ํͰ͍ͬͯΔ ਓ झຯͰ͍ͬͯΔ ਓ ͬͨ͜ͱ͕ͳ͍ ਓ
3ߦͰΘ͔Δ NestJS
NestJS ͬͯͲΜͳϑϨʔϜϫʔΫʁ • ७ਮͳΔ TypeScript ʹΑͬͯهड़͞Εͨ • DI ͷจ຺Λڧ͘ड͚ܧ͍ͩ •
Opinionated Ͱ Progressive ͳϑϨʔϜϫʔΫ
Over 20k stars https://github.com/nestjs/nest
16.5k weekly downloads https://www.npmtrends.com/@nestjs/common
αʔόʔαΠυ Node.js Express ͚ͩ͡Ό͋ͳ͍
Topics 1. ͡Ίʹ 2. αʔόʔαΠυ Node.js ͷ՝ 3. ͳͥ NestJS
ͳͷ͔ɻಛͱັྗ 4. αʔόʔαΠυ Node.js ͷੈքͰ NestJS ʹظ͞ΕΔͷ
Express Ұڧ͕ଓ͘
Express ͏্ͰͷΈ • ബ͍ API ͷͭΓͰ࡞ͬͨ Req/Res Object ʹґଘͨ͠ີ݁߹ͳίʔυ •
୭ͬͯͳ͍ express-generator • Ϧςϥγʔ͕͍ͱ console.log ͰϩΪϯάͯͨ͠Γ͢Δ • 100ਓډͨΒ100ਓҧ͏ΞʔΩςΫνϟʹͳΔࣗ༝ • ߴқԽ͢Δ։ൃϧʔϧɾΞʔΩςΫνϟͷ౷Ұ ϚΠΫϩϑϨʔϜϫʔΫʹඞਢͳઃܭΛ୭ͱΕͣഁ͢Δ։ൃମ੍ ☠
“ࣗҎ֎ͷ Express ͷίʔυಡΈͨ͘ͳ͍”
“ࣗͷੲͷ Express ͷίʔυಡΈͨ͘ͳ͍”
ͦͦͷؒҧ͍ • Express ศརͳٕज़͕ͩɺͦΕ͚ͩΛ͍ͬͯΕྑ͍Θ͚Ͱͳ͍ • ബ͍ͨΊखܰʹ͑Δ͕ɺബ͍͔Βͱ͍ͬͯࡶͰྑ͍Θ͚Ͱͳ͍ • ബ͍(Less opinionated)ٕज़ʹബ͍͚ͩͷ͕͏ •
ϑϨʔϜϫʔΫͷࢥʹΒͳ͍ͳΒɺ͕ࣗࢥΛ͖࣋ͭͰ͋Δ • ߟ͑ͳͯ͘ྑ͍ͷͰͳ͘ɺࣄऀͱͯ͠ߟ͑ɺ͑Δඞཁ͕͋Δ • ࢥߟͱܒʹΛ࣋ͯ͘ͳ͍߹ɺڱΊΔ͜ͱ͕ॏཁ • աڈͷϑϧελοΫϑϨʔϜϫʔΫ͜ΕʹΑͬͯࢥߟΛ࠷খԽͨ͠ • ܕʹ·ͬͨ։ൃͷ՝͋Γɺബ͍ͷ͕ٻΊΒΕΔ͜ͱ͋ͬͨ
ॏ͍ʁ
Topics 1. ͡Ίʹ 2. αʔόʔαΠυ Node.js ͷ՝ 3. ͳͥ NestJS
ͳͷ͔ɻಛͱັྗ 4. αʔόʔαΠυ Node.js ͷੈքͰ NestJS ʹظ͞ΕΔͷ
NestJS ͬͯͲΜͳϑϨʔϜϫʔΫʁ • ७ਮͳΔ TypeScript ʹΑͬͯهड़͞Εͨ • DI ͷจ຺Λڧ͘ड͚ܧ͍ͩ •
Opinionated Ͱ Progressive ͳϑϨʔϜϫʔΫ
NestJS αʔόʔαΠυ Node.js ʹ டং Λ༩͑Δ
TypeScript NestJS Λࢧ͑Δ3ͭͷப %FQFOEFODZ *OKFDUJPO 0QJOJPOBUFE "SDIJUFDUVSF 1SPHSFTTJWF &DPTZTUFN
Dependency Injection • ΦϒδΣΫτಉ࢜(Ϋϥεಉ࢜)ͷґଘΛ֎෦͔Βઃఆ͢Δ͜ͱ • Dependency(ґଘΦϒδΣΫτ)ͷInjection(ೖ) • ΦϒδΣΫτಉ࢜ͷґଘΛ෦Ͱղܾ͠ͳ͍͜ͱʹΑͬͯɺςελϒϧ͔ͭ ൚༻ੑͷߴ͍ίʔυΛॻͨ͘ΊͷςΫχοΫ •
DAO ͕ؔΘΔΦϒδΣΫτςετͮ͠Β͍ • ֎෦ API ͕ؔΘΔΦϒδΣΫτςετͮ͠Β͍ • ͦͯ͠ DI Λ͏·͘औΓѻ͏ΈΛఏڙ͞Ε͍ͯΔ (DIίϯςφ) NestJSΛ͏͜ͱͰʮࣗવͱґଘؔΛҙࣝͨ͠ίʔυ͕࡞ΒΕΔʯΑ͏ʹ
Opinionated Architecture • DI Λલఏͱͨ͠ Service ͱͦΕΛར༻͢Δ Provider / Module
• ൚༻తͳ Service ͱɺΞϓϦέʔγϣϯ͚ͷೖΓޱͷ Module • ࣗવͱϨΠϠͱϢʔεέʔεʹ͍ͭͯߟྀ͞ΕΔΑ͏ʹ • ؔ৺ྖҬʹ͍ͭͯըҰతͳղܾํ๏Λఏڙ • HTTPϨεϙϯεɾೝূɾόϦσʔλɾྫ֎ϕʔεͷҟৗܥཧɾϩά • ҰํͰଞͷϑϨʔϜϫʔΫʹ͋Δ͕ຊ࣭తͰͳ͍ͷແؔ৺ • ίΞʹ RDB NoSQL ͷػೳଘࡏ͠ͳ͍(ՃՄೳ) ʮඞཁͳͷΛબ͢Δ͚ͩͰɺࣗવͱNestΒ͘͠ͳΔʯར͕͋Δ
Progressive Ecosystem • NestJS ίΞʹͳ͍͕ΦϑΟγϟϧͷύοέʔδ͕େྔʹ͋Δ • σʔλετΞ: TypeORM / Sequalize
/ Mongoose • IDL / Server: GraphQL / gRPC • For starter: Nest CLI • Utilities: Swagger(Open API) / Compodoc / • ։ൃऀ͕ NestJS ʹίΞҎ֎ΛͲ͜·ͰٻΊΔ͔ఆٛͰ͖Δ • ϑϧελοΫͰͳ͘ɺελʔτ࣌ʹղܾ͞Ε͍ͯΔ՝͕ଟ͍͚ͩ جຊతͳΞʔΩςΫνϟ͕९क͞ΕͨதͰɺ࠷దͳπʔϧΛΈସ͑ΒΕΔ
Topics 1. ͡Ίʹ 2. αʔόʔαΠυ Node.js ͷ՝ 3. ͳͥ NestJS
ͳͷ͔ɻಛͱັྗ 4. αʔόʔαΠυ Node.js ͷੈքͰ NestJS ʹظ͞ΕΔͷ
ࢲݟͰ͢
αʔόʔαΠυ Node ͕ඞཁͳঢ়گʹ͍ͭͯ • ϓϥοτϑΥʔϜͷ • Cloud Native ready ͳ৫Ͱͳ͘
FaaS ͕ར༻Ͱ͖ͳ͍ • ্ཱ͕ͪΓ͕ϔϏʔͳͷͷಈ࡞Λཁٻ͞ΕΔ • ։ൃϝϯόʔͷ՝ • JavaScript(TypeScript) ͕ୈҰݴޠͷϝϯόʔ͕த৺ • ͍ΘΏΔόοΫΤϯυͷઃܭʹ׳Ε͍ͯΔਓ͕͍Δ͔Θ͔Βͳ͍ • ٕज़ؒͷࠩҟΛٵऩ͍ͨ͠ • BFF ͰϑϩϯτΤϯυͱ JSON ͰɺMicroServices ͱ gRPC Ͱ
NestJS ͕͏·͘ڹ͘ϙΠϯτʹ͍ͭͯ • Opinionated ͳ Architecture ʹΑͬͯΈΜͳͰಉ͡ʹཱͯΔ • NestJS
ʹ͍ͭͯͷ͕ࣝ͋Δલఏ • ࠷ߴͷઃܭʹͳΒͳ͍͔͠Εͳ͍͕ɺʹͳΔ͜ͱΛ͛Δ • جຊʮWebʯʹؔ͢ΔྖҬʹͷΈؔ৺Λ࣋ͭ • DAO ORM ͕ίΞ͔Β֎Ε͍ͯΔͨΊɺݎ࿚ͳ͕Βٕज़Λബ͘ར༻͢ Δ͜ͱ͕Մೳ • ಛʹ BFF ͳͲόϦσʔλʔɾೝূج൫͕͔ͬ͠Γͯ͠ཉ͍͠Έ͍ͨͳ ߹͕͜͜ޮ͍ͯ͘Δ
NestJS ΛΦϓγϣϯͷͻͱͭͱͯ͠Δ • NestJS ͕͍ͭͰ༗ޮͳΘ͚Ͱͳ͍ • 1ΤϯυϙΠϯτͷ؆୯ͳαϯϓϧʹ NestJS ඞཁͳ͍ •
ͬͱϢʔεέʔεʹԊͬͨઃܭΛΞʔΩςΫτ͕͢Δ͖͔͠Εͳ͍ • Ͳ͏͑Δͷ͔ɺ͋Δ͍͑ͳ͍ͷ͔Λ͓ͬͯ͘͜ͱ͕େ • ͦͦ NestJS ͕Ͳ͏͍͏ػೳΛ༗͍ͯ͠Δͷ͔ • NestJS ͷΧόʔൣғͲ͜·ͰͰɺͲͷΑ͏ʹར༻͞Ε͍ͯΔͷ͔ • Ͳ͏͍ͬͨ࣌ʹ NestJS ཱ͕ͬͨͷ͔
Continue to main sessions… #nestjs_meetup
Ϣʔβʔάϧʔϓ͔Βͷ͓Βͤ
1. NestJS Λ͡ΊΔਓ͕͔᪴ͳ͍͚ͩͷຊޠࢿྉΛੜΈग़͢ 2. ݱঢ়ଘࡏ͠ͳ͍ࠃͰͷʮݱͷφϚͷʯ͕ڞ༗Ͱ͖ΔΛͭ͘Δ 3. NestJS Λར༻͖͢ͱ͖ɾ͖͢Ͱͳ͍࣌ͷஅج४Λ૿͢ NestJS ͕ඞཁͳਓʹेʹಧ͘·ͰΛαϙʔτ͢Δ
https://qiita.com/advent-calendar/2019/nestjs
https://nestjs.com/
https://discord.gg/qUdzdDH
https://nest-jp.connpass.com
NestJS JP Λ͓ئ͍͍ͨ͠·͢