--- name: Project Overview description: High-level architecture, stack, and current progress of Halo Bestie type: project --- **Halo Bestie** — Mental health chat platform connecting clients with trained mental health professionals (mitra). Paid service with optional trial period. **Folder structure:** - `requirement/` — requirement documents (phased) - `backend/` — Fastify.js API server - `client_app/` — Flutter app for clients (iOS + Android) - `mitra_app/` — Flutter app for professionals/mitra (iOS + Android) - `control_center/` — React + Vite SPA, internal management tool **Tech stack:** - Backend: Fastify.js, single codebase, two listeners (public :3000, internal :3001) - Database: PostgreSQL (GCP Cloud SQL) - Auth: Firebase Auth — Google/Apple social login + phone OTP (native Flutter UI, no WebView) - Payment: Xendit - Mobile: Flutter (iOS + Android) - Control Center: React + Vite SPA - Infra: GCP — Cloud Run, Cloud SQL, VPC private networking **Critical decisions:** 1. One backend serves both mobile apps — routes namespaced `/api/client/`, `/api/mitra/`, `/api/shared/` 2. Control center API is internal-only — Nginx `allow 10.0.0.0/8; deny all` + VPN 3. Firebase JWT verified on every authenticated Fastify route 4. Scale horizontally (Cloud Run) before considering microservices split 5. Real-time/chat features deferred to a future requirements phase **Phase 1 (Authentication) — fully scaffolded:** - Backend: two listeners, all routes, services, DB migrations, seed script - client_app: Flutter BLoC, all auth screens (welcome, display name, register, OTP, force-register, home placeholder) - mitra_app: Flutter BLoC, OTP-only login, inactive/not-found error handling - control_center: React + Vite, email/password login, mitra management, user management, anonymity settings - API contract: `requirement/phase1-api-contract.md` - Plan: `requirement/phase1-plan.md` - UI mockup: `requirement/client_app_mockup.html` **Next:** Phase 2 — sessions, chat, payments. Requirements not yet written.