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
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
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.3k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
370
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.7k
ふつうのFeature Flag実践入門
irof
8
4.1k
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
550
Lessons from Spec-Driven Development
simas
PRO
0
210
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.3k
OSもどきOS
arkw
0
570
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.3k
Creating Composable Callables in Contemporary C++
rollbear
0
150
Featured
See All Featured
Everyday Curiosity
cassininazir
0
230
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
850
Fireside Chat
paigeccino
42
4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Darren the Foodie - Storyboard
khoart
PRO
3
3.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