Torii is a Rust project that enables users to easily add authentication to their application.
- Build:
make buildorcargo build --all-features - Format:
make fmtorcargo fmt --all - Lint:
make lintorcargo clippy --all-features -- -D warnings - Run all tests:
make testorcargo nextest run --no-fail-fast --all-features - Run single test:
cargo nextest run test_nameorcargo test -- test_name - Run with coverage:
make coverageorcargo llvm-cov nextest --all-features - Full check:
make check(runs fmt, lint, test) - Documentation:
make docsorcargo doc --all-features --no-deps --open - Always use
make testto run project tests
- Error Handling: Use
thiserrorwith structured error types and#[from]for conversions - Naming: PascalCase for types, snake_case for functions/variables, SCREAMING_SNAKE_CASE for constants
- Types: Use newtype pattern for type safety (e.g.,
UserId,SessionToken) - Imports: Group by category (std lib first, external crates, then internal modules)
- Traits: Use
async_traitfor async interfaces; design with composition in mind - Documentation: Add doc comments to public interfaces and modules
- Testing: Write unit tests in modules with
#[cfg(test)]; use#[tokio::test]for async tests - Builder Pattern: Use for complex struct creation with validation at build time
- Always use
make fmtto format rust code - Always use
make lintto lint rust code
- Core functionality in
torii-corecrate - Storage backends in separate crates (
torii-storage-*)