# itsthompson/neo_delta architecture

> Architecture diagram of the GitHub repository itsthompson/neo_delta, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itsthompson/neo_delta
- Repository: https://github.com/itsthompson/neo_delta

## Overview

##### Main Components
- Frontend/UI Layer: Represented by the Flutter code in the “lib” directory. Break this down into:
- Pages (found in lib/pages): Home page, stats page, detailed delta views and selections.
- Widgets (in lib/widgets): Custom UI components like navigation bars, buttons, and charts (using fl_chart).
- Application Logic Layer:
- Models (in lib/models): Data models such as landmark_delta, recurring_delta, delta_progress, etc.
- Services (in lib/services): For example, the current_datetime service that likely provides timing or scheduling.
- Data Persistence Layer:
- Database (handled by files in lib/database): Includes files like database.dart, database_landmark_delta.dart, and database_recurring_delta.dart, which interface with the local sqflite database.
- Routing/Navigation:
- Router configuration in lib/routes/router_config.dart based on go_router.
- Platform-specific Configuration:
- Multiple folder structures for Android, iOS, macOS, Linux, Windows, and Web. Each platform contains its own build configurations, resources, and platform integration components.
- Assets:

##### Establish Relationships and Interactions
- The entry point (lib/main.dart) initializes the app and sets up state management (provider) and routes (go_router).
- The UI components (pages and widgets) interact with the Models to both display and collect data.
- The Database layer provides CRUD operations for storing user data such as habit tracking and delta calculations.
- The Services layer (e.g., current_datetime) assists in controlling time-based logic which then informs the models.
- Platform-specific folders support the same shared Flutter code but contain configurations and native code required for each target (Android, iOS, etc.).

##### Architectural Patterns & Technologies
- Model-View-Controller or Model-View-ViewModel (implicit in the use of provider for app state management).
- Layered architecture: Separation of UI (lib/pages, lib/widgets), business logic (lib/models, lib/services), and data persistence (lib/database).
- Cross-platform integration: Note different folders for Android, iOS, Linux, macOS, Windows, and Web.
- Key technologies: Flutter, sqflite, provider, go_router, and fl_chart.

##### Detailed Steps
- “Routing & Navigation (go_router via router_config.dart)”
- “State Management (Provider)”

## Diagram (Mermaid)

```mermaid
flowchart TD
    AppEntry["App Entry (main.dart)"]:::entry
    State["State Management (Provider)"]:::state
    Routing["Routing & Navigation (go_router via router_config.dart)"]:::routing

    AppEntry --> State
    AppEntry --> Routing

    subgraph "Frontend/UI"
        UI1["Pages (lib/pages)"]:::ui
        UI2["Widgets (lib/widgets)"]:::ui
    end

    Routing --> UI1
    Routing --> UI2

    subgraph "Business Logic & Models"
        BL1["Models (lib/models)"]:::logic
        BL2["Services (current_datetime & more) (lib/services)"]:::logic
    end

    UI1 --> BL1
    UI2 --> BL1
    UI1 --> BL2
    UI2 --> BL2
    BL2 --> BL1

    BL1 -->|"CRUD"| Database["Local Database (sqflite)"]:::database

    Assets["Assets (assets)"]:::assets
    Assets -->|"used_by"| UI1

    subgraph "Platform-specific Configurations"
        Deployment["Deployment"]:::platform
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        macOS["macOS"]:::platform
        Linux["Linux"]:::platform
        Windows["Windows"]:::platform
        Web["Web"]:::platform
        Deployment --> Android
        Deployment --> iOS
        Deployment --> macOS
        Deployment --> Linux
        Deployment --> Windows
        Deployment --> Web
    end

    AppEntry -->|"deployed_on"| Deployment

    classDef entry fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef routing fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef state fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef ui fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef logic fill:#E6E6FA,stroke:#333,stroke-width:2px;
    classDef database fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef platform fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef assets fill:#F0E68C,stroke:#333,stroke-width:2px;

    click AppEntry "https://github.com/itsthompson/neo_delta/blob/main/lib/main.dart"
    click UI1 "https://github.com/itsthompson/neo_delta/tree/main/lib/pages"
    click UI2 "https://github.com/itsthompson/neo_delta/tree/main/lib/widgets"
    click BL1 "https://github.com/itsthompson/neo_delta/tree/main/lib/models"
    click BL2 "https://github.com/itsthompson/neo_delta/tree/main/lib/services"
    click Database "https://github.com/itsthompson/neo_delta/tree/main/lib/database"
    click Routing "https://github.com/itsthompson/neo_delta/blob/main/lib/routes/router_config.dart"
    click Android "https://github.com/itsthompson/neo_delta/tree/main/android"
    click iOS "https://github.com/itsthompson/neo_delta/tree/main/ios"
    click macOS "https://github.com/itsthompson/neo_delta/tree/main/macos"
    click Linux "https://github.com/itsthompson/neo_delta/tree/main/linux"
    click Windows "https://github.com/itsthompson/neo_delta/tree/main/windows"
    click Web "https://github.com/itsthompson/neo_delta/tree/main/web"
    click Assets "https://github.com/itsthompson/neo_delta/tree/main/assets"
```
