Architecture Overview
Lacroo Pro follows a polyglot monorepo architecture with clear service boundaries.
High-Level Data Flow
Browser/Mobile → Next.js BFF (Auth + Server Actions) → Go API (Chi + WebSockets) → PostgreSQL 16
↕
Temporal Workers
↕
Redis (Cache)Key Principles
- OpenAPI Contract is God — Every cross-boundary type is generated from
/openapi.yaml - No ORMs — Raw SQL via sqlc + pgx
- Next.js is a BFF only — Never talks directly to Postgres
- No client-side polling — Postgres LISTEN/NOTIFY → Go WebSocket → TanStack Query invalidation
- Temporal for durable work — Any task >500ms or needing retry guarantees
Monorepo Boundaries
| Workspace | Purpose | Runtime |
|---|---|---|
apps/web | Next.js frontend + BFF | Vercel |
apps/mobile | Expo React Native app | iOS/Android |
apps/docs | Nextra documentation | Vercel |
packages/ui | Shared shadcn/ui components | — |
packages/config | Shared linting/TS configs | — |
packages/api-client | Generated OpenAPI TS client | — |
backend/api | Go Chi router handlers | Fly.io |
backend/workers | Temporal workflows | Fly.io |
backend/db | Postgres migrations + sqlc | — |