# project-unifest/unifest-android architecture

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

- Interactive diagram: https://gitdiagram.com/project-unifest/unifest-android
- Repository: https://github.com/project-unifest/unifest-android

## Overview

##### High-level system type and purpose
- Type: Native Android application (Jetpack Compose, Kotlin)
- Purpose: Display university festival maps, allow stamping/liking booths, manage onboarding & settings, and integrate with Firebase & REST backend.

##### Main architectural layers and modules
A. Presentation (UI & Feature Layers)
- app module: application entry point (UnifestApplication, Hilt setup, service initializers, manifest)
- feature/* modules: UI screens, navigation, viewmodels for each use case (intro, splash, main, home, booth, festival, map, menu, stamp, waiting, liked-booth, navigator)
- core/ui & core/designsystem: shared Compose components, themes, drawables

B. Domain / Common Layer
- core/common: cross-cutting utilities (error handling, permission dialogs, events, UI text abstraction)
- core/model: plain Kotlin data models (BoothModel, FestivalModel, etc.)
- core/navigation: route definitions and navigation abstractions

C. Data Layer
1. Remote API
- core/network: Retrofit service (UnifestService), request/response models, network DI
- core/data/api: API-facing repository interfaces & data sources
- core/data/impl: default implementations of data sources & repositories, mappers from network entities to models, DI modules (FirebaseModule, RepositoryModule)
2. Local Persistence
- core/database: Room databases & DAOs (LikedBoothDatabase, LikedFestivalDatabase), type converters, DI modules
- core/datastore: DataStore interfaces for onboarding, tokens, settings, recent liked festivals; implementations & DI modules

D. Build & Tooling
- build-logic: custom Gradle convention plugins to standardize module configurations (AndroidApplicationComposePlugin, AndroidLibraryPlugin, Retrofit, Hilt, Room conventions, etc.)
- baselineprofile: generates startup & baseline profiles to optimize cold-start performance
- gradle/libs.versions.toml: centralized library versions

##### Relationships and data flows
- app → feature modules (via Hilt injection, navigation delegates)
- feature modules → core/ui + core/common for shared UI & utils
- feature viewmodels → core/data/api repositories (interfaces)
- core/data/api ← (via Hilt DI) ← core/data/impl (Default…Repository)
- core/data/impl → core/network (Retrofit) + core/datastore + core/database
- core/network ↔ external REST backend
- core/datastore ↔ Android DataStore (local preferences)
- core/database ↔ SQLite (Room)
- UnifestApplication initializers → Firebase Crashlytics & Messaging

##### Architectural patterns
- Modularization: each feature in its own Gradle module
- Clean separation of concerns: UI (Compose) / Domain (models & common) / Data (repositories, persistence)
- Dependency Injection: Dagger Hilt across all layers
- Convention-over-configuration: build-logic plugins enforce consistent Gradle setups
- Compose Navigation: type-safe, nested navigation in feature and core/navigation modules

##### Final checklist
– Note the build-logic layer separately to highlight standardized Gradle conventions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UnifestApplication["UnifestApplication"]:::presentation
        subgraph "Feature Modules"
            direction TB
            IntroScreen["IntroScreen"]:::presentation
            MainScreen["MainScreen"]:::presentation
            BoothDetailScreen["BoothDetailScreen"]:::presentation
            MapScreen["MapScreen"]:::presentation
            StampScreen["StampScreen"]:::presentation
        end
        CrashInit["FirebaseCrashlyticsInitializer"]:::presentation
        MsgInit["FirebaseMessagingInitializer"]:::presentation
        TimberInit["TimberInitializer"]:::presentation
        CoreUI["BoothFilterChips (core/ui)"]:::presentation
        CoreDesign["Button (core/designsystem)"]:::presentation
    end

    %% Domain/Common Layer
    subgraph "Domain/Common Layer"
        direction TB
        HandleException["HandleException"]:::domain
        BoothModel["BoothModel"]:::domain
        RouteModel["RouteModel"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        subgraph "Network"
            direction TB
            UnifestService["UnifestService"]:::data
            ApiModule["ApiModule"]:::data
        end
        BoothRepository["BoothRepository (API)"]:::data
        subgraph "Impl"
            direction TB
            DefaultBoothRepository["DefaultBoothRepository"]:::data
            BoothEntityMapper["BoothEntityMapper"]:::data
            RepositoryModule["RepositoryModule"]:::data
        end
        subgraph "Database"
            direction TB
            LikedBoothDao["LikedBoothDao"]:::data
            LikedBoothDatabase["LikedBoothDatabase"]:::data
            DatabaseModule["DatabaseModule"]:::data
        end
        subgraph "DataStore"
            direction TB
            OnboardingDataSource["OnboardingDataSource"]:::data
            DefaultOnboardingDataSource["DefaultOnboardingDataSource"]:::data
            DataStoreModule["DataStoreModule"]:::data
        end
    end

    %% Build & Tooling
    subgraph "Build & Tooling"
        direction TB
        BuildLogic["AndroidApplicationComposeConventionPlugin"]:::tooling
        BaselineProfileGenerator["BaselineProfileGenerator"]:::tooling
        VersionCatalog["libs.versions.toml"]:::tooling
    end

    %% External Services
    RESTAPI["REST Backend"]:::external
    FirebaseCrashlytics["Firebase Crashlytics"]:::external
    FirebaseMessaging["Firebase Messaging"]:::external
    AndroidDataStore["Android DataStore"]:::external
    SQLite["SQLite (Room)"]:::external

    %% Relationships
    UnifestApplication --> CrashInit
    UnifestApplication --> MsgInit
    UnifestApplication --> TimberInit
    UnifestApplication --> IntroScreen
    CrashInit --> FirebaseCrashlytics
    MsgInit --> FirebaseMessaging

    IntroScreen -->|"uses"|BoothRepository
    MainScreen -->|"uses"|BoothRepository
    BoothDetailScreen -->|"uses"|BoothRepository
    MapScreen -->|"uses"|BoothRepository
    StampScreen -->|"uses"|BoothRepository

    BoothRepository -->|"implemented by"|DefaultBoothRepository
    DefaultBoothRepository -->|"maps with"|BoothEntityMapper
    DefaultBoothRepository -->|"calls"|UnifestService
    DefaultBoothRepository -->|"persists"|LikedBoothDatabase
    DefaultBoothRepository -->|"stores prefs in"|OnboardingDataSource

    UnifestService -->|"fetches"|RESTAPI
    OnboardingDataSource -->|"uses"|AndroidDataStore
    LikedBoothDatabase -->|"uses"|SQLite

    %% Hilt DI
    UnifestApplication -->|"provides Hilt"|RepositoryModule
    RepositoryModule --> DefaultBoothRepository
    DataStoreModule --> OnboardingDataSource
    DatabaseModule --> LikedBoothDatabase
    ApiModule --> UnifestService

    %% Click Events
    click UnifestApplication "https://github.com/project-unifest/unifest-android/blob/develop/app/src/main/kotlin/com/unifest/android/UnifestApplication.kt"
    click CrashInit "https://github.com/project-unifest/unifest-android/blob/develop/app/src/main/kotlin/com/unifest/android/initializer/FirebaseCrashlyticsInitializer.kt"
    click MsgInit "https://github.com/project-unifest/unifest-android/blob/develop/app/src/main/kotlin/com/unifest/android/initializer/FirebaseMessagingInitializer.kt"
    click TimberInit "https://github.com/project-unifest/unifest-android/blob/develop/app/src/main/kotlin/com/unifest/android/initializer/TimberInitializer.kt"
    click IntroScreen "https://github.com/project-unifest/unifest-android/blob/develop/feature/intro/src/main/kotlin/com/unifest/android/feature/intro/IntroScreen.kt"
    click MainScreen "https://github.com/project-unifest/unifest-android/blob/develop/feature/main/src/main/kotlin/com/unifest/android/feature/main/MainScreen.kt"
    click BoothDetailScreen "https://github.com/project-unifest/unifest-android/blob/develop/feature/booth/src/main/kotlin/com/unifest/android/feature/booth/BoothDetailScreen.kt"
    click MapScreen "https://github.com/project-unifest/unifest-android/blob/develop/feature/map/src/main/kotlin/com/unifest/android/feature/map/MapScreen.kt"
    click StampScreen "https://github.com/project-unifest/unifest-android/blob/develop/feature/stamp/src/main/kotlin/com/unifest/android/feature/stamp/StampScreen.kt"
    click CoreUI "https://github.com/project-unifest/unifest-android/blob/develop/core/ui/src/main/kotlin/com/unifest/android/core/ui/component/BoothFilterChips.kt"
    click CoreDesign "https://github.com/project-unifest/unifest-android/blob/develop/core/designsystem/src/main/kotlin/com/unifest/android/core/designsystem/component/Button.kt"
    click HandleException "https://github.com/project-unifest/unifest-android/blob/develop/core/common/src/main/kotlin/com/unifest/android/core/common/HandleException.kt"
    click BoothModel "https://github.com/project-unifest/unifest-android/blob/develop/core/model/src/main/kotlin/com/unifest/android/core/model/BoothModel.kt"
    click RouteModel "https://github.com/project-unifest/unifest-android/blob/develop/core/navigation/src/main/kotlin/com/unifest/android/core/navigation/RouteModel.kt"
    click UnifestService "https://github.com/project-unifest/unifest-android/blob/develop/core/network/src/main/kotlin/com/unifest/android/core/network/service/UnifestService.kt"
    click ApiModule "https://github.com/project-unifest/unifest-android/blob/develop/core/network/src/main/kotlin/com/unifest/android/core/network/di/ApiModule.kt"
    click BoothRepository "https://github.com/project-unifest/unifest-android/blob/develop/core/data/api/src/main/kotlin/com/unifest/android/core/data/api/repository/BoothRepository.kt"
    click DefaultBoothRepository "https://github.com/project-unifest/unifest-android/blob/develop/core/data/impl/src/main/kotlin/com/unifest/android/core/data/impl/repository/DefaultBoothRepository.kt"
    click BoothEntityMapper "https://github.com/project-unifest/unifest-android/blob/develop/core/data/impl/src/main/kotlin/com/unifest/android/core/data/mapper/BoothEntityMapper.kt"
    click RepositoryModule "https://github.com/project-unifest/unifest-android/blob/develop/core/data/impl/src/main/kotlin/com/unifest/android/core/data/di/RepositoryModule.kt"
    click LikedBoothDao "https://github.com/project-unifest/unifest-android/blob/develop/core/database/src/main/kotlin/com/unifest/android/core/database/LikedBoothDao.kt"
    click LikedBoothDatabase "https://github.com/project-unifest/unifest-android/blob/develop/core/database/src/main/kotlin/com/unifest/android/core/database/LikedBoothDatabase.kt"
    click DatabaseModule "https://github.com/project-unifest/unifest-android/blob/develop/core/database/src/main/kotlin/com/unifest/android/core/database/di/DatabaseModule.kt"
    click OnboardingDataSource "https://github.com/project-unifest/unifest-android/blob/develop/core/datastore/api/src/main/kotlin/com/unifest/android/core/datastore/api/OnboardingDataSource.kt"
    click DefaultOnboardingDataSource "https://github.com/project-unifest/unifest-android/blob/develop/core/datastore/impl/src/main/kotlin/com/unifest/android/core/datastore/impl/DefaultOnboardingDataSource.kt"
    click DataStoreModule "https://github.com/project-unifest/unifest-android/blob/develop/core/datastore/impl/src/main/kotlin/com/unifest/android/core/datastore/impl/di/DataStoreModule.kt"
    click BuildLogic "https://github.com/project-unifest/unifest-android/blob/develop/build-logic/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt"
    click BaselineProfileGenerator "https://github.com/project-unifest/unifest-android/blob/develop/baselineprofile/src/main/kotlin/com/unifest/android/baselineprofile/BaselineProfileGenerator.kt"
    click VersionCatalog "https://github.com/project-unifest/unifest-android/blob/develop/gradle/libs.versions.toml"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef domain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef tooling fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#EFEFEF,stroke:#666,stroke-dasharray:5 5
    class UnifestApplication,CrashInit,MsgInit,TimberInit,IntroScreen,MainScreen,BoothDetailScreen,MapScreen,StampScreen,CoreUI,CoreDesign presentation
    class HandleException,BoothModel,RouteModel domain
    class UnifestService,ApiModule,BoothRepository,DefaultBoothRepository,BoothEntityMapper,RepositoryModule,LikedBoothDao,LikedBoothDatabase,DatabaseModule,OnboardingDataSource,DefaultOnboardingDataSource,DataStoreModule data
    class BuildLogic,BaselineProfileGenerator,VersionCatalog tooling
    class RESTAPI,FirebaseCrashlytics,FirebaseMessaging,AndroidDataStore,SQLite external
```
