Phase 1 scaffold: auth for all apps

- Backend: Fastify with two listeners (public + internal), routes, services, DB migration + seed
- client_app: Flutter with BLoC, all auth screens (welcome, display name, register, OTP, force-register)
- mitra_app: Flutter with BLoC, OTP-only login
- control_center: React + Vite, email/password login, mitra/user management, anonymity settings
- Docs: phase1 plan, API contract, client app mockup
- CLAUDE.md and shared memory for all subprojects

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 10:08:42 +08:00
commit a7a2a32d27
85 changed files with 3953 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
---
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.