Architecture
Rendered from docs/architecture.md
Generated on every docs build. Edit the source in docs/, not here.
Wicket is one Fastify API with an in-memory queue, a SQLite file for records and accounts, and a React page. It asks one model, on Ollama Cloud; there is no model on the box.
A call's path
- An app posts messages to
/v1/jobswith its bearer token. The token names the app. - The call joins the queue with the next ticket. The app gets
202with its ticket, now serving and its place in line. - The queue runs one call at a time, in ticket order, on Ollama Cloud with a
timeout. A cloud failure ends the call
failedwith the reason, and the next ticket starts. - When the call ends (done, failed or cancelled), a record is written with counts and timings only, and the answer waits in memory for 10 minutes.
- The app long-polls
GET /v1/jobs/:id?wait=25and gets the answer,{ text, model }, or the failure's reason. - The signed-in page polls
/v1/queueand can force close the running call or clear the waiting ones; their apps seecancelled.
The parts
| Part | Where | Notes |
|---|---|---|
| API contract | shared/src/api.ts | zod schemas used by the server and the page |
| Queue | server/src/queue.ts | FIFO, one at a time, tickets, long-polling |
| Cloud call | server/src/providers.ts | Ollama Cloud only; a failure fails the job, a cancel aborts the request |
| Routes and guards | server/src/app.ts | app tokens for jobs, sessions for the page's routes |
| Records | server/src/records.ts | SQLite, no text |
| Page | web/src/QueuePage.tsx | now serving, running, waiting, records |
| Container | infrastructure/ | wicket-api, one container |
Deeper
- corpus/wiki/architecture.md: the full picture, settings and how it runs.
- corpus/wiki/decisions.md: why it is built this way.
- corpus/wiki/api.md: the contract callers code against.