Initial Project Setup โ Historical Reference โ
โ ๏ธ Archived. Not forward-looking.
This document captures how the Lantern infrastructure was originally provisioned: the two Firebase projects, Cloudflare Pages, and the branch-based deployment strategy. None of these steps need to be repeated for new developers โ those projects already exist.
Kept for:
- Institutional knowledge ("why was it set up this way?")
- Disaster recovery (rebuilding from scratch if the GCP org is lost)
- Partners / forks ("Lantern for cities" or similar deployments)
- Audit / compliance reference
For day-to-day new-developer onboarding, see ENVIRONMENT_SETUP.md.
Last verified accurate: content matches the state of the
lantern-app-dev/lantern-app-prodprojects and Cloudflare Pages setup circa Q1 2026. May drift over time; treat as a starting point, not a guaranteed-current procedure.
What this document covers โ
The original ~20-min bootstrapping procedure for a fresh Lantern deployment:
- Create two Firebase projects (dev + prod)
- Enable Firebase services (Auth, Firestore, Storage) in each
- Wire Cloudflare Pages to the GitHub repo
- Configure environment variables for both Production (
main) and Preview (dev+ feature branches) - Set up the
main/devbranch strategy
These steps assume you have:
- A GitHub account that owns (or has admin on) the repository
- A GCP / Firebase account
- A Cloudflare account with a verified domain
Step 1: Create Firebase DEV Project โ
- Go to https://console.firebase.google.com
- Click "Add project"
- Name:
lantern-app-dev - Disable Google Analytics (or enable if you want)
- Click "Create project"
Wait for project to be created (~1 minute).
Step 2: Enable Firebase Services in DEV โ
In your lantern-app-dev project:
Authentication:
- Click "Authentication" in left sidebar
- Click "Get started"
- Click "Email/Password"
- Enable the toggle
- Click "Save"
Firestore Database:
- Click "Firestore Database"
- Click "Create database"
- Choose "Start in test mode"
- Select region (e.g.,
us-central1) - Click "Enable"
Storage:
- Click "Storage"
- Click "Get started"
- Start in test mode
- Click "Next" โ "Done"
Step 3: Create Firebase PRODUCTION Project โ
Repeat Steps 1โ2 but name the project lantern-app-prod:
- Firebase Console โ Add project
- Name:
lantern-app-prod - Enable Authentication, Firestore, Storage (same as dev)
- Get the config (โ๏ธ โ Project settings โ Add web app โ "Lantern Prod")
โ ๏ธ Save both configs (dev AND prod) โ you'll need them for Cloudflare.
Step 4: Set Up Cloudflare Pages โ
Prerequisites: Have your GitHub repo cattreedev/lantern_app ready.
4.1: Create Cloudflare Pages Project โ
- Go to https://dash.cloudflare.com
- Click "Pages" in left sidebar
- Click "Create a project"
- Click "Connect to Git"
- Authorize GitHub (if needed)
- Select repository:
cattreedev/lantern_app - Click "Begin setup"
4.2: Configure Build Settings โ
- Project name:
lantern-app - Production branch:
main - Build command:
npm run build - Build output directory:
dist - Root directory: (leave empty or
/)
Click "Save and Deploy" (it will fail first time โ that's OK!)
4.3: Set Environment Variables โ
- Go to your Cloudflare Pages project
- Click "Settings" โ "Environment variables"
For Production (main branch):
Click "Add variable" for each of these (using your lantern-app-prod config):
| Variable Name | Value (from lantern-app-prod) |
|---|---|
VITE_FIREBASE_API_KEY | AIzaSy... (prod) |
VITE_FIREBASE_AUTH_DOMAIN | lantern-app-prod.firebaseapp.com |
VITE_FIREBASE_PROJECT_ID | lantern-app-prod |
VITE_FIREBASE_STORAGE_BUCKET | lantern-app-prod.appspot.com |
VITE_FIREBASE_MESSAGING_SENDER_ID | 123... (prod) |
VITE_FIREBASE_APP_ID | 1:123... (prod) |
VITE_APP_ENV | production |
NODE_VERSION | 20 |
For Preview (all other branches):
Repeat above, but use values from lantern-app-dev config:
| Variable Name | Value (from lantern-app-dev) |
|---|---|
VITE_FIREBASE_API_KEY | AIzaSy... (dev) |
VITE_FIREBASE_AUTH_DOMAIN | lantern-app-dev.firebaseapp.com |
VITE_FIREBASE_PROJECT_ID | lantern-app-dev |
VITE_FIREBASE_STORAGE_BUCKET | lantern-app-dev.appspot.com |
VITE_FIREBASE_MESSAGING_SENDER_ID | 123... (dev) |
VITE_FIREBASE_APP_ID | 1:123... (dev) |
VITE_APP_ENV | development |
NODE_VERSION | 20 |
Click "Save"
Step 5: Trigger First Deployment โ
In your terminal:
# Make a small change to trigger deployment
echo "# Deployment test" >> README.md
# Commit and push
git add .
git commit -m "Configure deployment environment"
git push origin mainWait ~2 minutes for build.
Go to Cloudflare Pages โ "Deployments" to watch progress.
โ Success! When build completes, visit your production URL.
Step 6: Create Dev Branch โ
# Create dev branch from main
git checkout -b dev
git push origin devIn Cloudflare Pages:
- Go to Settings โ Builds & deployments
- Verify "Preview deployments" is enabled for all branches
Now when you push to dev, it auto-deploys to a preview URL.
Why this structure? โ
| Decision | Rationale |
|---|---|
Two Firebase projects (lantern-app-dev + lantern-app-prod) | Hard isolation โ bad data, mistaken deletes, schema experiments in dev can never affect prod. |
Branch โ environment mapping (main โ prod, dev โ preview) | Auto-deployment without manual gates; promotes via PR merges. |
| GCP Secret Manager (not Cloudflare Pages env vars) | Single source of truth for server-side secrets โ Cloud Functions, Cloud Run, and local dev all read the same values. Cloudflare Pages env vars are reserved for VITE_* public values that need to be in the browser bundle. |
| us-central1 region | Matches the rest of the GCP infrastructure (Cloud Run, Dataform, etc.). |
| Test-mode Firestore initially | Faster setup; security rules are layered on later via firestore.rules in the repo. |
What's been added since โ
Since the initial setup, the project has grown additional infrastructure that also requires provisioning if you're rebuilding from scratch. These are documented in their own files:
- Cloud Functions โ Firebase Functions v2 with secrets via
defineSecret. See SECRETS_MANAGEMENT.md. - Cloud Run services โ Auth, Venue, Analytics, Merchants, Assistant, Docs, Lanterns. Each has its own deploy workflow in
.github/workflows/deploy-dev.yml. - Dataform โ BigQuery transforms. See project_dataform_flat_branch memory note.
- Cloud Run Jobs โ
ingest-cloudflare,ingest-github,ingest-invoicesfor the billing pipeline. See project_billing_pipeline_state. - Workload Identity Federation (WIF) โ for keyless CI auth. Configured in GCP IAM, referenced in
deploy-*.ymlworkflows.
The canonical "how does this all wire together" reference is the deploy workflow files themselves โ they show every service, every secret, every IAM grant in executable form.
Related โ
- Secrets Management โ Current secret architecture (Secret Manager + bootstrap)
- Environment Setup โ Day-to-day new-developer onboarding (replaces this doc for that purpose)
- Deploy workflows โ Source of truth for what gets deployed and how