Repository structure — WELIFE
WP-REPOSITORY-ARCH-ENV-AUDIT-01 · 2026-08-06
Package manager / workspace
| Item |
Value |
| Package manager |
npm (package-lock.json at root + per-app) |
| Workspace system |
npm workspaces — packages/* (root package.json) |
| Build orchestrator |
None (no Turbo/Nx yet) |
Root package.json |
Orchestration scripts + workspaces |
| Shared packages |
packages/shared (@welife/shared — zod contracts) |
Apps still invoked via root scripts (--prefix api|mobile|…). Shared contracts: import @welife/shared.
Shared contracts (WP-PLATFORM-FOUNDATION-01)
| Export |
Dùng cho |
HealthResponse / parseHealthResponse |
GET /api/v1/health |
AuthSurface / AUTH_SURFACES |
CON/PAR/DRV/ADM |
PublicFeatureFlags |
GET /api/v1/feature-flags |
Feature flags: env FEATURE_* + optional Redis welife:ff:<key>.
Metrics (Prometheus text): GET /api/v1/health/metrics — scrape free (Prometheus OSS / Grafana sau).
Backlog scale (chưa làm)
- Split
mobile/src/services/api.ts theo domain
- Deep-link matrix chính thức
- Optional Grafana compose profile
Deployable apps
| Path |
Role |
Stack |
api/ |
NestJS REST + Socket.IO |
Nest 11 · Prisma · Postgres · Redis · MinIO |
mobile/ |
Consumer |
Expo SDK 54 · React Navigation |
partner/ |
Partner |
Expo SDK 57 (thin) |
driver/ |
Driver |
Expo SDK 57 (thin) |
dashboard/ |
Admin |
Vite + React |
Supporting trees
| Path |
Role |
packages/shared |
Shared zod/types (@welife/shared) |
docs/ |
Matrix, phase backlog, reports, architecture |
scripts/ |
env-check, smoke, audit, tree/env inventory |
deploy/ |
VPS / nginx helpers |
design/mockups/ |
JPG design assets (39) |
assets/ |
Sound pack |
.cursor/ |
Rules + skills |
Dependency direction (enforced by convention)
apps (mobile|partner|driver|dashboard) → HTTP/WS contract of API
apps → @welife/shared (types/contracts only)
apps -X→ api/src internals
api → @welife/shared
api -X→ mobile/partner/driver/dashboard source
Where things go
| Concern |
Location |
| Feature UI (consumer) |
mobile/src/features/<domain>/ |
| Navigation |
mobile/src/navigation/ |
| HTTP client |
mobile/src/services/api.ts (+ config/env.ts) |
| Theme tokens |
mobile/src/theme/tokens.ts |
| Nest modules |
api/src/modules/<tag>/ |
| Shared Nest helpers |
api/src/common/ |
| Prisma |
api/prisma/ |
| Env templates |
*/.env.example (never commit .env) |
| Design JPG |
design/mockups/ only |
Do not place
- Business logic in
utils.ts grab-bags without ownership
- Server secrets under
EXPO_PUBLIC_* / VITE_*
- Root-level
tmp-*, _patch-*, loose JPG (use design/mockups/)
- Second public API for dashboard/partner
Tree export
See REPOSITORY-TREE-CURRENT.md.