Firebase-native gut-health coaching platform. Next.js 15 + Expo monorepo with multi-tenant workspaces, AI-assisted meal scoring, and a full daily planner.
| Layer | Tech |
|---|---|
| Web app | Next.js 15 (App Router) |
| Mobile | Expo Router (scaffold) |
| Auth | Firebase Authentication |
| Database | Cloud Firestore |
| Storage | Firebase Storage |
| AI | Anthropic Claude (server-side proxy) |
| Analytics | PostHog (scaffold) |
| Errors | Sentry (scaffold) |
| Billing | Stripe (scaffold) |
apps/
web/ Next.js app — all pages, API routes, components
mobile/ Expo React Native scaffold
functions/ Firebase Cloud Functions (background jobs, OCR pipeline)
packages/
ui/ Design tokens + shared components (Playfair Display, Outfit, parchment palette)
types/ Shared TypeScript interfaces
domain/ Deterministic meal scoring, gamification, recommendation engine
ai/ Anthropic provider abstraction, structured output contracts, entitlement checks
firebase/ Client + Admin SDK setup, typed repositories
config/ Env parsing, feature flags, plan entitlements
validation/ Zod schemas
git clone https://github.com/YOUR_ORG/ibiome.git
cd ibiome
npm install
Copy the example and fill in your values:
cp .env.example .env.local
Open .env.local and fill in:
# ── App ──────────────────────────────────────────────────────────────
NEXT_PUBLIC_APP_NAME=InnerBiome
NEXT_PUBLIC_USE_FIREBASE_EMULATORS=false
# ── Firebase Web Config ───────────────────────────────────────────────
# Firebase Console → Project Settings → Your apps → web app → SDK config
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaSy...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=ibiome-app.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=ibiome-app
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=ibiome-app.firebasestorage.app
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=123456789
NEXT_PUBLIC_FIREBASE_APP_ID=1:123456789:web:abc123
# ── Firebase Admin SDK ────────────────────────────────────────────────
# Firebase Console → Project Settings → Service accounts → Generate new key
FIREBASE_PROJECT_ID=ibiome-app
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxxxx@ibiome-app.iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIE...\n-----END PRIVATE KEY-----\n"
# ── Anthropic (AI Coach features) ────────────────────────────────────
# console.anthropic.com → API Keys
ANTHROPIC_API_KEY=sk-ant-api03-...
Windows + OneDrive users: do NOT use
next dev— usenext build && next startto avoid EINVAL readlink errors.
# One-time setup — deploys Firestore rules, Storage rules, indexes
npx firebase deploy --only firestore,storage
cd apps/web
npm run build
npm start
# → http://localhost:3000
cd apps/web
npx tsc --noEmit
apps/web.env.local in Vercel project settingsVercel auto-detects Next.js and handles the monorepo correctly with vercel.json (included).
# Add output: standalone to apps/web/next.config.ts first, then:
npx firebase deploy --only hosting
See docs/deploy-firebase.md for full Cloud Run setup.
If starting from a fresh Firebase project:
# 1. Update .firebaserc with your project ID
# 2. Enable Authentication → Email/Password provider
# 3. Create Firestore database (production mode)
# 4. Enable Storage
# 5. Deploy rules
npx firebase deploy --only firestore,storage
/api/onboarding/bootstrap
/users/{uid}, /users/{uid}/profile/main, /workspaces/{id}, /workspaces/{id}/memberships/{uid}loadPlannerDashboard() calls ensurePlannerMonthSeed()/users/{uid}/tracking/default/dailyPlans/{isoDate}/users/{uid}/tracking/default/dailyCheckins/{isoDate}All AI calls are server-side. No Anthropic key is ever sent to the client.
| Feature | Route | Gate |
|---|---|---|
| Meal scoring | POST /api/ai/meal-score |
Pro |
| Menu URL analysis | POST /api/ai/menu-url |
Pro |
| Dietician chat | POST /api/ai/chat |
Pro |
users/{uid}/uploads/{docId}/{filename}users/{uid}/uploadedDocuments/{docId}apps/functions/)| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_FIREBASE_API_KEY |
✅ | Firebase web API key |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN |
✅ | project.firebaseapp.com |
NEXT_PUBLIC_FIREBASE_PROJECT_ID |
✅ | Firebase project ID |
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET |
✅ | Firebase storage bucket |
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID |
✅ | Firebase sender ID |
NEXT_PUBLIC_FIREBASE_APP_ID |
✅ | Firebase app ID |
FIREBASE_PROJECT_ID |
✅ | Same as public project ID (server-side) |
FIREBASE_CLIENT_EMAIL |
✅ | Service account email |
FIREBASE_PRIVATE_KEY |
✅ | Service account private key (with \n newlines) |
ANTHROPIC_API_KEY |
⚠️ AI only | Enables AI Coach features |
NEXT_PUBLIC_USE_FIREBASE_EMULATORS |
❌ optional | Set true for local emulator dev |
FIREBASE_PRIVATE_KEY) must never be committed to git.env.local is in .gitignore — never commit itPrivate — all rights reserved.