# alexiscardozzo/enterpro_app architecture

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

- Interactive diagram: https://gitdiagram.com/alexiscardozzo/enterpro_app
- Repository: https://github.com/alexiscardozzo/enterpro_app

## Overview

##### Project Type and Purpose
- Type: A client-side, multi-platform educational app built with Flutter (mobile, web, desktop).
- Purpose: Gamified learning in math, finance, programming, with customizable avatars and progress tracking, all running locally (no remote server code in the repo).

##### File Structure
- Top-Level Directories:
- android, ios, macos, linux, windows, web → platform-specific runners & build scripts
- lib → core Dart code: models/, providers/, services/, screens/, main.dart
- assets → static files (avatars)
- test → widget tests
- Patterns & Layers:
- Presentation Layer: lib/screens/
- State Management: lib/providers/ using ChangeNotifier or similar
- Domain Models: lib/models/
- Data Layer: lib/services/database_helper.dart (SQLite via sqflite or similar)
- Platform Layer: Generated plugin registrants + native code in android/app/src, ios/Runner/, macos/Runner/ etc.
- Build & Config:
- Flutter CLI + pubspec.yaml for dependencies
- Gradle/Kotlin scripts for Android
- Xcode/CMake configs for iOS/macOS/Linux/Windows

##### Extract Architectural Insights from README
- Single-codebase Flutter front-end
- No dedicated backend—data persists locally
- Native performance via C++ plugins and Swift/C++ platform code
- Multi-platform targets (mobile, desktop, web)

##### Main Components & Their Interactions
a. Flutter Engine & Framework
- Renders UI, hosts Dart VM, invokes platform channels
b. Presentation Layer (Screens)
- Screens (HabitList, MathGameScreen, AvatarCustomization, etc.) present UI
- Depend on Providers for state
c. State Management (Providers)
- Expose methods & notify listeners
- E.g., HabitProvider, GamificationProvider
d. Data Layer (Services)
- DatabaseHelper → CRUD on local SQLite
e. Platform Layer
- Native runners (Android’s MainActivity.kt, iOS AppDelegate.swift, Linux main.cc, Windows main.cpp)
- Generated plugins integrate 3rd-party or custom C++ code for performance
f. Assets & Static Resources
- Local images (avatars) and web manifest
g. Tests
- widget_test.dart for UI behavior

Interaction Flow Example:
Screen → calls Provider → Provider calls DatabaseHelper → SQLite DB → returns raw data → Provider maps to Model → notifies Screen → UI updates.

