adding user authentication

This commit is contained in:
DioCrafts
2025-03-20 09:22:31 +01:00
parent 961545aef7
commit cafad0fbfd
69 changed files with 6483 additions and 106 deletions
+11 -9
View File
@@ -28,19 +28,21 @@ RUST_BACKTRACE=1 cargo run # Run with full backtrace for better error diagnosti
## Code Style Guidelines
- **Architecture**: Follow Clean Architecture with clear layer separation (domain → application → infrastructure → interfaces)
- **Naming**: Use `snake_case` for files, modules, functions, variables; `PascalCase` for types/structs/enums
- **Naming**: Use `snake_case` for files, modules, functions, variables; `PascalCase` for types/structs/enums; getters without `get_` prefix
- **Modules**: Use mod.rs files for explicit exports with visibility modifiers (pub, pub(crate))
- **Error Handling**: Use Result<T, E> with thiserror for custom error types; propagate errors with ? operator
- **Comments**: Document public APIs with /// doc comments, explain "why" not "what"
- **Error Handling**: Use Result<T, E> with thiserror for custom error types; propagate errors with ? operator; include context in error messages
- **Documentation**: Document public APIs with /// doc comments, explain "why" not "what"; both English and Spanish comments are acceptable
- **Imports**: Group imports: 1) std, 2) external crates, 3) internal modules (with blank lines between)
- **Async**: Use async-trait for repository interfaces; handle futures with .await and tokio runtime
- **Testing**: Write unit tests in the same file as implementation (bottom of file, in a tests module)
- **Dependencies**: Use axum for web API, tower-http for middleware, serde for serialization
- **Logging**: Use tracing with appropriate levels (debug, info, warn, error) and structured contexts
- **Repository Pattern**: Define interfaces in domain layer, implement in infrastructure layer
- **Async**: Use async-trait for repository interfaces; handle futures with .await and tokio runtime; implement timeouts for I/O operations
- **Testing**: Write unit tests in the same file as implementation (bottom of file, in a tests module with #[cfg(test)])
- **Dependencies**: Use axum for web API, tower-http for middleware, serde for serialization; share dependencies with Arc
- **Logging**: Use tracing with appropriate levels (debug, info, warn, error) and structured contexts for detailed diagnostics
- **Repository Pattern**: Define interfaces in domain layer, implement in infrastructure layer; use traits with dynamic dispatch (Box<dyn Trait>)
- **I18n**: Store translations in JSON files under static/locales/, use i18n service for text lookups
- **Type Safety**: Prefer strong typing with domain-specific types over primitive types
- **Type Safety**: Prefer strong typing with domain-specific types over primitive types; validate at construction time
- **Error Messages**: Provide clear, actionable error messages that help diagnose the issue
- **Immutability**: Prefer immutable data structures; use with_* methods to return modified copies rather than mutating in place
- **Performance**: Implement caching with proper invalidation; use parallel processing for large file operations; optimize based on file sizes
## Project Structure
OxiCloud is a NextCloud-like file storage system built in Rust with a focus on performance and security. It provides a clean REST API and web interface for file management using a layered architecture approach: