# blastblastblast/soar architecture

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

- Interactive diagram: https://gitdiagram.com/blastblastblast/soar
- Repository: https://github.com/blastblastblast/soar

## Overview

##### Project type and purpose
- SOAR is a native Android full-stack application (mobile client) whose goal is to help small-scale rocketry teams by:
- Managing launch sites on a Mapbox map
- Fetching and evaluating MET weather data (Locationforecast, GRIB2, Sunrise/Sunset)
- Simulating 3D rocket flight trajectories based on user-configured parameters

##### File structure
- Single Gradle “app” module containing:
- src/main/java/no/uio/ifi/in2000/met2025/data  ⇒ data layer
– local/… (Room database, DAOs, preferences, repositories)
– remote/… (Ktor HTTP sources & repositories)
– models/… (API & domain models)
- src/main/java/no/uio/ifi/in2000/met2025/domain  ⇒ domain layer
– business logic (interpolators, trajectory calc, weather model)
- src/main/java/no/uio/ifi/in2000/met2025/di  ⇒ Hilt modules for dependency injection
- src/main/java/no/uio/ifi/in2000/met2025/ui  ⇒ UI layer
– common components, navigation, Compose screens & view models
- assets (3D .glb models), res (Drawables, layout values, Mapbox token)
- Gradle scripts (build.gradle.kts, settings.gradle.kts), KSP annotation processing, Hilt, Ktor, Room

##### README for technical stack
- Kotlin + Jetpack Compose (UI)
- Dagger-Hilt (DI)
- Ktor HTTP client (networking)
- Mapbox Android SDK + Turf (map & geospatial tools)
- Room (local DB)
- Coil (image loading)
- External APIs: MET Locationforecast, GRIB2, Sunrise/Sunset

##### Components
a. Main components
- UI Layer (Jetpack Compose screens & ViewModels)
- Domain Layer (Interpolate, calculate trajectories, weather evaluation)
- Data Layer
– Local Data Source (Room database + UserPreferences)
– Remote Data Source (Ktor clients to MET APIs)
- Dependency Injection Container (Hilt)
- External Services
– MET Locationforecast API
– MET Isobaric GRIB2 API
– MET Sunrise/Sunset API
– Mapbox SDK (Map & Turf)
- Assets (3D rocket models .glb)
b. Relationships & interactions
- UI → ViewModel (state + events)
- ViewModel → Domain use-cases (injected via Hilt)
- Domain → Repository interfaces
- Repositories → LocalDataSource (Room) OR RemoteDataSource (Ktor)
- RemoteDataSource ↔ External MET APIs
- UI ↔ Mapbox SDK (through injected Mapbox client)
- DI container wires all dependencies
- Assets loaded by UI (3D viewer component)
c. Architectural patterns
- MVVM (UI ↔ ViewModel ↔ Domain)
- Clean separation: UI / Domain / Data
- Repository pattern (abstract data sources)
- Dependency Injection (Hilt modules)
d. Key technologies
- Jetpack Compose, ViewModel, LiveData/StateFlow
- Room (Database, DAO)
- Ktor (HTTP client)
- Mapbox Android SDK + Turf
- Dagger-Hilt (AppModule)

