Firebase Multi‑Project Architecture – MEGA ASCII Diagram
Firebase Multi‑Project Architecture
⚡ The complete visual reference — everything from our deep‑dive session condensed into a single, massive ASCII diagram.
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

Popular posts from this blog

[MAIN PROGRAM] UNDONE HOUSEHOLD WORKs WEB-PROGRAM v2/MAIN

PENDING ITEMs [REVISION] v0