# mnengineer/roadmap architecture

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

- Interactive diagram: https://gitdiagram.com/mnengineer/roadmap
- Repository: https://github.com/mnengineer/roadmap

## Overview

##### Main Components
- Frontend (Presentation Layer):
- Contains UI components such as views (login_screen, home_screen, etc.) and widgets.
- Includes the ViewModels (found under lib/presentation/viewmodels) which handle UI logic.
- Uses routing (go_router in lib/presentation/routes) for navigation.
- Domain Layer:
- Contains business rules like Entities, UseCases, and repository interfaces (in lib/domain/).
- Acts as the core of the app’s logic (e.g., goal and roadmap use cases).
- Data Layer:
- Implements the repository interfaces (in lib/data/repositories) and connects to data sources.
- Contains both Remote (Firebase integration in lib/data/datasources/remote) and Local data sources.
- Core Utilities:
- Includes configuration, constants, dependency injection, and common utilities (in lib/core/).
- External Services:
- Firebase for Authentication, Firestore, Cloud Functions, and Cloud Storage.
- Third-party packages like hooks_riverpod for state management and google_sign_in for authentication.
- Platform-specific Code:
- Android (android/) and iOS (ios/) folders, ensuring the Flutter app is correctly built and deployed on each platform.

##### Dependency and Data Flows
- For the call flow: View → ViewModel → UseCase → Repository → Data Source.
- For the data flow (reverse): Data Source → Repository → UseCase → ViewModel → View.

##### Architectural Patterns
- MVVM Pattern:
- Separation between View (UI), ViewModel (presentation logic), and how they interact with Domain/UseCases.
- Clean Architecture:
- Separation of concerns by dividing the system into Core, Domain, and Data layers.
- Dependency direction – inner layers (Domain) should be independent of outer layers (Data and Presentation).

##### Essential External Dependencies
- Cloud Services:
- Firebase services (Auth, Cloud Firestore, Cloud Functions, Storage) as external services that the Data layer reaches out to.
- Third-Party Libraries:
- Mention state management (hooks_riverpod, flutter_hooks), routing (go_router), etc., which affect the Presentation and overall architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["UI Components & Views"]:::presentation
        VM["ViewModels"]:::presentation
        Routing["Routing (go_router)"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Domain["Business Rules (Entities,UseCases,Repository Interfaces)"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        DSRemote["Remote Data Source (Firebase)"]:::data
        DSLocal["Local Data Source"]:::data
        Repo["Repository Implementations"]:::data
    end

    %% Core Utilities
    subgraph "Core/Utilities"
        Core["Configuration,Constants,DI,Utilities"]:::core
        FirebaseConfig["Firebase Config"]:::core
        DI["Dependency Injection"]:::core
    end

    %% External Services
    External["Firebase Services"]:::external

    %% Platform Specific Code
    subgraph "Platform Specific Code"
        Android["Android-specific Code"]:::platform
        iOS["iOS-specific Code"]:::platform
    end

    %% Call Flow (Top Down)
    UI -->|"calls"| VM
    VM -->|"calls"| Domain
    Domain -->|"calls"| Repo
    Repo -->|"calls"| DSRemote
    Repo -->|"calls"| DSLocal

    %% Data Flow (Bottom Up)
    DSRemote -.->|"dataflows"| Repo
    DSLocal -.->|"dataflows"| Repo
    Repo -.->|"dataflows"| Domain
    Domain -.->|"dataflows"| VM
    VM -.->|"dataflows"| UI

    %% External Dependency
    DSRemote -->|"integrates"| External

    %% Core Dependencies
    Repo -.->|"uses"| Core
    Domain -.->|"uses"| Core

    %% Platform Deployment
    UI -.->|"deployedOn"| Android
    UI -.->|"deployedOn"| iOS

    %% Click Events for Presentation Layer
    click UI "https://github.com/mnengineer/roadmap/tree/develop/lib/presentation/views"
    click VM "https://github.com/mnengineer/roadmap/tree/develop/lib/presentation/viewmodels"
    click Routing "https://github.com/mnengineer/roadmap/tree/develop/lib/presentation/routes"

    %% Click Events for Domain Layer
    click Domain "https://github.com/mnengineer/roadmap/tree/develop/lib/domain"

    %% Click Events for Data Layer
    click DSRemote "https://github.com/mnengineer/roadmap/tree/develop/lib/data/datasources/remote/firebase"
    click DSLocal "https://github.com/mnengineer/roadmap/tree/develop/lib/data/datasources/local"
    click Repo "https://github.com/mnengineer/roadmap/tree/develop/lib/data/repositories"

    %% Click Events for Core Utilities
    click Core "https://github.com/mnengineer/roadmap/tree/develop/lib/core"
    click FirebaseConfig "https://github.com/mnengineer/roadmap/blob/develop/lib/core/config/firebase_options.dart"
    click DI "https://github.com/mnengineer/roadmap/tree/develop/lib/core/di"

    %% Click Events for Platform Specific Code
    click Android "https://github.com/mnengineer/roadmap/tree/develop/android"
    click iOS "https://github.com/mnengineer/roadmap/tree/develop/ios"

    %% Styles
    classDef presentation fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef domain fill:#C5CAE9,stroke:#303F9F,stroke-width:2px;
    classDef data fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef core fill:#D1C4E9,stroke:#7E57C2,stroke-width:2px;
    classDef external fill:#FFCCBC,stroke:#F4511E,stroke-width:2px;
    classDef platform fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
```
