Firebase
Google's backend-as-a-service for mobile and web apps: Firestore, Authentication, Security Rules, Cloud Functions, Storage, Hosting and FCM. Asked where an app ships without its own server.
on this pageshowhide
explore
- Firestore & Realtime DB6 questions
- Firebase Authentication6 questions
- Security Rules6 questions
- Cloud Functions6 questions
- Storage & Hosting6 questions
- Cloud Messaging (FCM)6 questions
questions
page 2 of 2In a Firestore task app, every task change also updates an openTaskCount field on the project document; why does this degrade as the team grows, and what do you change?
basics
~20 sEvery task change funnels a write into one project document, and a single Firestore document sustains only a limited write rate, so contention brings latency, retries and errors. Use FieldValue.increment, shard the counter across documents, or compute it with count().
In Firestore Security Rules for a classroom app, when should a teacher check read a custom claim from request.auth.token rather than call get() on a roles document?
basics
~20 sUse a custom claim for a coarse, slow-changing role such as teacher: it costs no read but stays stale until a new ID token. Use get() or exists() for live per-class membership, paying a billed read and a capped lookup count.
Why does a Cloud Function behind a Firebase Hosting rewrite run on every request and never see the session cookie, and what fixes both?
basics
~20 sHosting's CDN does not cache function responses unless they say so, and it strips cookies from requests except one named __session. Send Cache-Control: public with s-maxage for shareable pages, and rename the session cookie to __session.
A user uploads a 300 MB recipe video with the Firebase Storage Android SDK and Android kills the process halfway; how do you resume without re-sending the first half?
basics
~20 sSave the upload snapshot's uploadSessionUri to persistent storage once it appears, then after the restart call putFile(uri, metadata, sessionUri). The SDK asks the server how many bytes arrived and continues from there; sessions last a week.
As the lead on an Android app built on Firebase, how do you decide which writes go straight from the client under Security Rules and which go through Cloud Functions?
basics
~20 sLet the client write directly where Security Rules can validate the change from the request alone; route a write through a callable when it needs secrets, hidden data or cross-document invariants, and deny that direct path in rules. Triggers handle consequences.
How do Firebase Authentication custom tokens let users of an existing login system sign in to Firebase from an Android app?
basics
~10 sYour server validates the user with its own system, then mints a signed JWT with the Admin SDK's createCustomToken(uid). The app exchanges it with signInWithCustomToken and gets an ordinary Firebase session for that uid.
showing 31–36 of 36