Overview of the LRCLIB API Server Architecture
mainLRCLIB is a Rust-based workspace for an API server. The architecture is organized as follows:
- Root crate: A thin CLI wrapper (
src/main.rs) that parses arguments like--port,--database, and--workers-count. - Main app (
server/crate): Contains the core logic, including app bootstrap,AppState, Axum router, middleware, and background tasks. - Storage: Uses SQLite via
rusqliteandr2d2for connection pooling. - HTTP Framework: Built on
Axum.
Workspace Structure
server/src/routes/: HTTP handlers.server/src/repositories/: SQL access layer.server/src/entities/: Database and domain structs.server/src/utils.ts: Input normalization and verification helpers.server/migrations/: Embedded SQLite schema and migrations applied at startup.