# drakejcz6/ocpi_citas_app architecture

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

- Interactive diagram: https://gitdiagram.com/drakejcz6/ocpi_citas_app
- Repository: https://github.com/drakejcz6/ocpi_citas_app

## Overview

OCPI Citas is a Flutter app for booking appointments at the Cuban Industrial Property Office. The user enters through the app shell, browses services and cached availability, then books or manages appointments online; appointment status is server-owned. Pull sync refreshes local service and appointment data on startup, reconnect, or explicit refresh—not periodically. The README documents local profile storage and local reminders as additional capabilities. The supplied source excerpts cover only platform scaffolding, so edges below rely on README statements; unsampled implementation details and wiring are not asserted.

Main entry points: [`lib/features/appointments/presentation/screens`](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/presentation/screens) (Appointment screens), [`lib/core/sync/sync_engine.dart`](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/sync/sync_engine.dart) (Pull sync engine), [`lib/app.dart`](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/app.dart) (App shell and routing), [`lib/core/database/local_database.dart`](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/database/local_database.dart) (Sembast local database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_main["Flutter bootstrap<br/>[main.dart]"]
  node_app["App shell and routing<br/>[app.dart]"]
  node_onboarding["Onboarding"]
end

subgraph group_booking["Appointments"]
  node_appointments_ui["Appointment screens"]
  node_services["Services and availability"]
  node_booking_rules["Booking rules and slots"]
  node_appointment_data["Appointment repositories"]
end

subgraph group_core["Local data and sync"]
  node_connectivity["Connectivity"]
  node_sync["Pull sync engine<br/>[sync_engine.dart]"]
  node_database[("Sembast local database")]
  node_network["HTTP client and identity"]
end

subgraph group_extras["User extras"]
  node_profile["Client profile"]
  node_notifications["Notifications and reminders"]
end

subgraph group_external["Backend"]
  node_backend["Django API"]
end

node_person(("App user"))

node_person -->|"launches"| node_main
node_main -->|"starts"| node_app
node_app -->|"routes to"| node_onboarding
node_app -->|"routes to"| node_appointments_ui
node_person -->|"uses"| node_appointments_ui
node_appointments_ui -->|"browses"| node_services
node_appointments_ui -->|"validates booking"| node_booking_rules
node_appointments_ui -->|"manages appointments"| node_appointment_data
node_appointment_data -->|"reads cache"| node_database
node_services -->|"reads cache"| node_database
node_appointments_ui -->|"uses profile"| node_profile
node_appointments_ui -->|"uses reminders"| node_notifications
node_connectivity -->|"triggers on reconnect"| node_sync
node_app -->|"triggers on startup"| node_sync
node_person -->|"requests refresh"| node_sync
node_sync -->|"pulls updates"| node_network
node_sync -->|"updates cache"| node_database
node_network -->|"calls API"| node_backend
node_appointment_data -->|"writes online"| node_backend
node_services -->|"fetches availability"| node_backend
node_profile -->|"stores locally"| node_database

click node_main "https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/main.dart"
click node_app "https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/app.dart"
click node_onboarding "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/onboarding"
click node_appointments_ui "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/presentation/screens"
click node_services "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments"
click node_booking_rules "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/domain"
click node_appointment_data "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/data/repositories"
click node_profile "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/client_profile"
click node_notifications "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/notifications"
click node_connectivity "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/core/connectivity"
click node_sync "https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/sync/sync_engine.dart"
click node_database "https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/database/local_database.dart"
click node_network "https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/core/network"

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_main,node_app,node_onboarding,node_person toneBlue
class node_appointments_ui,node_services,node_booking_rules,node_appointment_data toneAmber
class node_connectivity,node_sync,node_database,node_network toneMint
class node_profile,node_notifications toneRose
class node_backend toneIndigo
```

## Components

### App entry

- [Flutter bootstrap](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/main.dart): `lib/main.dart`
- [App shell and routing](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/app.dart): `lib/app.dart`
- [Onboarding](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/onboarding): `lib/features/onboarding`

### Appointments

- [Appointment screens](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/presentation/screens): `lib/features/appointments/presentation/screens`
- [Services and availability](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments): `lib/features/appointments`
- [Booking rules and slots](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/domain): `lib/features/appointments/domain`
- [Appointment repositories](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/appointments/data/repositories): `lib/features/appointments/data/repositories`

### Local data and sync

- [Connectivity](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/core/connectivity): `lib/core/connectivity`
- [Pull sync engine](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/sync/sync_engine.dart): `lib/core/sync/sync_engine.dart`
- [Sembast local database](https://github.com/drakejcz6/ocpi_citas_app/blob/main/lib/core/database/local_database.dart): `lib/core/database/local_database.dart`
- [HTTP client and identity](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/core/network): `lib/core/network`

### User extras

- [Client profile](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/client_profile): `lib/features/client_profile`
- [Notifications and reminders](https://github.com/drakejcz6/ocpi_citas_app/tree/main/lib/features/notifications): `lib/features/notifications`

### Backend

- **Django API**

### Other components

- **App user**

## Connections

- App user → Flutter bootstrap: launches (evidence: `README.md`)
- Flutter bootstrap → App shell and routing: starts (evidence: `README.md`)
- App shell and routing → Onboarding: routes to (evidence: `README.md`)
- App shell and routing → Appointment screens: routes to (evidence: `README.md`)
- App user → Appointment screens: uses (evidence: `README.md`)
- Appointment screens → Services and availability: browses (evidence: `README.md`)
- Appointment screens → Booking rules and slots: validates booking (evidence: `README.md`)
- Appointment screens → Appointment repositories: manages appointments (evidence: `README.md`)
- Appointment repositories → Sembast local database: reads cache (evidence: `README.md`)
- Services and availability → Sembast local database: reads cache (evidence: `README.md`)
- Appointment screens → Client profile: uses profile (evidence: `README.md`)
- Appointment screens → Notifications and reminders: uses reminders (evidence: `README.md`)
- Connectivity → Pull sync engine: triggers on reconnect (evidence: `README.md`)
- App shell and routing → Pull sync engine: triggers on startup (evidence: `README.md`)
- App user → Pull sync engine: requests refresh (evidence: `README.md`)
- Pull sync engine → HTTP client and identity: pulls updates (evidence: `README.md`)
- Pull sync engine → Sembast local database: updates cache (evidence: `README.md`)
- HTTP client and identity → Django API: calls API (evidence: `README.md`)
- Appointment repositories → Django API: writes online (evidence: `README.md`)
- Services and availability → Django API: fetches availability (evidence: `README.md`)
- Client profile → Sembast local database: stores locally (evidence: `README.md`)
