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
5分でわかる! VaporでAPI+DB構築
Search
Kaito Kudo
October 10, 2025
Programming
0
96
5分でわかる! VaporでAPI+DB構築
Kaito Kudo
October 10, 2025
Tweet
Share
More Decks by Kaito Kudo
See All by Kaito Kudo
未来大LT_2025.pdf
kaitokudou
0
66
Universal Linksの実装方法と陥りがちな罠
kaitokudou
1
450
iOSDC Japan 2022 スポンサーセッション
kaitokudou
0
1.9k
iOS勉強会資料
kaitokudou
0
110
App Storeにアプリをリリースした話
kaitokudou
0
44
Other Decks in Programming
See All in Programming
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
370
MUSUBIXとは
nahisaho
0
120
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
430
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
970
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
Python札幌 LT資料
t3tra
7
1.1k
SourceGeneratorのススメ
htkym
0
180
Basic Architectures
denyspoltorak
0
650
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
290
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
180
ThorVG Viewer In VS Code
nors
0
760
Patterns of Patterns
denyspoltorak
0
1.3k
Featured
See All Featured
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
AI: The stuff that nobody shows you
jnunemaker
PRO
2
230
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
55
49k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
130
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
750
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
A Tale of Four Properties
chriscoyier
162
24k
Transcript
5ͰΘ͔Δʂ VaporͰAPI+DBߏங 2025/10/10 DroidKaigi & iOSDC After Talks Night ͘Ͳ͔͍
ࣗݾհ גࣜձࣾΏΊΈ/͘Ͳ͔͍ 2022/04ʹiOSΤϯδχΞͱͯ͠৽ଔೖࣾɻ ෭ۀͰFlutterΛͪΐͬͱͬͨΓɻ ݸਓ։ൃ ݮञࢧԉΞϓϦʮAlconʯ https://apps.apple.com/jp/app/alcon/id1571071417 ࡔಓάϧʔϓͷ८ྱΞϓϦʮͷ͗ϥϦʔʯ https://apps.apple.com/jp/app/ͷ͗ϥϦʔ/id6501994754 @kudokai00
@KaitoKudou 2
DroidKaigi & iOSDC ͓ർΕ༷Ͱͨ͠ʂʂʂ
SwiftͰόοΫΤϯυͷ࣮͕Մೳʂ
Server Side Kotlin͋Δͬͯʁ
SwiftͰॻ͖͍ͨΜͩΑʂʂʂ
7
Vaporͱ • Server Side SwiftͷදతͳϑϨʔϜϫʔΫ • Swift Ͱ Web ΞϓϦͷ
API ɺ HTTP αʔόʔͷߏங͕Մೳ • पลϥΠϒϥϦ͕͔ͳΓॆ࣮ - ORMʢFluentʣɺೝূʢJWTɾOAuthʣɺWebSocketͳͲ 8
VaporͷΠϯετʔϧํ๏ • HomebrewͰΠϯετʔϧ • versionͷ֬ೝ 9
ϓϩδΣΫτͷ࡞ • ࠷খߏͰϓϩδΣΫτΛ࡞ • APIαʔόʔΛىಈ 10
GET APIΛ࡞
GET APIΛ࡞
Ϩεϙϯε curl http://localhost:8080/todos Λୟ͍ͨ݁Ռ
DB࿈ܞ 1. serverͷ४උ 2. con fi gure.swift ʹserverͷใΛ͢ 3. MigrationϑΝΠϧΛ࡞
4. ModelΛఆٛ 5. ControllerʹϨεϙϯεΛฦ͢ϝιουΛఆٛ
serverͷ४උ • pgAdminΛ༻ - SQLॻ͔ͣʹࡁΉʂ
con fi gure.swift ʹserverͷใΛ͢
con fi gure.swift ʹserverͷใΛ͢
MigrationϑΝΠϧΛ࡞ • DBͷมߋͱͦͷऔΓফ͠ํ๏Λఆٛ • ఆٛޙɺcon fi gure.swiftʹMigrationΛՃ - `app.migrations.add(CreateTodo())` •
`swift run {ϓϩδΣΫτ໊} migrate` ͰMigrationΛ࣮ߦ • MigrationޙదʹtableʹrecordΛՃ
MigrationϑΝΠϧΛ࡞
MigrationϑΝΠϧΛ࡞ ↓↓↓͜Μͳײ͡Ͱtableʹcolumn͕Ճ͞ΕΔ
ModelΛఆٛ
ControllerʹϨεϙϯεΛฦ͢ϝιουΛఆٛ • ϨεϙϯεΛฦ͢ϝιουControllerʹఆ͍ٛͯ͘͠
·ͱΊ • VaporΛ͏ͱSwiftΛͬͨAPI։ൃ͕Մೳ • PostgreSQL + Fluent ORMͰDB࿈ܞ؆୯ • جຊతʹDelegateϝιουΛ࣮͍ͯ͘͜͠ͱͰɺɹɹɹɹɹ
MigrationRouting͕Մೳ