# greenbird122/repair-ai architecture

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

- Interactive diagram: https://gitdiagram.com/greenbird122/repair-ai
- Repository: https://github.com/greenbird122/repair-ai

## Overview

RepairAI is an Android maternal-health companion. Its implemented user-to-result path covers account access: the app enters through Flutter, routes users through guarded screens, and provides sign-in, registration, and password-change UI backed by an auth/network layer. Location lookups are also represented in the project layout. Pregnancy progress, visits, and CHP follow-up are product goals, but the README says most pages remain planned; unsampled implementation details and calls are therefore not inferred.

Main entry points: [`lib/core/routes.dart`](https://github.com/greenbird122/repair-ai/blob/main/lib/core/routes.dart) (Routes and guard), [`lib/features/network/data/api_client.dart`](https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/api_client.dart) (API client), [`lib/main.dart`](https://github.com/greenbird122/repair-ai/blob/main/lib/main.dart) (Flutter app entry), [`lib/features/auth/logic/session_controller.dart`](https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/logic/session_controller.dart) (Session lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_flutter_app["Flutter app entry<br/>[main.dart]"]
  node_router["Routes and guard<br/>[routes.dart]"]
  node_splash["Splash gate<br/>[splash_gate.dart]"]
  node_login["Login screen<br/>[login_page.dart]"]
  node_register["Registration screen<br/>[register_page.dart]"]
  node_password["Password screen"]
  node_home["Home screen<br/>[home_page.dart]"]
end

subgraph group_auth["Account and session"]
  node_session["Session lifecycle"]
  node_auth_api["Auth API<br/>[auth_api.dart]"]
  node_token_store[("Secure token store")]
end

subgraph group_network["Network services"]
  node_api_client["API client<br/>[api_client.dart]"]
  node_authenticator["JWT refresh"]
  node_health["Health check<br/>[health_check.dart]"]
  node_health_state["Health state"]
end

subgraph group_locations["Location lookup"]
  node_location_api["Location lookups<br/>[location_api.dart]"]
  node_location_state["Location providers"]
end

node_user(("Android user"))
node_backend["RepairAI backend"]

node_user -->|"uses"| node_flutter_app
node_flutter_app -->|"registers routes"| node_router
node_router -->|"routes to"| node_splash
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_register
node_router -->|"routes to"| node_password
node_router -->|"routes to"| node_home
node_router -->|"guards with"| node_session
node_auth_api -.->|"uses network core"| node_api_client
node_api_client -->|"sends API requests"| node_backend
node_api_client -->|"supports silent refresh"| node_authenticator
node_session -.->|"uses secure storage"| node_token_store
node_health_state -.->|"checks backend"| node_health
node_location_state -.->|"provides lookup state"| node_location_api

click node_flutter_app "https://github.com/greenbird122/repair-ai/blob/main/lib/main.dart"
click node_router "https://github.com/greenbird122/repair-ai/blob/main/lib/core/routes.dart"
click node_splash "https://github.com/greenbird122/repair-ai/blob/main/lib/pages/splash_gate.dart"
click node_login "https://github.com/greenbird122/repair-ai/blob/main/lib/pages/login_page.dart"
click node_register "https://github.com/greenbird122/repair-ai/blob/main/lib/pages/register_page.dart"
click node_password "https://github.com/greenbird122/repair-ai/blob/main/lib/pages/change_password_page.dart"
click node_home "https://github.com/greenbird122/repair-ai/blob/main/lib/pages/home_page.dart"
click node_session "https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/logic/session_controller.dart"
click node_auth_api "https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/data/auth_api.dart"
click node_token_store "https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/data/secure_token_storage.dart"
click node_api_client "https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/api_client.dart"
click node_authenticator "https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/auth_authenticator.dart"
click node_health "https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/health_check.dart"
click node_health_state "https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/logic/health_controller.dart"
click node_location_api "https://github.com/greenbird122/repair-ai/blob/main/lib/features/locations/data/location_api.dart"
click node_location_state "https://github.com/greenbird122/repair-ai/blob/main/lib/features/locations/logic/location_providers.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_flutter_app,node_router,node_splash,node_login,node_register,node_password,node_home,node_user toneBlue
class node_session,node_auth_api,node_token_store toneAmber
class node_api_client,node_authenticator,node_health,node_health_state toneMint
class node_location_api,node_location_state toneRose
class node_backend toneIndigo
```

## Components

### App and navigation

- [Flutter app entry](https://github.com/greenbird122/repair-ai/blob/main/lib/main.dart): `lib/main.dart`
- [Routes and guard](https://github.com/greenbird122/repair-ai/blob/main/lib/core/routes.dart): `lib/core/routes.dart`
- [Splash gate](https://github.com/greenbird122/repair-ai/blob/main/lib/pages/splash_gate.dart): `lib/pages/splash_gate.dart`
- [Login screen](https://github.com/greenbird122/repair-ai/blob/main/lib/pages/login_page.dart): `lib/pages/login_page.dart`
- [Registration screen](https://github.com/greenbird122/repair-ai/blob/main/lib/pages/register_page.dart): `lib/pages/register_page.dart`
- [Password screen](https://github.com/greenbird122/repair-ai/blob/main/lib/pages/change_password_page.dart): `lib/pages/change_password_page.dart`
- [Home screen](https://github.com/greenbird122/repair-ai/blob/main/lib/pages/home_page.dart): `lib/pages/home_page.dart`

### Account and session

- [Session lifecycle](https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/logic/session_controller.dart): `lib/features/auth/logic/session_controller.dart`
- [Auth API](https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/data/auth_api.dart): `lib/features/auth/data/auth_api.dart`
- [Secure token store](https://github.com/greenbird122/repair-ai/blob/main/lib/features/auth/data/secure_token_storage.dart): `lib/features/auth/data/secure_token_storage.dart`

### Network services

- [API client](https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/api_client.dart): `lib/features/network/data/api_client.dart`
- [JWT refresh](https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/auth_authenticator.dart): `lib/features/network/data/auth_authenticator.dart`
- [Health check](https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/data/health_check.dart): `lib/features/network/data/health_check.dart`
- [Health state](https://github.com/greenbird122/repair-ai/blob/main/lib/features/network/logic/health_controller.dart): `lib/features/network/logic/health_controller.dart`

### Location lookup

- [Location lookups](https://github.com/greenbird122/repair-ai/blob/main/lib/features/locations/data/location_api.dart): `lib/features/locations/data/location_api.dart`
- [Location providers](https://github.com/greenbird122/repair-ai/blob/main/lib/features/locations/logic/location_providers.dart): `lib/features/locations/logic/location_providers.dart`

### Other components

- **Android user**
- **RepairAI backend**

## Connections

- Android user → Flutter app entry: uses (evidence: `README.md`)
- Flutter app entry → Routes and guard: registers routes (evidence: `README.md`)
- Routes and guard → Splash gate: routes to (evidence: `README.md`)
- Routes and guard → Login screen: routes to (evidence: `README.md`)
- Routes and guard → Registration screen: routes to (evidence: `README.md`)
- Routes and guard → Password screen: routes to (evidence: `README.md`)
- Routes and guard → Home screen: routes to (evidence: `README.md`)
- Routes and guard → Session lifecycle: guards with (evidence: `README.md`)
- Auth API → API client: uses network core
- API client → RepairAI backend: sends API requests (evidence: `README.md`)
- API client → JWT refresh: supports silent refresh (evidence: `README.md`)
- Session lifecycle → Secure token store: uses secure storage
- Health state → Health check: checks backend
- Location providers → Location lookups: provides lookup state
