Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|---|---|---|
| .. | ||
| README.md | ||
shared/api/
Purpose
Shared HTTP client infrastructure: auth token refresh, error types, BFF base URLs, request helpers.
Legacy source (not moved)
lib/auth.ts— token storage, refresh, Keycloak integration- Duplicated fetch wrapper in:
lib/api.ts(platform)lib/accounting-api.tslib/beauty-business-api.tslib/healthcare-api.ts
Planned contents (Phase 3)
createApiClient({ baseUrl, serviceName })— single fetch factoryApiErrorbase class- Header injection (
authorization,x-tenant-id) - SSR vs browser base URL resolution (BFF vs direct)
Module API clients
Domain method surfaces stay in lib/*-api.ts until Phase 3 split; they will move to modules/{id}/api/ or lib/api/{id}/.
Status
📁 Scaffold only — no API code migrated in Phase 1.