# solvro/mobile-topwr architecture

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

- Interactive diagram: https://gitdiagram.com/solvro/mobile-topwr
- Repository: https://github.com/solvro/mobile-topwr

## Overview

##### Main System Components

a) Frontend Layer (Mobile App):
- Sub-components:
- UI Features (Home, Map, Buildings, Departments, etc.)
- State Management (Riverpod)
- Asset Management
- Internationalization

b) API Layer:
- GraphQL Client
- REST Clients (Dio)
- Cache Management System

c) Backend Services:
- Directus CMS
- iParking Service
- SKS API
- Digital Guide API
- Firebase Services

##### Component Relationships

a) Data Flow:
- User interactions → UI Components
- UI Components → State Management
- State Management → API Clients
- API Clients → External Services
- Cache System ↔ API Clients

b) Feature Dependencies:
- Related features:
- -related features (buildings, parking)
- Academic features (departments, science clubs)
- User services (notifications, analytics)

##### Key Architectural Patterns

a) Feature-First Architecture:
- How each feature is self-contained with:
- Presentation layer
- Business logic
- Data layer
- Repository pattern

b) State Management:
- Riverpod's role in:
- State management
- Dependency injection
- Cache control

##### Technical Implementation Details

a) Cross-Cutting Concerns:
- Authentication
- Offline support
- Caching strategy
- Error handling

b) Platform-Specific Elements:
- Containers for:
- Android-specific implementations
- iOS-specific implementations

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef infrastructure fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef storage fill:#e74c3c,stroke:#c0392b,color:white

    subgraph Frontend["Flutter Mobile Application"]
        UI[UI Layer]
        
        subgraph Features["Feature Modules"]
            HomeView["Home View"]:::frontend
            MapView["Map View"]:::frontend
            BuildingsView["Buildings View"]:::frontend
            DepartmentsView["Departments View"]:::frontend
        end

        subgraph Core["Core Components"]
            ThemeConfig["Theme Configuration"]:::frontend
            Router["Router"]:::frontend
            Navigation["Navigation Controller"]:::frontend
            I18n["Internationalization"]:::frontend
            Assets["Asset Management"]:::frontend
            CommonWidgets["Common Widgets"]:::frontend
        end

        StateManagement["Riverpod State Management"]:::frontend
    end

    subgraph APILayer["API Layer"]
        GraphQL["GraphQL Client"]:::api
        REST["REST Client (Dio)"]:::api
        Cache["Cache Management"]:::api
    end

    subgraph ExternalServices["External Services"]
        Directus["Directus CMS"]:::external
        iParking["iParking Service"]:::external
        SKS["SKS API"]:::external
        DigitalGuide["Digital Guide API"]:::external
        Firebase["Firebase Services"]:::external
    end

    %% Relationships
    UI --> Features
    Features --> StateManagement
    StateManagement --> APILayer
    APILayer --> ExternalServices
    Core --> Features

    %% Click events
    click HomeView "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/home_view/"
    click MapView "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/map_view/"
    click BuildingsView "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/buildings_view/"
    click DepartmentsView "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/departments_view/"
    click Assets "https://github.com/Solvro/mobile-topwr/tree/main/assets/"
    click I18n "https://github.com/Solvro/mobile-topwr/tree/main/lib/l10n/"
    click GraphQL "https://github.com/Solvro/mobile-topwr/blob/main/lib/api_base/gql_client_provider.dart"
    click REST "https://github.com/Solvro/mobile-topwr/blob/main/lib/api_base_rest/client/dio_client.dart"
    click Cache "https://github.com/Solvro/mobile-topwr/tree/main/lib/api_base/cache/"
    click iParking "https://github.com/Solvro/mobile-topwr/blob/main/lib/features/parkings_view/api_client/iparking_client.dart"
    click SKS "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/sks-menu/"
    click DigitalGuide "https://github.com/Solvro/mobile-topwr/tree/main/lib/features/digital_guide_view/"
    click Firebase "https://github.com/Solvro/mobile-topwr/blob/main/lib/firebase_options.dart"
    click ThemeConfig "https://github.com/Solvro/mobile-topwr/tree/main/lib/theme/"
    click Router "https://github.com/Solvro/mobile-topwr/blob/main/lib/features/navigator/app_router.dart"
    click Navigation "https://github.com/Solvro/mobile-topwr/blob/main/lib/features/navigator/navigation_controller.dart"
    click CommonWidgets "https://github.com/Solvro/mobile-topwr/tree/main/lib/widgets/"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        APIComp["API Component"]:::api
        ExternalComp["External Service"]:::external
        InfraComp["Infrastructure"]:::infrastructure
    end
```
