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>
30 lines
851 B
Markdown
30 lines
851 B
Markdown
# `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.ts`
|
|
- `lib/beauty-business-api.ts`
|
|
- `lib/healthcare-api.ts`
|
|
|
|
## Planned contents (Phase 3)
|
|
|
|
- `createApiClient({ baseUrl, serviceName })` — single fetch factory
|
|
- `ApiError` base 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.
|