Files
reader-api/ARCHITECTURE.md
T
virtus c985df7579
Build and Push Reader API Image / docker (push) Successful in 1m3s
chore: update architecture and documentation to reflect removal of MongoDB and transition to NAS storage for chapter content
- Updated `.env.example` to remove MongoDB configuration.
- Revised `ARCHITECTURE.md` to reflect changes in data orchestration and storage strategy.
- Removed `CHAPTER_SAVE_DEBUG.md` and `FIXES_APPLIED.md` as they are no longer relevant.
- Updated `CONTRACT.md` to include new error codes.
- Adjusted endpoint documentation in `CROSS_REPO_ENDPOINT_MATRIX.md` and `README.md` to align with the new import flow.
- Removed legacy import scripts and tables from the codebase.
2026-05-11 15:27:56 +07:00

50 lines
1.8 KiB
Markdown

# Reader Suite Architecture (API Backend)
Tai lieu nay mo ta `reader-api` la backend dung chung cho Web (`reader`) va Android (`reader-app`).
## Vai tro trung tam
- `reader-api` la single source of truth cho:
- API contract
- domain rule
- auth mapping web/mobile
- data orchestration: PostgreSQL + file/NAS chapter storage (khong con MongoDB)
- Moi thay doi contract phai uu tien backward-compatible cho 2 client.
## Domain ownership
- User domain: profile, settings, bookmarks, reading progress, recommendations.
- Content domain: genres, novels, chapter list, chapter content.
- Interaction domain: comments, ratings.
## Data strategy
- PostgreSQL:
- user, novel metadata, genres, comments, ratings, bookmarks, progress, chapter metadata (`ChapterMeta`), refs noi dung (`ChapterContentRef`).
- Chapter body:
- file/NAS (qua `app.storage`) — txt/html theo href trong `ChapterContentRef`.
## Auth and identity
- Web auth: session cookie (NextAuth token va secure variants).
- Mobile auth: JWT tu `/api/auth/mobile-login`.
- Backend map ca 2 co che vao cung identity va permission model.
## API compatibility policy
- Khong xoa field dang duoc client dung khi chua co migration plan.
- Them field moi theo huong optional tru khi co versioning.
- Error response phai on dinh theo format chung (code, message, details).
- Versioning uu tien uri prefix hoac contract evolution, tranh breaking ngay.
## Definition of Done (API)
- Endpoint moi co docs request/response + auth requirement.
- Da verify voi web + mobile happy path va auth edge cases.
- Healthcheck va monitoring khong bi anh huong.
- Docker/local dev van chay voi huong dan README.
## Import (MOD)
Chi con endpoint import preview `POST /api/import/uploads/preview` va nhom `/api/mod/epub*`. Cac endpoint SourceAsset/job legacy da go khoi service.