mirror of
https://github.com/RaisFast/raisfast.git
synced 2026-09-23 16:02:25 +00:00
1.9 KiB
1.9 KiB
AGENTS.md
Project
Blog system built with Rust + Axum + SQLite. Early stage — scaffold only, no implementation yet.
- Crate name:
raisfast - Rust edition: 2024
- Product & architecture spec:
docs/guide.md
Commands
cargo build # compile
cargo test # run tests
cargo fmt --check # format check
cargo clippy -- -D warnings # lint (zero warnings required)
Planned (once sqlx is wired):
cargo sqlx migrate run # run DB migrations
cargo sqlx prepare # update sqlx-data.json for offline compile
Architecture (target)
As described in docs/guide.md:
- src/main.rs — server entrypoint
- src/handlers/ — axum route handlers (thin: extract params, call service, return response)
- src/services/ — business logic layer
- src/models/ — data structures and DB queries (sqlx)
- src/middleware/ — JWT auth, rate limiting
- src/errors/ — unified
AppError(thiserror) implementingIntoResponse - src/config/ — env/config loading
- migrations/ — sqlx SQL migration files
Key Constraints
unsafeis banned. Use#![deny(unsafe_code)]at crate root.- No
unwrap()/expect()in non-test code. Use?or explicit error handling. - Error handling pattern:
thiserrorforAppErrorenum at handler boundaries;anyhowfor internal service error propagation. - Database: SQLite (via sqlx with compile-time query checking). All timestamps stored as TEXT in ISO 8601.
- Primary keys: UUID v7 (time-sortable).
- Auth: JWT (HS256) with short-lived access tokens + DB-stored refresh tokens.
Style
cargo fmtandcargo clippyare authoritative — no custom rustfmt/clippy config.- Public items require
///doc comments. - Handler → Service → Model layering enforced; handlers must not contain business logic.