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
CSC509 Lecture 09
javiergs
PRO
0
140
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
160
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
C++でシェーダを書く
fadis
6
4.1k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
850
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
270
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
860
Click-free releases & the making of a CLI app
oheyadam
2
110
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
The Cult of Friendly URLs
andyhume
78
6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Writing Fast Ruby
sferik
627
61k
Automating Front-end Workflow
addyosmani
1366
200k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Building Your Own Lightsaber
phodgson
103
6.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Navigating Team Friction
lara
183
14k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
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 Λ͓ئ͍͍ͨ͠·͢