RealComposer

Firebase Safe & Unsafe Practices

Direct Answer

The Firebase web config (including apiKey) is a public identifier, not a secret. Data is protected by Firestore, Realtime Database, and Storage Security Rules plus App Check. Admin SDK service account JSON bypasses rules and must only exist on servers.

Credentials & Where They Belong

Client safe
Web config apiKey

Identifies your project. Restrict it to required APIs in Google Cloud Console.

Server only
Service account JSON (Admin SDK)

Full admin access that ignores Security Rules.

Server only
FCM server credentials

Send push notifications to any device in your project.

Safe Practices

  • Write least-privilege Security Rules

    Require request.auth and match document ownership in rules for Firestore, Realtime Database, and Storage.

  • Enable App Check

    App Check makes it harder for scripts outside your app to call your Firebase backends.

  • Verify ID tokens on your server

    Use verifyIdToken in trusted code before acting on a user identity sent from the client.

Unsafe Practices

  • Shipping test-mode rules to production

    Rules like allow read, write: if true expose your entire database to anyone with the config.

  • Bundling the service account JSON into an app

    It grants admin access that bypasses every rule you wrote.

  • Relying on hiding the config as security

    The config is visible in every client. Only rules and App Check protect data.

The RealComposer Pattern

Put service account credentials in the vault and expose aggregated or admin reads as edge pipelines. Clients keep using the Firebase SDK under Security Rules for user-owned data.

START BUILDING FREE

Frequently Asked Questions

Q:Is the Firebase apiKey a secret?

No. It identifies the project and is safe to ship. Security Rules and App Check are what prevent abuse.

Security & Secret Vault

Call firebase admin api from nextjs without exposing service account

Store service account JSON in Vault; Next.js routes call RealComposer instead of Firebase Admin SDK in serverless bundles. For "call firebase admin api from nextjs without exposing service account", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/call-firebase-admin-from-nextjs-securely with an rc_live_ client token.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide firebase api key in react native mobile app

Client uses anon rules; privileged reads run through edge proxy with Firebase tokens injected. For "hide firebase api key in react native mobile app", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/hide-firebase-api-key-react-native with an rc_live_ client token.

Sub-10ms edgeView Recipe

Combine firebase auth user with supabase profile endpoint

Firebase ID token lookup and Supabase profile row merged at edge. For "combine firebase auth user with supabase profile endpoint", store FIREBASE_ACCESS_TOKEN, SUPABASE_SERVICE_ROLE_KEY in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React / Flutter / Mobile hit only https://realcomposer.com/v1/workspace/combine-firebase-auth-with-supabase-profile with an rc_live_ client token.

Sub-10ms edgeView Recipe
Multi-API Aggregation

Stitch firebase with clerk session bootstrap

Clerk session and Firebase FCM registration merged at startup. For "stitch firebase with clerk session bootstrap", store FIREBASE_ACCESS_TOKEN, CLERK_SECRET_KEY in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/stitch-firebase-with-clerk-bootstrap with an rc_live_ client token.

Sub-10ms edgeView Recipe

How to reduce firebase firestore json payload size

Strips document names revision metadata and map noise at edge. For "how to reduce firebase firestore json payload size", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let Flutter / React Native / Swift hit only https://realcomposer.com/v1/workspace/reduce-firebase-firestore-json-size with an rc_live_ client token.

Sub-10ms edgeView Recipe
Payload Slimmer

Firebase user profile api strip sensitive fields

Remove refresh tokens providerData internals at edge. For "firebase user profile api strip sensitive fields", store FIREBASE_ACCESS_TOKEN in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/strip-firebase-user-profile-sensitive with an rc_live_ client token.

Sub-10ms edgeView Recipe

Related Concepts