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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Contextとはなにか
chiroruxx
1
390
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
280
初めてのKubernetes 本番運用でハマった話
oku053
0
120
AIエージェントで 変わるAndroid開発環境
takahirom
2
510
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
120
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
220
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
840
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
260
Creating Composable Callables in Contemporary C++
rollbear
0
200
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
160
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
YesSQL, Process and Tooling at Scale
rocio
174
15k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
So, you think you're a good person
axbom
PRO
2
2.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
The Spectacular Lies of Maps
axbom
PRO
1
850
Become a Pro
speakerdeck
PRO
31
6k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
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