33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
## Architecture
|
||
- Allways follow feature-based structuring
|
||
- Feature-based tree structure—group by domain, not by type
|
||
- Each feature is self-contained: handler, logic, types, tests
|
||
- Functional programming style
|
||
- Use structs, traits, enums, `impl`, `match` over `if`
|
||
- Avoid shared mutable state—decouple with enums
|
||
- Keep it simple: small, decoupled, easy-to-read blocks
|
||
- Don't invent new states/booleans—reuse existing features
|
||
- Forbidden to use Arc, Mutex, RefCell and others
|
||
|
||
## File Structure
|
||
- `mod.rs` is for routing only, no logic
|
||
- Tests live in `tests/` dir equivalent to src/
|
||
- If a feature exceeds 5–10 files, reconsider the design
|
||
- Nest features logically: `auth/`, `auth/login/`, `auth/register/`
|
||
|
||
## Error Handling
|
||
- Use `Result<T, E>` everywhere—no `.unwrap()` in production code(tests can use unwraps)
|
||
- Custom error enums per feature, map to a shared app error at boundaries
|
||
|
||
## Naming
|
||
- Clear, descriptive names—no abbreviations
|
||
- Types are nouns, functions are verbs
|
||
- Top of the file should always contain // path_from_the_root
|
||
|
||
## Dependencies
|
||
- Always use the latest stable versions
|
||
- No legacy or deprecated versions for compatibility
|
||
|
||
## Komp_ac
|
||
Komp_ac_client is a codebase out of the app, we are getting inspired from. We only copy code out of it. Its already in gitignore
|