It explains: 1 project = 1 database (Spark rule), unique API key + config per project (Project A → Config A), unlimited apps per project, free‑plan limits, cross‑project bridging, and the final decision tree. No fluff, just architecture truth.
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ F I R E B A S E M U L T I - P R O J E C T A R C H I T E C T U R E │
│ "1 Project = 1 Database + 1 Unique API Key/Config" │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
▲
│ owns & manages
│
┌─────────────────────┴─────────────────────┐
│ │
│ π€ DEVELOPER (One Account) │
│ Unlimited Firebase Projects allowed │
│ │
└───────────────┬───────────────┬───────────┘
│ │
┌───────────────────────┼───────────────┼───────────────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PROJECT A │ │ PROJECT B │ │ PROJECT C │ │ ... │
│ (E‑commerce) │ │ (Admin System) │ │ (Analytics) │ │ (Unlimited) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │ │
│ 1:1 rule ──────────────────────────────────────────────────────────▶ │
│ Each project owns EXACTLY ONE database (Spark = 1 Firestore + 1 RTDB) │
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ π️ DATABASE A │ │ π️ DATABASE B │ │ π️ DATABASE C │ │ π️ DATABASE N │
│ Firestore/RTDB │ │ Firestore/RTDB │ │ Firestore/RTDB │ │ (isolated) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │ │
│ Unique API & Config ───────────────────────────────────────────────▶ │
│ Project A → API Key A, Config A (never cross‑wire!) │
│ Project B → API Key B, Config B │
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ APPS (unlimited per project) │
├───────────────────────────────────┬─────────────────────────────────────────────────────┤
│ PROJECT A apps (all share DB A) │ PROJECT B apps (all share DB B) │
│ ┌────────────┐ ┌────────────┐ │ ┌────────────┐ ┌────────────┐ │
│ │ π Web App │ │ π Web App │ │ │ π± Android │ │ π± Android │ │
│ │ Store │ │ Dashboard │ │ │ Staff App │ │ Field App │ │
│ └────────────┘ └────────────┘ │ └────────────┘ └────────────┘ │
│ ┌────────────┐ │ ┌────────────┐ │
│ │ π± Android │ │ │ π Web App │ │
│ │ Buyer App │ │ │ Admin Panel│ │
│ └────────────┘ │ └────────────┘ │
└───────────────────────────────────┴─────────────────────────────────────────────────────┘
╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ F R E E P L A N ( S P A R K ) L I M I T S ║
╠═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ ✅ CAN do: ❌ CANNOT do: ║
║ • Many apps (web + Android + iOS) sharing 1 project's database • 2 separate databases inside 1 project ║
║ • Multiple Firebase projects (each with its own free quota) • Multiple Firestore DBs per project (Blaze only) ║
║ • Separate data logically via collections/paths • Multiple RTDB instances (1 per project max) ║
║ • Use Project A + Project B as workaround for two databases • Unlimited reads/writes (strict quotas apply) ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ C R O S S - P R O J E C T D A T A S H A R I N G │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ╔═══════════════════╗ ╔═══════════════════╗ │
│ ║ PROJECT A ║ ║ PROJECT B ║ │
│ ║ Database A ║ ║ Database B ║ │
│ ╚═════════╤═════════╝ ╚═════════╤═════════╝ │
│ │ │ │
│ │ NO automatic sync ─────────┼──────▶ ❌ Built-in replication? NO │
│ │ │ │
│ │ Manual bridging only │ │
│ └──────────────┬───────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ π MANUAL BRIDGE OPTIONS │ │
│ │ • Cloud Functions │ │
│ │ • REST API calls │ │
│ │ • External backend service │ │
│ │ • Pub/Sub message relay │ │
│ └─────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Y O U R D E C I S I O N T R E E │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────────────────────────┐ │
│ │ Do apps need to share data? │ │
│ └─────────────────┬─────────────────┘ │
│ │ │
│ ┌────────────────────────────┼────────────────────────────┐ │
│ │ │ │ │
│ YES │ NO │
│ │ │ │ │
│ ▼ │ ▼ │
│ ┌───────────────────┐ │ ┌───────────────────┐ │
│ │ OPTION 1 │ │ │ OPTION 2 │ │
│ │ Single Project │ │ │ Multiple Projects│ │
│ │ One shared DB │ │ │ Separate DBs │ │
│ │ Many apps │ │ │ per project │ │
│ └─────────┬─────────┘ │ └─────────┬─────────┘ │
│ │ │ │ │
│ ▼ │ ▼ │
│ ✅ Recommended for │ ✅ Clean isolation │
│ related apps │ for unrelated systems │
│ (e.g., same user base) │ (e.g., different customers) │
│ │ │
│ │ │
│ ┌────────────────────┴────────────────────┐ │
│ │ Need two separate databases? │ │
│ └────────────────────┬────────────────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ │ │ │ │
│ YES │ NO │
│ │ │ │ │
│ ▼ │ ▼ │
│ ┌───────────────────┐ │ ┌───────────────────┐ │
│ │ Use TWO (or more) │ │ │ Keep ONE project │ │
│ │ Firebase projects │ │ │ Use collections │ │
│ │ Project A + B │ │ │ to separate data │ │
│ └───────────────────┘ │ └───────────────────┘ │
│ │ │
│ │ │
│ ┌────────────────────┴────────────────────┐ │
│ │ On Spark free plan? │ │
│ └────────────────────┬────────────────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ │ │ │ │
│ YES │ NO │
│ │ │ │ │
│ ▼ │ ▼ │
│ ┌───────────────────┐ │ ┌───────────────────┐ │
│ │ Multiple projects │ │ │ Consider Blaze │ │
│ │ is your ONLY way │ │ │ for multi-database│ │
│ │ for 2+ databases │ │ │ (paid feature) │ │
│ └───────────────────┘ │ └───────────────────┘ │
│ │ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ C A R D I N A L R U L E S (MUST REMEMBER) ║
╠═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╣
║ ║
║ ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ ║
║ │ π RULE 1: 1 PROJECT = 1 DATABASE (1:1 relationship) — on Spark you cannot have two databases inside one project │ ║
║ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ ║
║ │ π RULE 2: Each project has its OWN API KEY & CONFIG — Project A → Config A, Project B → Config B (never mix!) │ ║
║ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ ║
║ │ π¦ RULE 3: 1 PROJECT = MANY APPS — unlimited web/Android/iOS apps can share the same project & database │ ║
║ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ ║
║ │ π€ RULE 4: 1 DEVELOPER = UNLIMITED PROJECTS — one account can own and manage hundreds of Firebase projects │ ║
║ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ ║
║ │ π« RULE 5: NO automatic cross-project data sharing — bridges must be built manually (Cloud Functions, REST, etc.) │ ║
║ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
LEGEND
┌─────────────────────────────────────┐
│ π️ = Database π = Web App │
│ π± = Android App π = API Key/Config│
│ π€ = Developer π« = Not allowed │
│ ✅ = Allowed ❌ = Forbidden │
│ π = Manual bridge │
└─────────────────────────────────────┘
π 1:1 Database rule
One Firebase project = exactly one Firestore + one RTDB on Spark. Need two separate databases? Create two projects.
Spark invariantπ Unique API key per project
Project A → API Key A + Config A. Project B → Config B. Never mix credentials; apps are bound to their own project.
isolationπ¦ Many apps, one DB
Web, Android, iOS — all can share the same database inside a project. Logical separation using collections/paths.
flexibleπ Cross‑project bridges
No automatic sync. Use Cloud Functions, REST API, or Pub/Sub to manually exchange data between projects.
manual onlyπ§ Why this diagram matters: It’s the condensed knowledge from our entire conversation — from the one‑project‑one‑database cardinal rule to the per‑project unique API keys (Project A → Config A, Project B → Config B). Whether you’re on the Spark free plan (single database per project) or architecting multiple isolated systems, this visual reference saves hours of confusion. Bookmark it, share it, or pin it to your team’s wiki.
Comments
Post a Comment