Architecture
This section covers the technical architecture of DiveSuite: decisions, system design, and database schema.
Overview
Section titled “Overview”DiveSuite follows a layered architecture with clear separation of concerns:
graph TB subgraph "UI Layer" RN[React Native Screens] end
subgraph "State Management" ZS[Zustand Stores] end
subgraph "Service Layer" PS[Planning Service] LS[Logging Service] AS[Analysis Service] AI[AI Service] end
subgraph "Core Layer" DE[Deco Engine<br/>Rust/WASM] DAL[Data Access Layer<br/>Repositories] end
subgraph "Storage" DB[(WatermelonDB<br/>SQLite)] FS[File Storage] end
RN --> ZS ZS --> PS & LS & AS & AI PS --> DE PS & LS & AS --> DAL AI -.->|"advisory only"| PS DAL --> DB LS --> FSKey Decisions
Section titled “Key Decisions”| Decision | Choice | Rationale |
|---|---|---|
| AD-01 | UUID v4 primary keys | Global uniqueness for offline-first sync |
| AD-02 | WatermelonDB | Built-in sync, lazy loading, RN-optimized |
| AD-03 | Rust/WASM deco engine | Type safety, performance, cross-platform |
| AD-04 | Zustand | Lightweight state management, no boilerplate |
| AD-05 | 5-tab navigation | Plan, Log, Community, Stats, Profile |
| AD-06 | i18next | i18n from day one (EN + DE) |
| AD-07 | AI behind interface | Never coupled to UI or deco engine |
| AD-08 | Offline-first | Local DB is source of truth |
| AD-09 | UI library TBD | Evaluate in M0 (Tamagui, Paper, Gluestack) |
| AD-10 | Feature-based folders | Code organized by feature, not layer |
| AD-11 | Opt-in analytics | Privacy-first, GDPR compliant |
Safety Architecture
Section titled “Safety Architecture”Tech Stack Summary
Section titled “Tech Stack Summary”| Layer | Technology |
|---|---|
| Framework | React Native + Expo |
| Language | TypeScript (strict mode) |
| Deco Engine | Rust -> WebAssembly |
| Database | WatermelonDB (SQLite) |
| State | Zustand |
| i18n | i18next |
| Navigation | expo-router |
| Styling | TBD (Tamagui, Paper, or Gluestack) |