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
The way of truly serverless application
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
miup
November 21, 2017
Programming
4.6k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The way of truly serverless application
Firebase.yebisu #1
miup
November 21, 2017
More Decks by miup
See All by miup
Algolia with Firebase
miup
2
1.5k
Firestore のクエリと全文検索
miup
7
3.6k
Firestore, Cloud Storage を用いた アプリ内での画像の扱い方
miup
5
25k
Firebase Cloud Messaging 入門編
miup
0
5.2k
Other Decks in Programming
See All in Programming
Agentic UI
manfredsteyer
PRO
0
180
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
170
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
210
Lessons from Spec-Driven Development
simas
PRO
0
210
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
800
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
300
Claspは野良GASの夢をみるか
takter00
0
200
CSC307 Lecture 17
javiergs
PRO
0
320
OSもどきOS
arkw
0
570
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
dRuby over BLE
makicamel
2
380
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
440
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
600
The Limits of Empathy - UXLibs8
cassininazir
1
360
Marketing to machines
jonoalderson
1
5.5k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The SEO Collaboration Effect
kristinabergwall1
1
490
How to train your dragon (web standard)
notwaldorf
97
6.7k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
310
My Coaching Mixtape
mlcsv
0
150
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
210
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Transcript
The way of truly serverless application Firebase.Yebisu #1
ࣗݾհ ࡾӜ (ID: miup) • ࠓ৽ଔͰೖࣾ (ࠃࣄۀ։ൃ෦ॴଐ) • ݄̑ͷଐ͔Β
Firebase Λ৮Γ࢝Ίͨ • iOS ΞϓϦ̐͘Β͍ॻ͍͍ͯΔ
Truly Serverless?
Truly Serverless • ج൫ͯ͢֎෦ BaaS, SaaS ʹґଘ • ॻ͘ͷΫϥΠΞϯτΞϓϦέʔγϣϯͱͦ ΕΒαʔϏεͱͷ࿈ܞͷΈ
Firebase ͰेͰʁ
Firebase ͷ • DB ͷΫΤϦ͕ѹతʹऑ͍ • FireStore ͰෳࡶͳΫΤϦ·͔͚ͩͳ͍
ΫΤϦ͕ऑ͍ͱʁ • ΫϥΠΞϯταΠυδϣΠϯ͕ඞཁ • ඇಉظ͕ॏͳͬͯͭΒ͍ • όάͷԹচ • ηϧͷߴ͞ܭࢉͱ͔͏·͍͔͘ͳ͍ https://qiita.com/miuP/items/ce3a3888d5411d2f8e70
Solution • Realm • ֎෦ݕࡧΤϯδϯΛ͏
Algolia Search • શจݕࡧΤϯδϯ • ຊޠରԠ • FireStore ͷશจݕࡧͷͱ͜ΖͰνϣϩͬͱ৮ ΕΒΕ͍ͯΔ
https://firebase.google.com/docs/firestore/solutions/search
࿈ܞ • ॻ͖ࠐΈݖݶͷ API Key ΛΫϥΠΞϯτͰ࣋ ͯͳ͍ • όοΫΤϯυΞϓϦέʔγϣϯ͕લఏ
Archtecture #BDLFOE "QQMJDBUJPO 'JSFCBTF &YUFSOBM4FSWJDF .PCJMF"QQ : Read : Write
Firebase ͚ͩͰͳΜͱ͔͍ͨ͠
CloudFunctions • HTTP DB ͷมߋΛϑοΫʹಈ࡞͢Δ Node.js ڥ • ͪΖΜ
TypeScript Ͱॻ͚Δ • ֎෦ API Λୟ͚Δ • Push ௨ૹΕΔ
Architecture 'JSFCBTF &YUFSOBM 4FSWJDF .PCJMF"QQ : Read :
Write $' %#
Write 'JSFCBTF $' %# .PCJMF"QQ &YUFSOBM 4FSWJDF callback
Firebase Cloud Messaging Silent Push
Read 'JSFCBTF &YUFSOBM 4FSWJDF .PCJMF"QQ %# Observe Realtime
Value Get main Data
ίʔυྫ
Algent • [WIP] • Algolia ͷΫϥΠΞϯτͷ wrapper • Decodable ͳܕΛ
Response Ͱࢦఆ • ˑˑˑˑˑ
Write functions.database.ref(‘path/to/user/{userID}').onCreate(async event => { let userID = event.params!.userID let
firUser = await admin.database() .ref(`path/to/user/${userID}`) .once(‘value').then(snap => snap.val()) let userIndex = algolia.initIndex('user') let user = new User(userID, firUser) return userIndex.addObject(user) // send FCM for callback }) ref: https://qiita.com/star__hoshi/items/6ee9d1413a34ca5849eb
Request struct AlgoliaFeedRequest: AlgoliaRequestProtocol { typealias HitType = Algolia.Feed var
indexName: String { return "feed" } var query: AlgentQuery { let query = AlgentQuery() return query } }
Read // search from algolia using Algent // Result<Response<Response<Request.HitType>, Error>
Algent.shared.search(request: AlgoliaFeedRequest()) Firebase.Post.databaseRef .child(feed.objectID) .child(“likes/count") .observe(.value) { [weak self] snapshot in if snapshot.exists() { self?.likeCountString.value = "\(snapshot.value as? Int)" } else { self?.likeCountString.value = "0" } }
Sample • SNS ͬΆ͍ͭ • Feed ͱ User Algolia
͔Βݕࡧ • ͍͍ͶʂߘͳͲͷมಈ͢ΔͷΈΛ RealtimeDB͔ΒObserve • Silent Push ͔Βߋ৽ະ࣮
σϞ https://github.com/miuP/AlgoliaFirebaseSample
·ͱΊ • Truly Serverless • Firebase ͰͰ͖ͳ͍͜ͱແཧͤͣผͷࡦΛ ࿅Δ • ֎෦αʔϏεͱͷ࿈ܞͳ͍
ϞόΠϧΤϯδχΞ͚ͩͰαʔϏε࡞Δͧʙʂ
Q&A