##### Architectual Patterns & Principles
- Separation of Concerns: UI vs. state vs. data
- MVVM-style: Screens (View) + Providers (ViewModel) + Models (Model)
- Platform Abstraction via Flutter + platform channels
- Single source of truth in Providers

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Flutter Engine & Entry Point"
        Main["main.dart"]:::entry
        Engine["Flutter Engine & Plugins"]:::engine
    end

    subgraph "Presentation Layer (Screens)"
        AHS["add_habit_screen.dart"]:::ui
        ACS["avatar_customization_screen.dart"]:::ui
        GS["gamification_screen.dart"]:::ui
        HLS["habit_list_screen.dart"]:::ui
        MGLS["math_game_list_screen.dart"]:::ui
        MGS["math_game_screen.dart"]:::ui
        MPGS["math_play_game_screen.dart"]:::ui
    end

    subgraph "State Layer (Providers)"
        HP["habit_provider.dart"]:::state
        GP["gamification_provider.dart"]:::state
    end

    subgraph "Data Layer"
        DBH["database_helper.dart"]:::data
        subgraph "Models"
            Avatar["avatar.dart"]:::model
            Habit["habit.dart"]:::model
            MathGame["math_game.dart"]:::model
            MathQuestion["math_question.dart"]:::model
            Achv["achievement.dart"]:::model
            Level["level.dart"]:::model
            UserStats["user_stats.dart"]:::model
        end
    end

    DB["SQLite DB"]:::db

    subgraph "Platform Runners"
        ANDR["MainActivity.kt"]:::platform
        IOS["AppDelegate.swift (iOS)"]:::platform
        MAC1["AppDelegate.swift (macOS)"]:::platform
        MAC2["MainFlutterWindow.swift"]:::platform
        LNX["main.cc"]:::platform
        WIN["main.cpp"]:::platform
    end

    subgraph "Assets & Tests"
        Avatars["avatars/"]:::assets
        WebEntry["index.html"]:::assets
        Manifest["manifest.json"]:::assets
        Icons["icons/"]:::assets
        Test1["widget_test.dart"]:::test
        Test2["widget_test.mocks.dart"]:::test
    end

    subgraph "Build & Config Tools"
        CLI["Flutter CLI"]:::tool
        Gradle["Gradle/Kotlin"]:::tool
        Xcode["Xcode/CMake"]:::tool
    end

    Main -->|"initializes"| Engine
    Main --> UI
    UI -->|uses| HP
    UI -->|uses| GP
    HP -->|calls| DBH
    GP -->|calls| DBH
    DBH -->|queries| DB
    DB -->|returns data| DBH
    DBH -->|maps to models| Avatar
    DBH -->|maps to models| Habit
    DBH -->|maps to models| MathGame
    DBH -->|maps to models| MathQuestion
    DBH -->|maps to models| Achv
    DBH -->|maps to models| Level
    DBH -->|maps to models| UserStats
    HP -->|notifies| UI
    GP -->|notifies| UI
    Engine -->|PlatformChannel| ANDR
    Engine -->|PlatformChannel| IOS
    Engine -->|PlatformChannel| MAC1
    Engine -->|PlatformChannel| MAC2
    Engine -->|PlatformChannel| LNX
    Engine -->|PlatformChannel| WIN
    CLI -->|builds for| ANDR
    CLI -->|builds for| IOS
    CLI -->|builds for| MAC1
    CLI -->|builds for| LNX
    CLI -->|builds for| WIN
    Gradle -->|for Android| ANDR
    Xcode -->|for iOS/macOS| IOS
    Xcode -->|for macOS| MAC1
    Xcode -->|for Linux| LNX
    Xcode -->|for Windows| WIN

    click Main "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/main.dart"
    click AHS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/add_habit_screen.dart"
    click ACS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/avatar_customization_screen.dart"
    click GS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/gamification_screen.dart"
    click HLS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/habit_list_screen.dart"
    click MGLS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/math_game_list_screen.dart"
    click MGS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/math_game_screen.dart"
    click MPGS "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/screens/math_play_game_screen.dart"
    click HP "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/providers/habit_provider.dart"
    click GP "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/providers/gamification_provider.dart"
    click DBH "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/services/database_helper.dart"
    click Avatar "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/avatar.dart"
    click Habit "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/habit.dart"
    click MathGame "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/math_game.dart"
    click MathQuestion "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/math_question.dart"
    click Achv "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/gamification/achievement.dart"
    click Level "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/gamification/level.dart"
    click UserStats "https://github.com/alexiscardozzo/enterpro_app/blob/main/lib/models/gamification/user_stats.dart"
    click ANDR "https://github.com/alexiscardozzo/enterpro_app/blob/main/android/app/src/main/kotlin/com/example/enterpro/MainActivity.kt"
    click IOS "https://github.com/alexiscardozzo/enterpro_app/blob/main/ios/Runner/AppDelegate.swift"
    click MAC1 "https://github.com/alexiscardozzo/enterpro_app/blob/main/macos/Runner/AppDelegate.swift"
    click MAC2 "https://github.com/alexiscardozzo/enterpro_app/blob/main/macos/Runner/MainFlutterWindow.swift"
    click LNX "https://github.com/alexiscardozzo/enterpro_app/blob/main/linux/runner/main.cc"
    click WIN "https://github.com/alexiscardozzo/enterpro_app/blob/main/windows/runner/main.cpp"
    click Avatars "https://github.com/alexiscardozzo/enterpro_app/tree/main/assets/avatars/"
    click WebEntry "https://github.com/alexiscardozzo/enterpro_app/blob/main/web/index.html"
    click Manifest "https://github.com/alexiscardozzo/enterpro_app/blob/main/web/manifest.json"
    click Icons "https://github.com/alexiscardozzo/enterpro_app/tree/main/web/icons/"
    click Test1 "https://github.com/alexiscardozzo/enterpro_app/blob/main/test/widget_test.dart"
    click Test2 "https://github.com/alexiscardozzo/enterpro_app/blob/main/test/widget_test.mocks.dart"

    classDef entry fill:#E0F7FA,stroke:#006064
    classDef engine fill:#B2EBF2,stroke:#00838F
    classDef ui fill:#BBDEFB,stroke:#1565C0
    classDef state fill:#C8E6C9,stroke:#2E7D32
    classDef data fill:#FFE0B2,stroke:#EF6C00
    classDef model fill:#FFF3E0,stroke:#E65100
    classDef db fill:#D7CCC8,stroke:#4E342E,shape:cylinder
    classDef platform fill:#CFD8DC,stroke:#455A64
    classDef assets fill:#F8BBD0,stroke:#C2185B
    classDef test fill:#E1BEE7,stroke:#6A1B9A
    classDef tool fill:#FFF9C4,stroke:#F9A825
```
