ce9a01793f2461a0f74c31568448ccfca719620d
Move every handler from /api/* to /api/v1/*. /api/* is now reserved for
future versioning.
Standardise the error response shape across the API as
{"error": {"code": "snake_case", "message": "..."}}. AppError gains a
`code()` whose top-level variants are matched exhaustively without a
wildcard — new variants are a compile error until coded. 500-class
responses always emit the fixed "internal error" string and log the
real cause via tracing only.
Lock in the list pagination envelope as {"items": [...], "page": {
"limit", "offset", "total"}} and apply it to GET /api/v1/mangas. `total`
serialises as null until feat/list-search-polish lands an indexed count.
The frontend client parses the envelope into ApiError.code with an
http_error fallback for non-JSON bodies. listMangas now returns the
paged shape; the root route consumes .items. New client.test.ts covers
envelope parsing and the fallback paths.
Lockstep version bump to 0.2.0.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mangalord
A self-hosted manga and comics reader. Browse, search, read, bookmark, and upload manga and chapters. The HTTP API is consumed by both the SvelteKit web UI and external bots/scripts that perform the same actions programmatically.
Stack
- Backend: Rust, axum, sqlx
- Database: Postgres 16
- Frontend: SvelteKit 2 (Svelte 5 runes), TypeScript, Vite
- File storage: pluggable
Storagetrait — local FS today, S3 (and friends) as future impls - Deploy: Docker Compose on a single server
Quick start
cp .env.example .env
docker compose up --build
- Frontend: http://localhost:3000
- API: http://localhost:8080/api
- API health: http://localhost:8080/api/health
Local development
Run only Postgres in Docker; run backend and frontend natively for fast iteration:
docker compose -f docker-compose.dev.yml up -d
# backend
cd backend
export DATABASE_URL=postgres://mangalord:mangalord@localhost:5432/mangalord
cargo run
# frontend (separate shell)
cd frontend
npm install
npm run dev
The Vite dev server proxies /api to http://localhost:8080.
Tests
This project is developed test-first. Tests live at three levels:
# Backend: unit (in-module) + integration (tests/, per-test DB via #[sqlx::test])
cd backend && cargo test
# Frontend: unit / module tests (Vitest)
cd frontend && npm test
# Frontend: end-to-end (Playwright; spins up dev server, mocks API by default)
cd frontend && npm run test:e2e
API surface
| Method | Path | Purpose |
|---|---|---|
| GET | /api/health |
Liveness |
| GET | /api/mangas |
List / search mangas |
| POST | /api/mangas |
Create a manga |
| GET | /api/mangas/{id} |
Get a manga |
| GET | /api/files/{key} |
Stream a blob (cover, chapter page) |
Chapters, uploads, and bookmarks are next — the patterns to extend are documented in CLAUDE.md.
Description
Languages
Rust
59.1%
Svelte
21.9%
TypeScript
18.1%
CSS
0.6%
Dockerfile
0.2%
Other
0.1%