##### Essential elements
- Component names (UI screens, ViewModels, use-cases, repositories, data sources)
- External service endpoints and SDKs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        navComp["Navigation Components"]:::ui
        mapScreen["MapScreen"]:::ui
        mapVM["MapScreenViewModel"]:::ui
        weatherScreen["WeatherScreen"]:::ui
        weatherVM["WeatherViewModel"]:::ui
        launchSiteScreen["LaunchSiteScreen"]:::ui
        launchSiteVM["LaunchSiteViewModel"]:::ui
        rocketConfig["RocketConfig Screens"]:::ui
        weatherConfig["WeatherConfig Screens"]:::ui
        configVM["ConfigViewModel"]:::ui
        ui3DViewer["3D Viewer"]:::ui
    end

    %% Domain Layer
    subgraph "Domain Layer"
        isoInterp["IsobaricInterpolator"]:::domain
        trajCalc["TrajectoryCalculator"]:::domain
        weatherModel["WeatherModel"]:::domain
    end

    %% Data Local
    subgraph "Data Layer - Local" 
        db["Database"]:::dlocal
        dao["DAO"]:::dlocal
        launchSiteRepo["LaunchSiteRepository"]:::dlocal
        rocketConfigRepo["RocketConfigRepository"]:::dlocal
        weatherConfigRepo["WeatherConfigRepository"]:::dlocal
        userPrefs["UserPreferences"]:::dlocal
    end

    %% Data Remote
    subgraph "Data Layer - Remote"
        locForecastDS["LocationForecastDataSource"]:::dremote
        locForecastRepo["LocationForecastRepository"]:::dremote
        isobaricDS["IsobaricDataSource"]:::dremote
        isobaricRepo["IsobaricRepository"]:::dremote
        sunriseDS["SunriseDataSource"]:::dremote
        sunriseRepo["SunriseRepository"]:::dremote
    end

    %% DI Container
    diContainer["Hilt DI Container"]:::di

    %% External Services
    subgraph "External Services"
        metLF["MET Locationforecast API"]:::external
        metGRIB["MET Isobaric GRIB2 API"]:::external
        metSunrise["MET Sunrise/Sunset API"]:::external
        mapboxSDK["Mapbox SDK + Turf"]:::external
    end

    %% Assets
    assets["3D Rocket Models (.glb)"]:::external

    %% UI to VM
    navComp -->|navigates| mapScreen
    mapScreen -->|uses| mapVM
    weatherScreen -->|uses| weatherVM
    launchSiteScreen -->|uses| launchSiteVM
    rocketConfig -->|uses| configVM
    weatherConfig -->|uses| configVM
    ui3DViewer -->|renders| assets

    %% UI to Mapbox
    mapScreen -->|renders map| mapboxSDK
    mapVM -->|loads assets| ui3DViewer

    %% VM to Domain
    mapVM -->|calls| isoInterp
    mapVM -->|calls| trajCalc
    weatherVM -->|calls| weatherModel
    launchSiteVM -->|calls| weatherModel
    configVM -->|calls| trajCalc

    %% Domain to Repositories
    isoInterp -->|depends on| locForecastRepo
    trajCalc -->|depends on| launchSiteRepo
    trajCalc -->|depends on| rocketConfigRepo
    weatherModel -->|depends on| locForecastRepo
    weatherModel -->|depends on| isobaricRepo
    weatherModel -->|depends on| sunriseRepo

    %% Repositories to DataSources / DB
    launchSiteRepo -->|uses| db
    launchSiteRepo -->|uses| dao
    rocketConfigRepo -->|uses| db
    rocketConfigRepo -->|uses| dao
    weatherConfigRepo -->|uses| userPrefs
    locForecastRepo -->|uses| locForecastDS
    isobaricRepo -->|uses| isobaricDS
    sunriseRepo -->|uses| sunriseDS

    %% DataSources to External APIs
    locForecastDS -->|HTTP| metLF
    isobaricDS -->|HTTP| metGRIB
    sunriseDS -->|HTTP| metSunrise

    %% DI injections
    diContainer --> mapVM
    diContainer --> weatherVM
    diContainer --> launchSiteVM
    diContainer --> configVM
    diContainer --> isoInterp
    diContainer --> trajCalc
    diContainer --> weatherModel
    diContainer --> launchSiteRepo
    diContainer --> rocketConfigRepo
    diContainer --> weatherConfigRepo
    diContainer --> locForecastDS
    diContainer --> isobaricDS
    diContainer --> sunriseDS
    diContainer --> db
    diContainer --> userPrefs
    diContainer --> mapboxSDK

    %% Click Events
    click navComp "https://github.com/blastblastblast/soar/tree/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/navigation"
    click mapScreen "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/mapScreen/MapScreen.kt"
    click mapVM "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/mapScreen/MapScreenViewModel.kt"
    click weatherScreen "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/weatherScreen/WeatherScreen.kt"
    click weatherVM "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/weatherScreen/WeatherViewModel.kt"
    click launchSiteScreen "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/launchSiteScreen/LaunchSiteScreen.kt"
    click launchSiteVM "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/launchSiteScreen/LaunchSiteViewModel.kt"
    click rocketConfig "https://github.com/blastblastblast/soar/tree/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/config/rocketConfig"
    click weatherConfig "https://github.com/blastblastblast/soar/tree/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/config/weatherConfig"
    click configVM "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/ui/screens/config/ConfigViewModel.kt"
    click isoInterp "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/domain/IsobaricInterpolator.kt"
    click trajCalc "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/domain/TrajectoryCalculator.kt"
    click weatherModel "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/domain/WeatherModel.kt"
    click db "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/local/database/Database.kt"
    click dao "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/local/database/DAO.kt"
    click launchSiteRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/local/launchsites/LaunchSiteRepository.kt"
    click rocketConfigRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/local/rocketconfig/RocketConfigRepository.kt"
    click weatherConfigRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/local/configprofiles/WeatherConfigRepository.kt"
    click userPrefs "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/UserPreferences.kt"
    click locForecastDS "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/forecast/LocationForecastDataSource.kt"
    click locForecastRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/forecast/LocationForecastRepository.kt"
    click isobaricDS "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/isobaric/IsobaricDataSource.kt"
    click isobaricRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/isobaric/IsobaricRepository.kt"
    click sunriseDS "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/sunrise/SunriseDataSource.kt"
    click sunriseRepo "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/data/remote/sunrise/SunriseRepository.kt"
    click diContainer "https://github.com/blastblastblast/soar/blob/main/app/src/main/java/no/uio/ifi/in2000/met2025/di/AppModule.kt"
    click assets "https://github.com/blastblastblast/soar/blob/main/app/src/main/assets/Rocket.glb"
    click mapboxSDK "https://github.com/blastblastblast/soar/blob/main/app/src/main/res/values/mapbox_access_token.xml"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#0288D1,stroke-width:1px
    classDef domain fill:#E8F5E9,stroke:#388E3C,stroke-width:1px
    classDef dlocal fill:#FFF9C4,stroke:#FBC02D,stroke-width:1px
    classDef dremote fill:#FFE0B2,stroke:#EF6C00,stroke-width:1px
    classDef di fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
    classDef external fill:#CFD8DC,stroke:#607D8B,stroke-width:1px
```
