# aksoyhlc/order-project-tracking architecture

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

- Interactive diagram: https://gitdiagram.com/aksoyhlc/order-project-tracking
- Repository: https://github.com/aksoyhlc/order-project-tracking

## Overview

##### Main Components
- User Interface (UI) Layer: Represented by the Flutter “lib/view” directory, this layer contains all the screens, forms, and widgets (e.g., login, setup, dashboard/home, customer management, order management, project management, profile, statistics view, and partial/shared UI components).
- Business Logic / Controller Layer: Found in the “lib/controller” directory. This layer implements key use cases—managing customers, orders, projects, global states, sidebar interactions, and database interactions.
- Data Model Layer: Included under “lib/model”; these files define the structures for customers, orders, projects, and users.
- Database Component: The SQLite database is provided as an asset (assets/db/db.db). It serves as the local persistence layer that the controllers access (via classes in “lib/controller/db”).
- Platform & Build Configuration: The folders android, ios, linux, macos, windows, and web hold platform-specific configurations and build scripts. Although these are largely wrappers provided by Flutter, they indicate that the application is distributed across multiple platforms.
- Setup & Authentication: The README explains a one-time setup screen used to configure initial credentials. This can be modeled as a component that manages user authentication and profile settings.

##### Relationships and Interactions
- The Controller Layer communicates with the Data Model Layer to manipulate data objects. It also manages the persistence by reading from and writing to the SQLite database.
- The Setup Component initializes application configuration (e.g., initial email/password), after which the user is authenticated and navigates through the various UI screens.
- Platform-specific wrappers (android, ios, etc.) serve as entry-points, launching the Flutter engine that then instantiates the UI and business logic.

##### Important Architectural Patterns
- The separation clearly illustrates a layered architecture similar to MVC/MVVM:
- UI/View (presentation).
- Controller (business logic).
- Model (data structures and persistence).
- The project encapsulates cross-platform concerns by isolating platform-specific code in distinct directories while keeping core logic in the shared Dart code under “lib.”
- The single-device, offline-first design indicates a design optimized for local data storage and processing, with a decoupled interface for potential future synchronization (as seen in the online version mentioned).

##### Specific Technologies & Frameworks
- Flutter: The core UI framework and runtime managing multi-platform support.
- SQLite: The local database engine (accessed via the mobile_db and other DB-specific controllers).
- Dart: Primary programming language for both UI and business logic.
- Platform-specific build tools: Gradle for Android, Xcode for iOS/macOS, CMake for Linux/Windows, etc.

##### Essential Elements
- Each major component should have a clear label (e.g., “UI Layer – Flutter Widgets”, “Controller Layer – Business Logic”, “Database – SQLite”, “Platform Wrappers – Android / iOS / Web”, etc.).
- Notes or labels that indicate key technologies (Flutter, SQLite, Dart) and architectural patterns (MVC/MVVM).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Platform & Build Configuration
    subgraph "Platform & Build Configuration"
        P1("Android"):::platform
        P2("iOS"):::platform
        P3("Web"):::platform
        P4("Linux"):::platform
        P5("macOS"):::platform
        P6("Windows"):::platform
    end

    %% Flutter Engine as an intermediate component
    subgraph "Flutter Engine"
        F("Flutter Engine"):::platformMid
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Setup("Setup Screen"):::setup
        Auth("Authentication"):::setup
        UI("UI Layer - Flutter Widgets"):::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BL("Business Logic / Controller Layer"):::controller
    end

    %% Data & Persistence
    subgraph "Data & Persistence"
        DM("Data Model Layer"):::model
        DB("SQLite Database File"):::database
        DB_C("DB Controller"):::database
    end

    %% Assets & Resources
    subgraph "Assets & Resources"
        AS("Static Assets"):::assets
        LI("Launcher Icons"):::assets
    end

    %% Connections from Platform to Flutter Engine
    P1 --> F
    P2 --> F
    P3 --> F
    P4 --> F
    P5 --> F
    P6 --> F

    %% Connections from Flutter Engine to Presentation Layer
    F --> Setup
    F --> UI

    %% Setup flow within Presentation Layer
    Setup --> Auth
    Setup --> UI

    %% UI interacts with Business Logic
    UI --> BL

    %% Business Logic interacts with Data Layer and Database
    BL --> DM
    BL --> DB_C
    DB_C --> DB

    %% UI uses Assets & Resources
    UI --> AS
    UI --> LI

    %% Click Events
    click UI "https://github.com/aksoyhlc/order-project-tracking/tree/master/lib/view"
    click BL "https://github.com/aksoyhlc/order-project-tracking/tree/master/lib/controller"
    click DM "https://github.com/aksoyhlc/order-project-tracking/tree/master/lib/model"
    click DB "https://github.com/aksoyhlc/order-project-tracking/blob/master/assets/db/db.db"
    click DB_C "https://github.com/aksoyhlc/order-project-tracking/tree/master/lib/controller/db"
    click P1 "https://github.com/aksoyhlc/order-project-tracking/tree/master/android"
    click P2 "https://github.com/aksoyhlc/order-project-tracking/tree/master/ios"
    click P3 "https://github.com/aksoyhlc/order-project-tracking/tree/master/web"
    click P4 "https://github.com/aksoyhlc/order-project-tracking/tree/master/linux"
    click P5 "https://github.com/aksoyhlc/order-project-tracking/tree/master/macos"
    click P6 "https://github.com/aksoyhlc/order-project-tracking/tree/master/windows"
    click Setup "https://github.com/aksoyhlc/order-project-tracking/blob/master/lib/view/setup/setup.dart"
    click Auth "https://github.com/aksoyhlc/order-project-tracking/tree/master/lib/view/auth"
    click AS "https://github.com/aksoyhlc/order-project-tracking/tree/master/assets"
    click LI "https://github.com/aksoyhlc/order-project-tracking/blob/master/flutter_launcher_icons.yaml"

    %% Style definitions
    classDef platform fill:#d1e8ff,stroke:#1f78b4,stroke-width:2px;
    classDef platformMid fill:#f0e68c,stroke:#b8860b,stroke-width:2px;
    classDef ui fill:#c5f7c3,stroke:#2ca02c,stroke-width:2px;
    classDef controller fill:#ffd966,stroke:#ff851b,stroke-width:2px;
    classDef model fill:#f5c6ff,stroke:#800080,stroke-width:2px;
    classDef database fill:#ffcccc,stroke:#ff0000,stroke-width:2px;
    classDef setup fill:#d5e8d4,stroke:#82b366,stroke-width:2px;
    classDef assets fill:#e2edf8,stroke:#6baed6,stroke-width:2px;
```
