# oolaapleur/yggert-nu architecture

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

- Interactive diagram: https://gitdiagram.com/oolaapleur/yggert-nu
- Repository: https://github.com/oolaapleur/yggert-nu

## Overview

##### Main Components

a. Frontend Layer:
- Flutter UI Components (screens, widgets)
- BLoC Pattern Components (for state management)
- Theme Management
- Internationalization (l10n)

b. Core Business Layer:
- Domain Logic
- Use Cases
- Repositories
- Data Models

c. Data Layer:
- API Providers
- Local Storage
- GTFS Data Operations
- Device Settings

d. External Services:
- Google Authentication
- Mobility Services APIs (Bolt, Hoog, Tuul)
- Public Transport APIs
- Services

**┌─ Presentation Layer ─────────────────────────┐**
- Home Screen                                │
- Map Screen                                 │
- Settings Screen                            │
- Intro Screen                              │
- ┬───────────────────────────┘
- ↓
**┌─ Business Logic Layer ────────────────────────┐**
- ┌─ BLoCs ─────┐  ┌─ Use Cases ──────────┐    │
- Map Bloc  │  │ - Filter Trips       │    │
- Auth Bloc │  │ - Get Calendar       │    │
- Theme Bloc│  │ - User Authentication│    │
- ┘  └────────────────────────    │
- ┬────────────────────────────┘
- ↓
**┌─ Data Layer ──────────────────────────────────┐**
- ┌─ Repositories ─┐  ┌─ Data Sources ────────┐ │
- Vehicle     │  │ - GTFS Operations     │ │
- Settings    │  │ - API Providers       │ │
- User        │  │ - Local Storage       │ │
- ┘  └─────────────────────────│ │
- ┬────────────────────────────┘
- ↓
**┌─ External Services ──────────────────────────┐**
- Google Auth                               │
- Mobility APIs (Bolt, Hoog, Tuul)          │
- Public Transport APIs                     │
- Map Services                              │
- ┘

##### Important Details

- How user interactions flow through the layers
- API calls to external services

b. Component Relationships:
- BLoC to UI connections
- Repository to API provider relationships
- Authentication flow paths

c. Cross-Cutting Concerns:
- Internationalization
- Theme Management
- Error Handling
- Network Status Monitoring

##### Notes

- Clear separation between development and production flavors
- Where environment-specific configurations are applied
- Integration test boundaries

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[UI Components]
        HomeScreen["Home Screen"]:::screen
        MapScreen["Map Screen"]:::screen
        SettingsScreen["Settings Screen"]:::screen
        IntroScreen["Intro Screen"]:::screen
        UI --> HomeScreen
        UI --> MapScreen
        UI --> SettingsScreen
        UI --> IntroScreen
    end

    subgraph StateManagement
        BLoCs[BLoC Components]
        MapBloc["Map BLoC"]:::bloc
        AuthBloc["Auth BLoC"]:::bloc
        ThemeBloc["Theme BLoC"]:::bloc
        BLoCs --> MapBloc
        BLoCs --> AuthBloc
        BLoCs --> ThemeBloc
    end

    subgraph BusinessLogic
        UseCases["Use Cases"]:::core
        UserRepo["User Repository Interface"]:::core
        AuthUseCases["Authentication Use Cases"]:::core
    end

    subgraph DataLayer
        VehicleRepo["Vehicle Repository"]:::data
        SettingsRepo["Settings Repository"]:::data
        GTFSOps["GTFS Operations"]:::data
        DeviceSettings["Device Settings"]:::data
    end

    subgraph APIProviders
        BoltAPI["Bolt Scooter API"]:::api
        HoogAPI["Hoog Scooter API"]:::api
        TuulAPI["Tuul Scooter API"]:::api
        PTApi["Public Transport API"]:::api
    end

    subgraph CrossCutting
        I18n["Internationalization"]:::util
        ThemeMgmt["Theme Management"]:::util
        ServiceLoc["Service Locator"]:::util
        Network["Network Status"]:::util
    end

    subgraph DataModels
        ScooterModels["Scooter Models"]:::model
        CarModels["Car Models"]:::model
        PTModels["Public Transport Models"]:::model
    end

    subgraph MapComponents
        Markers["Map Markers"]:::map
        MapView["Map View"]:::map
    end

    UI --> BLoCs
    BLoCs --> UseCases
    UseCases --> DataLayer
    DataLayer --> APIProviders
    MapComponents --> MapScreen

    classDef screen fill:#3498db
    classDef bloc fill:#2ecc71
    classDef core fill:#e67e22
    classDef data fill:#e74c3c
    classDef api fill:#9b59b6
    classDef util fill:#95a5a6
    classDef model fill:#f1c40f
    classDef map fill:#1abc9c

    click HomeScreen "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/home/home_screen.dart"
    click MapScreen "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/map/view/map_screen.dart"
    click SettingsScreen "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/settings/settings.dart"
    click IntroScreen "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/intro/intro.dart"
    click MapBloc "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/map/bloc/map_bloc.dart"
    click AuthBloc "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/settings/auth_bloc/auth_bloc.dart"
    click ThemeBloc "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/theme/bloc/theme_bloc.dart"
    click UseCases "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/domain/usecases/"
    click UserRepo "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/domain/user_repositories/user_repository.dart"
    click AuthUseCases "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/domain/user_repositories/usecases/"
    click VehicleRepo "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/repositories/vehicle_repository.dart"
    click SettingsRepo "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/repositories/settings_repository.dart"
    click GTFSOps "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/data_sources/gtfs_data_operations.dart"
    click DeviceSettings "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/device_settings.dart"
    click BoltAPI "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/providers/scooter/bolt_scooter_api_provider.dart"
    click HoogAPI "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/providers/scooter/hoog_scooter_api_provider.dart"
    click TuulAPI "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/providers/scooter/tuul_scooter_api_provider.dart"
    click PTApi "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/providers/estonia_public_transport_api_provider.dart"
    click I18n "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/l10n/"
    click ThemeMgmt "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/theme/theme.dart"
    click ServiceLoc "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/utils/service_locator.dart"
    click Network "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/utils/has_network.dart"
    click ScooterModels "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/data/models/scooter/"
    click CarModels "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/data/models/car/"
    click PTModels "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/data/models/estonia_public_transport.dart"
    click Markers "https://github.com/OolaaPleur/Yggert-nu/tree/master/lib/screens/map/markers/"
    click MapView "https://github.com/OolaaPleur/Yggert-nu/blob/master/lib/screens/map/view/map_screen.dart"
```
