Skip to content

Latest commit

 

History

History
173 lines (131 loc) · 5.39 KB

File metadata and controls

173 lines (131 loc) · 5.39 KB

API Routes

70 routes over 59 paths, registered by 17 modules under server/routes/. The embedded Fastify server serves all of them on 127.0.0.1, on port 3147 when run standalone with pnpm dev:server and on a free port chosen at launch under Electron.

Routes are grouped by the module that registers them. The HEAD route Fastify pairs with each GET is omitted. Request and response shapes live in shared/contracts.ts and shared/responses.ts, and the streaming routes emit the SSE unions in shared/events.ts.

Why a generated table and not OpenAPI

This file is generated from the live route registry and gated in CI. The code is the single source of truth, so this table cannot describe an endpoint the server does not serve.

OpenAPI would not add anything here today.

  • A spec needs JSON Schema attached to all 70 routes, and this server carries none. Validation goes through Zod in server/http/parse.ts, not Fastify's ajv schema.body, because ajv changes the 400 body the client handles and drops the Zod defaults the domain relies on.
  • There is no external consumer to hand a spec to. The only client ships in this repo and imports the same Zod schemas and contract types from shared/, which is a tighter contract than generated client code.

Revisit when a second client or an outside consumer appears. The same buildServer registry walk plus zod-to-json-schema over the existing contracts can emit a real specification under this same drift gate.

server/index.ts

Method Path
GET /api/health

server/routes/assessment.ts

Method Path
POST /api/books/:id/chapters/:num/feedback
GET /api/books/:id/chapters/:num/quiz
POST /api/books/:id/final-quiz

server/routes/audiobook-generation.ts

Method Path
GET /api/books/:id/audiobook
POST /api/books/:id/audiobook
GET /api/books/:id/audiobook/file
POST /api/books/:id/audiobook/reveal
GET /api/books/:id/chapters/:num/audio
GET /api/books/:id/chapters/:num/audio/status

server/routes/audiobook.ts

Method Path
POST /api/audiobook/install
GET /api/audiobook/status
GET /api/audiobook/voices
GET /api/audiobook/voices/:voiceId/preview

server/routes/authoring.ts

Method Path
GET /api/books/:id/brief
PUT /api/books/:id/brief
PUT /api/books/:id/chapters/:num/content
GET /api/books/:id/feedback
PATCH /api/books/:id/meta
PUT /api/books/:id/quiz/:num
GET /api/books/:id/references
GET /api/books/:id/references/:name
PUT /api/books/:id/references/:name
GET /api/books/:id/summaries
PUT /api/books/:id/summaries/:num
PUT /api/books/:id/toc
POST /api/books/create-skeleton

server/routes/chat.ts

Method Path
POST /api/chat

server/routes/covers.ts

Method Path
DELETE /api/books/:id/cover
GET /api/books/:id/cover
POST /api/books/:id/cover/generate
POST /api/books/:id/cover/suggest-prompt
POST /api/books/:id/cover/upload

server/routes/epub.ts

Method Path
GET /api/books/:id/export-epub
POST /api/books/:id/export-epub

server/routes/generation.ts

Method Path
POST /api/books
POST /api/books/:id/chapters/:num/regenerate
POST /api/books/:id/generate-all
POST /api/books/:id/generate-next
GET /api/books/:id/generation-status
GET /api/books/:id/generation-stream
POST /api/books/:id/start
POST /api/books/:id/toc/revise

server/routes/import.ts

Method Path
POST /api/books/import/confirm
POST /api/books/import/preview

server/routes/library.ts

Method Path
GET /api/books
DELETE /api/books/:id
GET /api/books/:id
PATCH /api/books/:id
PUT /api/books/:id/rating
POST /api/books/:id/reset
GET /api/books/:id/toc
GET /api/books/search
GET /api/progress/skills

server/routes/models.ts

Method Path
GET /api/providers/:provider/models

server/routes/profile.ts

Method Path
GET /api/profile
PUT /api/profile
POST /api/profile/interview
POST /api/profile/suggest-skills

server/routes/reading.ts

Method Path
GET /api/books/:id/chapters/:num
PUT /api/books/:id/progress/:num

server/routes/settings.ts

Method Path
DELETE /api/settings/api-key
POST /api/settings/api-key
GET /api/settings/api-key-status

server/routes/suggestions.ts

Method Path
POST /api/books/:id/profile-suggestions
POST /api/books/suggest
POST /api/books/suggest-details

server/routes/tasks.ts

Method Path
GET /api/tasks
DELETE /api/tasks/:taskId
GET /api/tasks/stream