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
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.7k
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
210
Oxlintはいいぞ(続)
yug1224
1
540
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
0
170
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
500
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
440
業務時間外もAIに働いてもらう話
colorful12
3
9.9k
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.7k
ALB ログから Trace を気合で繋げる技術
fohte
7
860
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
140
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
300
信頼性の目標を誰も求めてない
shubox
0
490
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
400
Optimizing for Happiness
mojombo
378
71k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
840
My Coaching Mixtape
mlcsv
0
300
Chasing Engaging Ingredients in Design
codingconduct
0
300
The SEO Collaboration Effect
kristinabergwall1
1
550
Game over? The fight for quality and originality in the time of robots
wayneb77
1
260
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Music & Morning Musume
bryan
47
7.4k
A better future with KSS
kneath
240
18k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
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