Skip to main content

Deployment

Prerequisites

  • Node 22
  • pnpm (monorepo) — except yugma-functions which 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

TargetSite IDURLSource
appyugmastudio-apphttps://yugmastudio-app.web.apppackages/yugma-app/dist
landingyugmastudiohttps://yugmastudio.web.apppackages/yugma-landing/dist
adminyugmastudio-adminhttps://yugmastudio-admin.web.apppackages/yugma-admin/dist
docsyugmastudio-docshttps://yugmastudio-docs.web.apppackages/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

  1. 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)
  2. Set the GEMINI_API_KEY secret (see above)
  3. Register the Stripe webhook endpoint (Stripe Dashboard → Developers → Webhooks): add https://us-central1-yugmastudio-addcd.cloudfunctions.net/stripeWebhook with events checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, then set the signing secret as STRIPE_WEBHOOK_SECRET (see above)
  4. cd packages/yugma-functions && npm run build
  5. cd packages/yugma-app && npm run build
  6. Deploy in order (see the warning below): functions → syncAdminClaims → admin re-login → rules
  7. Test: sign in → send "Build a room" in AI composer → verify objects appear

Deploy order matters. firestore.rules isAdmin() reads the admin custom claim, not sysconfig/admins. Deploy functions first, then run the admin-gated syncAdminClaims callable (the initial backfill), have admins sign out and back in so their ID token carries the fresh admin claim, and only then firebase deploy --only firestore:rules. Shipping rules before the claims propagate can lock admins out.

Package Manager Traps

  • Monorepo uses pnpm (pnpm-workspace.yaml)
  • yugma-functions uses npm (Firebase Cloud Build runs npm install)
  • Do NOT run pnpm install in yugma-functions/
  • Use npm install --ignore-scripts when adding deps to functions (avoids firebase-admin gulp build issue)

Known Issues

  • firebase-admin is pinned to 13.8.0 in yugma-functions — verify postinstall behavior before any version bump (12.7.0 once broke Cloud Build).
  • yugma-functions commits npm-shrinkwrap.json for reproducible Cloud Build installs; the redundant package-lock.json was removed 2026-07-06 — don't reintroduce it (npm install won't create one while a shrinkwrap exists).