# sangariusss/events architecture

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

- Interactive diagram: https://gitdiagram.com/sangariusss/events
- Repository: https://github.com/sangariusss/events

## Overview

##### Project type and purpose
- This is a single-module Android mobile application (“Events”) for event creation, management, and sharing.
- It follows a client-only architecture that relies on Supabase (hosted) for authentication and remote data, and Room for local persistence.
- The codebase is organized around an MVVM pattern with clear separation of UI, ViewModels, repository/data layers, and external service clients.

##### File structure
- Top-level:
- app/ – Android Gradle module
- build scripts (build.gradle.kts, settings.gradle.kts, gradle-wrapper, etc.)
- app/src/main/java/com/komiker/events/
- ui/activities & ui/fragments – Presentation layer
- viewmodels – MVVM ViewModel layer
- data/repository – Repository interfaces and implementations
- data/database – Room database (AppDatabase, DAOs, Entities, TypeConverters)
- services/auth – Supabase and social login managers (Google, Facebook, Twitter)
- glide – Custom image transformations
- app/src/main/res – UI resources (layouts, drawables, navigation graph, animations)
- Configuration: AndroidManifest.xml, proguard rules, dotenv (.env) for Supabase keys.

##### Key insights from the README
- Uses Kotlin, Android SDK, Jetpack Navigation, Ktor for HTTP calls, Supabase client for auth and data, Glide for images, Lottie for animations.
- Features include multiple social/E-mail auth, event CRUD, filtering, profile management, error screens.

a. Main components
1) Presentation Layer
– Activities & Fragments
– UI Widgets, Navigation Graph
2) ViewModel Layer
– CreateEventViewModel, ProfileViewModel, etc.
3) Domain/Data Layer
– Repositories (LocationRepository, TagRepository, UserRepository)
– Data sources:
- Local: Room Database (DAOs, Entities, Converters)
- Remote: SupabaseClientProvider via Ktor HTTP client
4) External Services
– Supabase Auth & Database
– Social Identity Providers (Google, Facebook, Twitter via Google Play Services / OAuth)
– Third-party libraries: Glide, Lottie

b. Relationships and data flow
- UI → observes → ViewModel
- ViewModel → invokes → Repository
- Repository → delegates to → LocalDataSource (Room) and/or RemoteDataSource (Supabase via Ktor)
- RemoteDataSource → HTTP calls → Supabase REST API
- Auth flows: UI triggers SocialAuthManager → Supabase Auth → returns token → stored for subsequent requests
- Local cache: Repository writes to Room for offline use; DAO queries feed UI.

c. Architectural patterns & design principles
- MVVM: clear separation of concerns, testable ViewModels
- Repository pattern: abstracts data operations and caching
- Single Source of Truth: Room database backed by remote Supabase
- Dependency Injection (manual or via provider classes e.g., SupabaseClientProvider)
- Unidirectional data flow: UI ← LiveData/Flow ← ViewModel ← Repository ← DataSource

d. Key technologies & frameworks
- Kotlin + Coroutines/Flows
- Android Jetpack: Room, Lifecycle, Navigation, ViewModel
- Ktor HTTP client
- Supabase Kotlin client
- Glide for image loading
- Lottie for animations
- Google Play Services for location and social sign-in

## Diagram (Mermaid)

```mermaid
graph TB
    %% UI Layer
    subgraph "UI Layer"
        A["Activities"]:::ui
        B["Fragments"]:::ui
        C["Adapters"]:::ui
    end

    %% ViewModel Layer
    subgraph "ViewModel Layer"
        D["ViewModels"]:::vm
    end

    %% Data/Repository Layer
    subgraph "Data/Repository Layer"
        E["Repositories"]:::repo
        subgraph "Local Data Source"
            F[(AppDatabase)]:::db
            G["DAOs"]:::db
            H["Entities"]:::db
            I["Converters"]:::db
        end
        J["SupabaseClientProvider"]:::repo
    end

    %% External Services
    subgraph "External Services"
        K[/"Supabase Auth & Database"/]:::ext
        L["SocialAuthManagers"]:::ext
        M["Glide Transformations"]:::ext
    end

    %% Connections
    A -->|"observes"| D
    B -->|"observes"| D
    D -->|"calls fetchEvents()"| E
    E -->|"getFromDb()"| F
    E -->|"fetchRemote()"| J
    J -->|"HTTP calls"| K
    L -->|"auth flow"| K
    A -->|"image loading"| M

    %% Click Events
    click A "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/ui/activities"
    click B "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/ui/fragments"
    click C "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/ui/adapters"
    click D "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/viewmodels"
    click E "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/data/repository"
    click F "https://github.com/sangariusss/events/blob/main/app/src/main/java/com/komiker/events/data/database/AppDatabase.kt"
    click G "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/data/database/dao"
    click H "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/data/database/entities"
    click I "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/data/database/converters"
    click J "https://github.com/sangariusss/events/blob/main/app/src/main/java/com/komiker/events/data/database/SupabaseClientProvider.kt"
    click L "https://github.com/sangariusss/events/tree/main/app/src/main/java/com/komiker/events/services/auth"
    click M "https://github.com/sangariusss/events/blob/main/app/src/main/java/com/komiker/events/glide/CircleCropTransformation.kt"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef vm fill:#90EE90,stroke:#333,stroke-width:1px
    classDef repo fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef db fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef ext fill:#FFA500,stroke:#333,stroke-width:1px
```
