Deployment
Prerequisites
- Node 22
- pnpm (monorepo) — except
yugma-functionswhich uses npm - Firebase CLI (
npm install -g firebase-tools) - Firebase project
yugmastudio-addcd
Build Commands
# From repo root
cd packages/yugma-app && ./node_modules/.bin/tsc --noEmit # Type check
cd packages/yugma-app && npm run build # Vite build
cd packages/yugma-functions && npm run build # Functions tsc
Deploy Commands
# Deploy everything
firebase deploy --only functions,hosting:app,firestore:rules,database
# Deploy individually
firebase deploy --only functions # Cloud Functions
firebase deploy --only hosting:app # Studio app
firebase deploy --only firestore:rules # Firestore security rules
firebase deploy --only database # RTDB rules (collab, rooms, shareLinks)
firebase deploy --only storage # Storage rules
Hosting Targets
| Target | Site ID | URL | Source |
|---|---|---|---|
app | yugmastudio-app | https://yugmastudio-app.web.app | packages/yugma-app/dist |
landing | yugmastudio | https://yugmastudio.web.app | packages/yugma-landing/dist |
admin | yugmastudio-admin | https://yugmastudio-admin.web.app | packages/yugma-admin/dist |
docs | yugmastudio-docs | https://yugmastudio-docs.web.app | packages/yugma-docs/build |
Secrets Configuration
Required for core features
# Gemini — the only AI provider (AI Composer and AI Materials are dead without it)
echo "..." | firebase functions:secrets:set GEMINI_API_KEY
# Stripe — billing webhook signing secret (from Stripe Dashboard → Developers → Webhooks)
echo "whsec_..." | firebase functions:secrets:set STRIPE_WEBHOOK_SECRET
Go-Live Checklist
- Enable the Google sign-in provider in Firebase Console (Authentication → Sign-in method):
- Google — enable + set support email (Google OAuth is the only sign-in method)
- Set the
GEMINI_API_KEYsecret (see above) - Register the Stripe webhook endpoint (Stripe Dashboard → Developers → Webhooks): add
https://us-central1-yugmastudio-addcd.cloudfunctions.net/stripeWebhookwith eventscheckout.session.completed,customer.subscription.updated,customer.subscription.deleted, then set the signing secret asSTRIPE_WEBHOOK_SECRET(see above) cd packages/yugma-functions && npm run buildcd packages/yugma-app && npm run build- Deploy in order (see the warning below): functions →
syncAdminClaims→ admin re-login → rules - Test: sign in → send "Build a room" in AI composer → verify objects appear
Deploy order matters.
firestore.rulesisAdmin()reads theadmincustom claim, notsysconfig/admins. Deploy functions first, then run the admin-gatedsyncAdminClaimscallable (the initial backfill), have admins sign out and back in so their ID token carries the freshadminclaim, and only thenfirebase deploy --only firestore:rules. Shipping rules before the claims propagate can lock admins out.
Package Manager Traps
- Monorepo uses pnpm (
pnpm-workspace.yaml) yugma-functionsuses npm (Firebase Cloud Build runsnpm install)- Do NOT run
pnpm installinyugma-functions/ - Use
npm install --ignore-scriptswhen adding deps to functions (avoids firebase-admin gulp build issue)
Known Issues
firebase-adminis pinned to13.8.0inyugma-functions— verify postinstall behavior before any version bump (12.7.0 once broke Cloud Build).yugma-functionscommitsnpm-shrinkwrap.jsonfor reproducible Cloud Build installs; the redundantpackage-lock.jsonwas removed 2026-07-06 — don't reintroduce it (npm installwon't create one while a shrinkwrap exists).