Generated API contract and the typed SDK that apps/web uses to talk to apps/backend.
- Product
- Package docs — purpose, public API, contract
| Path | What it is |
|---|---|
src/schemas/ |
openapi.json + api.ts — generated, never edit by hand |
src/sdk/ |
Hand-written wrapper over the generated types (createSdk, createApiClient) |
src/database.types* |
Generated Supabase database types |
src/types.ts |
Shared response shapes (ApiError, PaginatedResponse) |
src/utils/ |
getErrorMessage |
createSdk(supabase, options) attaches the caller's Supabase access token to every request.
It defaults to a relative /api base URL, which only resolves in the browser — server-side
callers (SSR) must pass an absolute baseUrl, see ApiClientOptions.
Both generated layers are produced from apps/backend, not from this package:
pnpm --filter app-backend generate:api-schemas # DTOs → openapi.json → api.ts
pnpm --filter app-backend generate-types # Supabase → database.types.tsSee apps/backend/README.md for the full contract chain.
Commit the regenerated files together with the backend change — otherwise apps/web
typechecks against a stale contract.
pnpm --filter @languages-learner/api lint
pnpm --filter @languages-learner/api typecheck