The API client
When you build, Archie generates a TypeScript client for your project’s API surface. It includes:- One method per GraphQL query, mutation, and subscription
- One method per REST endpoint
- Type definitions matching your data model
- Error types for each failure mode
lib/api/ (or your stack’s equivalent). Use it from any component:
Authentication tokens
The API client picks up the active session token automatically. When a user signs in, their token is stored (httpOnly cookie by default) and attached to subsequent requests. Sign-out clears the token. Three flows are wired:- Browser session — the user’s auth token, used for browser-side calls
- Server-side — for SSR/RSC, the framework reads the cookie on each request
- External clients — server-to-server callers use API keys instead of session tokens