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
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
200
cmp.Or に感動した
otakakot
3
200
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Jakarta EE meets AI
ivargrimstad
0
120
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Macとオーディオ再生 2024/11/02
yusukeito
0
370
イベント駆動で成長して委員会
happymana
1
330
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Become a Pro
speakerdeck
PRO
25
5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Speed Design
sergeychernyshev
25
620
Docker and Python
trallard
40
3.1k
A better future with KSS
kneath
238
17k
Writing Fast Ruby
sferik
627
61k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
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 Λ͓ئ͍͍ͨ͠·͢