Docs/API Connect
API Connect
Replace the mock data with your own API one module at a time. Each module has one provider that every screen goes through.
Where data enters
| Module | Seed data | Call your API in |
|---|---|---|
| Customers | lib/data/customers.ts | CustomersProvider |
| Contracts | lib/data/records.ts | ContractsProvider |
| Messages, notes, tasks | lib/data/comms.ts | CommsProvider |
| Workflows | lib/data/workflows.ts | WorkflowsProvider |
| Settings | lib/data/admin.ts | AdminProvider |
| Sign-in | lib/auth.ts | signIn, sendCode, createAccount |
Example: customers
Load records in the route's Server Component and pass them to the provider, then send edits from the provider's actions:
Agent replies
Agents answer from createAssistantReply() in src/lib/chat.ts. Point it at a Route Handler that streams from your model provider, and the chat UI, tools and attachments keep working.
Keep API keys on the server. Call your model from a Route Handler, never from the browser.