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
Nest.jsを使ってみたら とても開発体験がよかった話 - 関西Node学園 11時限目
Search
Kanon
May 31, 2024
Technology
0
28
Nest.jsを使ってみたら とても開発体験がよかった話 - 関西Node学園 11時限目
関西Node学園 11時限目での登壇資料です。
https://nodejs.connpass.com/event/319446/
Kanon
May 31, 2024
Tweet
Share
More Decks by Kanon
See All by Kanon
WebサーバーとPHP実行方式を きちんと理解してPHPランタイムを 適切に使い分ける - PHPカンファレンス福岡2024
ysknsid25
2
140
TypeScriptで設定しておきたいオプションを逆引きで紹介する - kansai.ts #7
ysknsid25
1
18
ぼっち・ざ・りもーと! 〜フルリモならオフラインLTへ行け!〜
ysknsid25
1
10
東遊園地近辺のおすすめランチ・カフェ
ysknsid25
1
31
変な先入観を捨てて、 とりあえず関西のLT会で発表してみない?
ysknsid25
1
12
ChatGPT Visionで色々実験したまとめ - Kobe Engineer SakeBash #3 with HACK.BAR
ysknsid25
1
30
Google I/O 2024で発表された Firebase App HostingでNext.jsのSSRを試す
ysknsid25
2
160
Flutter on the Webでアプリを作り、 React/Next.jsの違いを体感する - FlutterKaigi mini Osaka #1 with Mix Leap Study #75
ysknsid25
3
56
eslint-plugin-securityを導入して、 低労力で堅牢なコードを作る
ysknsid25
1
74
Other Decks in Technology
See All in Technology
例外設計について考えて Kotlin(Spring Boot&Arrow)で実践する/thinking exception design and implementation by kotlin
msksgm
3
1.6k
IaCツールのいろいろ
takesection
0
140
俺的 Four Keys 解釈
tetsuya28
0
190
経営視点から捉えた開発生産性 / Development productivity from a management perspective
kyuns
4
820
モノリスから小さなシステムへ / Chatworkシステム移行の現在地と今後について@開発生産性カンファレンス
tanakayuki
0
160
Refactoring to Expressive Kotlin
davidkwon7
0
210
What's New in OpenShift 4.16
redhatlivestreaming
1
290
みんなで盛り上げ築くリレーション、日経の新卒エンジニア研修 #chiyoda_tech
nishiuma
1
150
日本発24時間グローバルイベント"JAWS PANKRATION 2024"の紹介
yoshimi0227
1
150
超アナログ中心な印刷会社で「エンジニアリング」を見直す
logica0419
4
150
Lernen durch Schmerzen! Mit Reinforcement Learning selbstlernende Systeme entwickeln
joergneumann
0
210
えにしテックさん15周年に寄せて〜万葉と私ののこれまでの学び〜
nay3
16
2k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
689
190k
Infographics Made Easy
chrislema
238
18k
Code Review Best Practice
trishagee
57
16k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.2k
Side Projects
sachag
451
41k
What's new in Ruby 2.0
geeforr
338
31k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
Fantastic passwords and where to find them - at NoRuKo
philnash
40
2.6k
Automating Front-end Workflow
addyosmani
1360
200k
Faster Mobile Websites
deanohume
300
30k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Being A Developer After 40
akosma
68
580k
Transcript
Nest.jsを使ってみたら とても開発体験がよかった話 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio Kanon (@samurai_se) #関西Node学園 11時限目
自己紹介 2 Kanon 株式会社 虎の穴ラボ 個人事業 blessing software samurai_se ↓詳しくは↓
• 3次元に嫁が1人います。2次元にはたくさんいます。 • 水瀬いのりライブTで神戸から色んなテックカンファレンスに登壇してる人です • 最近「アイコンみたことある!」と声かけていただける率が増えてて嬉しい • 本業はKtor(Kotlin), Next.jsで副業がLaravel, Nest.js,Next.js Copyright © 2024 blessing software. All Rights Reserved.
アジェンダ 3 • 導入の経緯 • 導入の決め手 • 使い始めて気づいた、よかったこと • Laravelと比べてどう?
• おわりに Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
導入の経緯 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio
5 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio LangChainを使ったマイクロサービスを生やしたい
6 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio
LangChainとは • 一言でいうと、プログラムからAIへプロンプトを投げるために必要な処理やらなんや らをライブラリ化してくれたもの • 例えば ◦ OpenAIのどのモデルを使うか? apiキーはどれか?の管理 ◦
REST APIとしてエンドポイントを公開するためのアレコレ ▪ Swagger定義したり ▪ 型情報を生成してくれたり • Python版とJS版がある 7 Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
JS版を採用した • Pythonを書ける人が自分以外にいなかった ◦ 自分も競技プログラミングでやってるくらい ◦ なので、学習コストが高いと判断 ◦ また保守のための情報収集なども増やすことになる •
そこまで本格的に機械学習とかするわけじゃない • 環境構築なども勝手知ったるなため、本番稼働まで の道筋がイメージしやすい 8 Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
問題点 • JS版のLangChainにはLangServeがついていない ◦ さっき出てきたREST APIのエンドポイントとして公開するため のアレコレの機能 • というわけで、LangChainを入れたNodeランタイムを 構築する必要がある
• かつ、そこでREST API形式でデータをやりとりするフ レームワークを動かしたい 9 Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
選ばれたのはNest.jsでした Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio
導入に当たってのポイント • TypeScriptを標準サポートしてくれている • OpenAPIとの親和性 • DIが標準装備されている • フレームワークに最適化されたFormatter,Linterが 標準装備されている
• Denoと迷ったけど、Nest.jsに比べるとまだ情報が少 ない 11 Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
使い始めて気づいた、よかったこと Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio
ここがいいよ、Nest.js • TypeScriptで設定など特にせずとも最初から書ける • フロントとバックエンドの両方ともTypeScriptで作れる ので学習コストが低くなる • OpenAPIが標準装備されており、かつコードから Swagger定義を生み出してくれる •
(個人的に) DIの設定を書く場所がわかりやすい 13 Copyright © 2023 blessing software. All Rights Reserved. Illustrated by @amon_mikio
OpenAPIとの親和性 14 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio
OpenAPIとの親和性 15 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio npm run start ↓ http://localhost:3000/api
APIドキュメントのできあがり 16 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio
元ネタはクラスを単に書いていき… 17 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio
コントローラーにエンドポイントを書けば… 18 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio
コントローラーにエンドポイントを書けば… 19 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio
Laravelと比較して... 20 Copyright © 2023 blessing software. All Rights Reserved.
Illustrated by @amon_mikio • いいところ ◦ OpenAPIが標準装備 ◦ 型システムも標準装備 ◦ DIがわかりやすい ◦ フロントとバックエンドで言語が同じ • いまいちなところ ◦ ORMまで一緒についてこない ぶっちゃけ初心者が 多いチームなら LaravelよりNest.js 使う方がいろいろ楽
21 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio まだまだ機能を使いこなせていないので もうちょっとドキュメント読み込んでいきたい
22 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio ご清聴、あざざました
23 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio 23 📢 最後に宣伝だけ 🙏 オフラインLT会を 神戸で開催します! オンラインでも毎朝もくもく会 してます!
24 Copyright © 2023 blessing software. All Rights Reserved. Illustrated
by @amon_mikio 24 📢 最後に宣伝だけ 🙏 PHP以外の話も ウェルカムです!! 登壇枠が残り2枠です!
おわりに 三ノ宮で待ってます!! samurai_se