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.8k
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
280
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
1.9k
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.7k
Web Worker を使ってブラウザ上でポケモンの画像を解析したい! / Pokemon recognition from screenshots in browser using web worker
potato4d
0
1.1k
Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy
potato4d
8
3.5k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
25k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.3k
気軽な Node.js バックエンド開発には TypeORM がちょうどいい #kng7 / introduce-typeorm
potato4d
9
4.4k
Other Decks in Programming
See All in Programming
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
290
状態管理ライブラリZustandの導入から運用まで
k1tikurisu
3
470
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
140
なぜアジャイルがうまくいかないのか?
yum3
1
110
What you can do with Ruby on WebAssembly
kateinoigakukun
0
170
Kotlin 2.0が与えるAndroid開発の進化
masayukisuda
1
420
Desafios e Lições Aprendidas na Migração de Monólitos para Microsserviços em Java
jessilyneh
2
150
上手に付き合うコンポーネントテスト
quramy
0
110
Increased Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
410
What is Parser
yui_knk
9
4.2k
o1モデルのプロンプトエンジニアリングって?
ktc_wada
0
300
Android開発以外のAndroid開発経験の活かしどころ
konifar
2
1.1k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
KATA
mclloyd
27
13k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
123
18k
The Invisible Customer
myddelton
119
13k
Designing for humans not robots
tammielis
248
25k
Producing Creativity
orderedlist
PRO
340
39k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Building an army of robots
kneath
302
42k
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
A better future with KSS
kneath
235
17k
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 Λ͓ئ͍͍ͨ͠·͢