# `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.
