Architecture Overview¶
Prolexio follows a layered architecture with strict dependency direction: each crate depends only on crates below it.
Crate Dependency Diagram¶
graph TD
API[api<br/><small>Axum HTTP handlers</small>]
INFRA[infra<br/><small>PostgreSQL, email, export</small>]
DOMAIN[domain<br/><small>Business logic, traits</small>]
SHARED[shared<br/><small>Common types, DTOs</small>]
API --> INFRA
API --> DOMAIN
API --> SHARED
INFRA --> DOMAIN
INFRA --> SHARED
DOMAIN --> SHARED
Frontend Architecture¶
graph TD
ROUTES[SvelteKit Routes<br/><small>+page.svelte, +layout.svelte</small>]
COMPONENTS[Svelte Components<br/><small>lib/components/</small>]
API_CLIENT[API Clients<br/><small>lib/api/*.ts</small>]
STORES[Stores<br/><small>lib/stores/*.ts</small>]
TAURI[Tauri Commands<br/><small>src-tauri/src/commands.rs</small>]
ROUTES --> COMPONENTS
ROUTES --> STORES
COMPONENTS --> API_CLIENT
COMPONENTS --> STORES
API_CLIENT -->|HTTP| BACKEND[Backend API]
TAURI -->|IPC| ROUTES
Key Design Principles¶
- Trait-based dependency injection — Domain defines repository traits, infra implements them.
Arc<dyn Trait>in AppState. - Optimistic locking — Every mutable table has
version INTEGER. Updates useWHERE version = $N. - UUID v7 — All IDs are time-ordered UUIDs (
Uuid::now_v7()), never v4. - Office-scoped data — Most entities belong to an office via
office_idforeign key. - Dual validation — Every field validated both frontend (TypeScript) and backend (Rust).
Module Map¶
| Area | Backend | Frontend |
|---|---|---|
| Cases | api/handlers/cases.rs |
routes/dossiers/ |
| Participants | api/handlers/participants.rs |
routes/participants/ |
| Deeds | api/handlers/deeds.rs |
routes/dossiers/[id]/actes/ |
| Templates | api/handlers/templates.rs |
routes/templates/ |
| Documents | api/handlers/documents.rs |
routes/dossiers/[id]/documents/ |
| Settings | api/handlers/offices.rs |
routes/parametres/ |
| Auth | api/handlers/auth.rs |
routes/(auth)/ |
Further Reading¶
- Crates — Detailed crate descriptions
- Request Flow — End-to-end request lifecycle
- Database — Schema overview and conventions