TorbatYar/frontend/shared/api/README.md
Mortezakoohjani 6f4a484051 Migrate Beauty, Healthcare, and Accounting frontend to modular src/modules architecture.
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>
2026-07-26 22:28:27 +03:30

851 B

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.