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
Firebase Database Rules How To Deal With - Olek...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
GDG Ternopil
January 21, 2017
Programming
78
0
Share
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
GDG Ternopil
January 21, 2017
More Decks by GDG Ternopil
See All by GDG Ternopil
Semi supervised learning with Autoencoders by Ілля Горев
gdgternopil
2
91
Застосування ML в реальних проектах - Андрій Дерень
gdgternopil
2
120
Android Architecture Components by Ihor Dzikovskyy
gdgternopil
0
170
First look at Room Persistence by Oleksiy Sazhko
gdgternopil
0
130
Mobile Applications Architecture by Constantine Mars
gdgternopil
1
110
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
290
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
1
110
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
1
91
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
1
130
Other Decks in Programming
See All in Programming
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
170
20260315 AWSなんもわからん🥲
chiilog
2
190
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
140
20260320登壇資料
pharct
0
160
存在論的プログラミング: 時間と存在を記述する
koriym
5
770
Rethinking API Platform Filters
vinceamstoutz
0
8.3k
感情を設計する
ichimichi
5
760
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
130
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
520
Java 21/25 Virtual Threads 소개
debop
0
320
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
240
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
1
240
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Exploring anti-patterns in Rails
aemeredith
3
310
Google's AI Overviews - The New Search
badams
0
960
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Are puppies a ranking factor?
jonoalderson
1
3.2k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
870
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
140
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
430
Test your architecture with Archunit
thirion
1
2.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Transcript
Firebase Database Rules How To Deal With Oleksandr Pidlisnyi Senior
Software Engineer @ Perfectial LLC GDG Lviv
Firebase Realtime Database
WHAT IF I TELL YOU IT IS NOT DATABASE
None
Database? SQL NoSQL JSON
Realtime
None
Offline
Accessible from Client Devices Android iOS Web SDK for Node.js,
C++, JAVA, Unity
Rules .read .write .validate .indexOn
now root newData data auth $ variables Predefined variables
provider uid token auth
.validate { "rules": { "foo": { ".validate": "newData.isString() && newData.val().length
< 100" } } }
.indexOn – orderByChild { "lambeosaurus": { "height": 2.1, "length": 12.5,
"weight": 5000 }, "stegosaurus": { "height": 4, "length": 9, "weight": 2500 } }
.indexOn – orderByChild { "rules": { "dinosaurs": { ".indexOn": ["height",
"length"] } } }
.indexOn – orderByValue { "scores": { "bruhathkayosaurus": 55, "lambeosaurus": 21,
"linhenykus": 80, "pterodactyl": 93, "stegosaurus": 5, "triceratops": 22 } }
.indexOn – orderByValue { "rules": { "scores": { ".indexOn": ".value"
} } }
.read && .write { "rules": { "foo": { ".read": true,
".write": false } } }
.read && .write { "rules": { "users": { "$uid": {
".write": "$uid === auth.uid" } } } }
Magic { "users": { "John Doe": { "rules": { "blog":
true } }, "John Snow": { "rules": { "blog": false } } }
Magic "blog": { "1": { "title": "Blog Post 1" },
"2": { "title": "Blog Post 2" } } }
Magic "blog": { ".read": true, ".write": "root.child('users').child(auth.uid).child('rules').child('blog').val() === true" }
Magic "$collection": { ".read": true, ".write": "root.child('users').child(auth.uid).child('rules').child($collection).val() === true" }
Magic { "users": { "John Doe": { "rules": { "blog":
{ "read": true, "write": false } } } } }
Magic "$collection": { ".read": "root.child('users').child(auth.uid).child('rules').child($collection).child ('read').val() === true", ".write": "root.child('users').child(auth.uid).child('rules').child($collection).child
('write').val() === true" }
+OleksandrPidlisnyi @opidlisnyi fb.me/opidlisnyi Questions? Thank you!