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
310
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2k
Vue.js with TSX - From Vue 2.x to Vue 3 #v_tokyo11
potato4d
9
4.7k
終わりゆく 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
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Tauriでネイティブアプリを作りたい
tsucchinoko
0
380
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
300
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
320
Contemporary Test Cases
maaretp
0
140
WebAssembly Unleashed: Powering Server-Side Applications
chrisft25
0
850
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
9
1.6k
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
230
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
230
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
130
イベント駆動で成長して委員会
happymana
1
340
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Automating Front-end Workflow
addyosmani
1366
200k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Documentation Writing (for coders)
carmenintech
65
4.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
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 Λ͓ئ͍͍ͨ͠·͢