# z4phxr/riviomobile architecture

> Architecture diagram of the GitHub repository z4phxr/riviomobile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/z4phxr/riviomobile
- Repository: https://github.com/z4phxr/riviomobile

## Overview

Rivio Mobile is a Flutter client for tracking habits, sleep, and mood, with account and security settings. Users enter through the app, authenticate or open a tracking area, then record or review entries synchronized with the Rivio backend. The tree shows separate feature layers and shared networking, storage, and presentation code; the README documents JWT refresh, themes, connectivity handling, and visualizations. Dart implementation excerpts were not provided, so the feature-to-network wiring is represented only at a high level.

Main entry points: [`lib/core/network/api_client.dart`](https://github.com/z4phxr/riviomobile/blob/main/lib/core/network/api_client.dart) (API client), [`lib/main.dart`](https://github.com/z4phxr/riviomobile/blob/main/lib/main.dart) (Flutter app), [`lib/features/settings/presentation/screens`](https://github.com/z4phxr/riviomobile/tree/main/lib/features/settings/presentation/screens) (Account settings), [`lib/features/habits`](https://github.com/z4phxr/riviomobile/tree/main/lib/features/habits) (Habit tracking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["Flutter app<br/>[main.dart]"]
end

subgraph group_account["Account and security"]
  node_auth["Authentication"]
  node_account_settings["Account settings"]
  node_pin["PIN security"]
end

subgraph group_tracking["Wellbeing tracking"]
  node_habit["Habit tracking"]
  node_mood["Mood tracking"]
  node_sleep["Sleep tracking"]
  node_visualization["Entry visualization"]
end

subgraph group_shared["Shared services"]
  node_api_client["API client<br/>[api_client.dart]"]
  node_auth_interceptors["Auth interceptors"]
  node_secure_storage["Secure storage"]
  node_connectivity["Connectivity handling"]
  node_error_handling["Error handling<br/>[error_handler.dart]"]
  node_theme["Theme preferences"]
end

node_user(("User"))
node_api{{"Rivio REST API"}}

node_user -->|"uses"| node_app
node_app -->|"opens"| node_auth
node_app -->|"opens"| node_habit
node_app -->|"opens"| node_mood
node_app -->|"opens"| node_sleep
node_app -->|"opens"| node_account_settings
node_auth -->|"API access"| node_api_client
node_habit -->|"API access"| node_api_client
node_mood -->|"API access"| node_api_client
node_sleep -->|"API access"| node_api_client
node_api_client -->|"sends requests"| node_api
node_api -->|"returns data"| node_api_client
node_api_client -->|"uses"| node_auth_interceptors
node_auth_interceptors -->|"reads tokens"| node_secure_storage
node_auth_interceptors -->|"refreshes token"| node_api
node_pin -->|"stores PIN"| node_secure_storage
node_account_settings -->|"manages lock"| node_pin
node_account_settings -->|"selects theme"| node_theme
node_api_client -->|"checks connection"| node_connectivity
node_api_client -->|"handles errors"| node_error_handling
node_habit -->|"shows entries"| node_visualization

click node_app "https://github.com/z4phxr/riviomobile/blob/main/lib/main.dart"
click node_auth "https://github.com/z4phxr/riviomobile/tree/main/lib/features/auth"
click node_account_settings "https://github.com/z4phxr/riviomobile/tree/main/lib/features/settings/presentation/screens"
click node_pin "https://github.com/z4phxr/riviomobile/blob/main/lib/core/providers/pin_lock_provider.dart"
click node_habit "https://github.com/z4phxr/riviomobile/tree/main/lib/features/habits"
click node_mood "https://github.com/z4phxr/riviomobile/tree/main/lib/features/mood"
click node_sleep "https://github.com/z4phxr/riviomobile/tree/main/lib/features/sleep"
click node_visualization "https://github.com/z4phxr/riviomobile/tree/main/lib/features/habits/presentation/screens"
click node_api_client "https://github.com/z4phxr/riviomobile/blob/main/lib/core/network/api_client.dart"
click node_auth_interceptors "https://github.com/z4phxr/riviomobile/tree/main/lib/core/network/interceptors"
click node_secure_storage "https://github.com/z4phxr/riviomobile/blob/main/lib/core/storage/secure_storage_service.dart"
click node_connectivity "https://github.com/z4phxr/riviomobile/blob/main/lib/core/network/connectivity_check_service.dart"
click node_error_handling "https://github.com/z4phxr/riviomobile/blob/main/lib/core/errors/error_handler.dart"
click node_theme "https://github.com/z4phxr/riviomobile/blob/main/lib/core/providers/theme_provider.dart"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_user toneBlue
class node_auth,node_account_settings,node_pin toneAmber
class node_habit,node_mood,node_sleep,node_visualization,node_api toneMint
class node_api_client,node_auth_interceptors,node_secure_storage,node_connectivity,node_error_handling,node_theme toneRose
```

## Components

### App experience

- [Flutter app](https://github.com/z4phxr/riviomobile/blob/main/lib/main.dart): `lib/main.dart`

### Account and security

- [Authentication](https://github.com/z4phxr/riviomobile/tree/main/lib/features/auth): `lib/features/auth`
- [Account settings](https://github.com/z4phxr/riviomobile/tree/main/lib/features/settings/presentation/screens): `lib/features/settings/presentation/screens`
- [PIN security](https://github.com/z4phxr/riviomobile/blob/main/lib/core/providers/pin_lock_provider.dart): `lib/core/providers/pin_lock_provider.dart`

### Wellbeing tracking

- [Habit tracking](https://github.com/z4phxr/riviomobile/tree/main/lib/features/habits): `lib/features/habits`
- [Mood tracking](https://github.com/z4phxr/riviomobile/tree/main/lib/features/mood): `lib/features/mood`
- [Sleep tracking](https://github.com/z4phxr/riviomobile/tree/main/lib/features/sleep): `lib/features/sleep`
- [Entry visualization](https://github.com/z4phxr/riviomobile/tree/main/lib/features/habits/presentation/screens): `lib/features/habits/presentation/screens`

### Shared services

- [API client](https://github.com/z4phxr/riviomobile/blob/main/lib/core/network/api_client.dart): `lib/core/network/api_client.dart`
- [Auth interceptors](https://github.com/z4phxr/riviomobile/tree/main/lib/core/network/interceptors): `lib/core/network/interceptors`
- [Secure storage](https://github.com/z4phxr/riviomobile/blob/main/lib/core/storage/secure_storage_service.dart): `lib/core/storage/secure_storage_service.dart`
- [Connectivity handling](https://github.com/z4phxr/riviomobile/blob/main/lib/core/network/connectivity_check_service.dart): `lib/core/network/connectivity_check_service.dart`
- [Error handling](https://github.com/z4phxr/riviomobile/blob/main/lib/core/errors/error_handler.dart): `lib/core/errors/error_handler.dart`
- [Theme preferences](https://github.com/z4phxr/riviomobile/blob/main/lib/core/providers/theme_provider.dart): `lib/core/providers/theme_provider.dart`

### Other components

- **User**
- **Rivio REST API**

## Connections

- User → Flutter app: uses
- Flutter app → Authentication: opens
- Flutter app → Habit tracking: opens
- Flutter app → Mood tracking: opens
- Flutter app → Sleep tracking: opens
- Flutter app → Account settings: opens
- Authentication → API client: API access
- Habit tracking → API client: API access
- Mood tracking → API client: API access
- Sleep tracking → API client: API access
- API client → Rivio REST API: sends requests
- Rivio REST API → API client: returns data
- API client → Auth interceptors: uses
- Auth interceptors → Secure storage: reads tokens
- Auth interceptors → Rivio REST API: refreshes token
- PIN security → Secure storage: stores PIN
- Account settings → PIN security: manages lock
- Account settings → Theme preferences: selects theme
- API client → Connectivity handling: checks connection
- API client → Error handling: handles errors
- Habit tracking → Entry visualization: shows entries
