# soen-390-w2025/soen-390 architecture

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

- Interactive diagram: https://gitdiagram.com/soen-390-w2025/soen-390
- Repository: https://github.com/soen-390-w2025/soen-390

## Overview

##### Project type and purpose
- This is a cross-platform mobile navigation app (“Concordia Nav”) built entirely in Flutter / Dart.
- It runs on Android and iOS, uses Google Maps + custom indoor/outdoor maps, integrates with calendar and OpenAI, and provides features such as next-class directions, POI browsing, smart planning, and accessibility settings.

##### File structure
- Top‐level folders:
- android/ & ios/ → platform embedding (Gradle, Xcode project, MainActivity.kt, AppDelegate.swift)
- lib/ → the Flutter app’s code, subdivided into:
– data/ (domain‐model, repositories, services)
– ui/ (views organized by feature)
– utils/ (viewmodels & helpers)
– widgets/ (reusable UI components)
– main.dart (app entrypoint)
- test/ (unit & widget tests mirroring lib/)
- .github/, .githooks/ (CI/CD + pre-commit configuration)
- Key patterns: layered separation (presentation, state, domain, data), MVVM-ish (widgets↔viewmodels↔services), repo & service layers.

##### README for additional insights
- Environment variables for GOOGLE_MAPS_API_KEY and OPENAI_API_KEY
- rps scripts for build/test/CI
- CI pipeline: format, lint, unit tests, Android/iOS builds, codecov upload
- Third-party libs: calendar_view, Google Maps plugin

- Labels: clear component names (e.g., “MapService,” “IndoorRoutingService,” “CampusMapView”).
- Blue rectangles for UI components
- Green rectangles for state / viewmodels
- Red clouds for external APIs

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Interaction
    User["User"]:::user

    %% Platform Embedding
    subgraph "Mobile Device"
        subgraph "Platform Embedding"
            Android["Android (MainActivity.kt)"]:::platform
            iOS["iOS (AppDelegate.swift)"]:::platform
        end
    end

    %% Bootstrap & Engine
    MainD["main.dart\n(Flutter Entrypoint)"]:::bootstrap
    subgraph "Flutter Engine"
        FlutterEngine["Flutter Engine & Runtime"]:::engine
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph "Feature Views"
            CampusMapView["CampusMapView"]:::ui
            HomepageView["HomePageView"]:::ui
            IndoorDirectionsView["IndoorDirectionsView"]:::ui
        end
        Widgets["Reusable Widgets"]:::ui
    end

    %% State Management
    subgraph "State Management Layer"
        ViewModels["ViewModels & Controllers"]:::state
    end

    %% Domain Layer
    subgraph "Domain Layer"
        DomainModels["Domain Models"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        Repositories["Repositories"]:::repo
        Services["Services"]:::service
    end

    %% Assets & External
    Assets["Local Data Assets"]:::data
    subgraph "External Services & APIs"
        GoogleMaps["Google Maps API"]:::external
        OpenAI["OpenAI API"]:::external
        CalendarAPI["Calendar API"]:::external
    end

    %% CI/CD
    CI["CI/CD Pipeline\n(GitHub Actions)"]:::ci

    %% Data Flow
    User --> CampusMapView
    User --> HomepageView
    User --> IndoorDirectionsView

    CampusMapView -->|events| ViewModels
    HomepageView -->|events| ViewModels
    IndoorDirectionsView -->|events| ViewModels
    Widgets -->|binds| ViewModels

    ViewModels -->|calls| Services
    ViewModels -->|calls| Repositories

    Services -->|fetches| Assets
    Services -->|requests| GoogleMaps
    Services -->|requests| OpenAI
    Repositories -->|reads| Assets
    Repositories -->|requests| CalendarAPI

    Services -->|returns DomainModel| DomainModels
    Repositories -->|returns DomainModel| DomainModels
    DomainModels -->|state update| ViewModels
    ViewModels -->|UI update| CampusMapView
    ViewModels -->|UI update| HomepageView
    ViewModels -->|UI update| IndoorDirectionsView

    Android --> MainD
    iOS --> MainD
    MainD --> FlutterEngine
    FlutterEngine --> CampusMapView
    FlutterEngine --> HomepageView
    FlutterEngine --> IndoorDirectionsView

    CI -.->|on push| MainD

    %% Click Events
    click Android "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/android/app/src/main/kotlin/com/example/concordia_nav/MainActivity.kt"
    click iOS "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/ios/Runner/AppDelegate.swift"
    click MainD "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/lib/main.dart"
    click CampusMapView "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/lib/ui/campus_map/campus_map_view.dart"
    click HomepageView "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/lib/ui/home/homepage_view.dart"
    click IndoorDirectionsView "https://github.com/soen-390-w2025/soen-390/blob/main/concordia_nav/lib/ui/indoor_location/indoor_directions_view.dart"
    click Widgets "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/lib/widgets/"
    click ViewModels "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/lib/utils/"
    click DomainModels "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/lib/data/domain-model/"
    click Repositories "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/lib/data/repositories/"
    click Services "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/lib/data/services/"
    click Assets "https://github.com/soen-390-w2025/soen-390/tree/main/concordia_nav/assets/"
    click CI "https://github.com/soen-390-w2025/soen-390/blob/main/.github/workflows/ci.yaml"

    %% Styles
    classDef ui fill:#CFE2F3,stroke:#07689F
    classDef state fill:#D9EAD3,stroke:#6AA84F
    classDef domain fill:#FFF2CC,stroke:#E69138
    classDef repo fill:#F4CCCC,stroke:#CC0000
    classDef service fill:#EAECF0,stroke:#656D78
    classDef data fill:#FCE5CD,stroke:#E69138
    classDef external fill:#F4CCCC,stroke:#990000
    classDef platform fill:#D0E0E3,stroke:#1155CC
    classDef bootstrap fill:#B4A7D6,stroke:#674EA7
    classDef engine fill:#EAD1DC,stroke:#993366
    classDef ci fill:#DDDDDD,stroke:#999999
    classDef user fill:#FFFFFF,stroke:#000000
```
