# aiyu-ayaan/bit-app architecture

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

- Interactive diagram: https://gitdiagram.com/aiyu-ayaan/bit-app
- Repository: https://github.com/aiyu-ayaan/bit-app

## Overview

##### Project type and purpose
- This is a multi-module Android application (“BIT-App”) targeting BIT Lalpur students.
- It provides ERP access, syllabus browsing, chat, attendance & CGPA management, notifications, theming, and cloud backup.

##### File structure
- Top-level modules:
- bitapp – the main Android app, UI layer & navigation
- chat – a feature module for in-app chat
- syllabus – a feature module for static syllabus display
- core – shared data layer, dependency-injection modules, use-cases, and utilities
- Gradle wrappers & CI configs (.github/workflows) for building, testing, and releasing.
- Documentation in mk-docs (docs folder).

##### README for additional insights
- Confirms mobile focus, Kotlin/Java usage, Material 3 theming, Firebase integration (google-services.json), and a JSON REST API.

a. Main components
- Android App Container
– bitapp (UI + navigation + ViewModels)
– chat module (ChatViewModel, UI screens)
– syllabus module (fragments, JSON assets)
- Core Data Layer
– Dependency-Injection Modules (AppModule, RetrofitModule, RoomModule, FirebaseModule)
– UseCases
– Repositories / NetworkBoundResource
– DataSources:
∙ Room Database (Attendance, Chat, Library, Syllabus tables)
∙ Retrofit Services (BitAppApiService, CollegeNoticeApiService)
∙ Firebase Auth & Firestore & RemoteConfig
∙ DataStore (preferences)
- External Services
– ERP REST endpoints
– Firebase Auth / Firestore / Remote Config
– JSON REST API for notices (bit-lalpur-app.github.io)
- Local resources
– JSON files in syllabus/raw & assets (choose_sem.json etc.)

b. Relationships and interactions
- UI Layers (bitapp/chat/syllabus) → ViewModels → Core UseCases → Core Repositories
- Repositories decide between network (Retrofit/Firebase) vs. local (Room/DataStore) via NetworkBoundResource
- Dependency Injection wires RetrofitModule, RoomModule, FirebaseModule into repositories and use-cases
- Data flows back to UI via LiveData / StateFlows

c. Architectural patterns
- Clean-Architecture / MVVM
- Dependency-Injection (probably using Hilt/Koin via AppModule.kt)
- Repository + UseCase separation
- NetworkBoundResource for offline caching
- Feature modules (chat, syllabus) plugged into host

d. Key technologies & libraries
- Kotlin + Android SDK + Material3 + Jetpack Compose
- Room (androidx.room) for local DB
- Retrofit for REST calls
- Firebase (Auth, Firestore, RemoteConfig)
- DataStore for preferences
- Coroutine + Flow for asynchronous flows
- Gradle Kotlin DSL

##### Detailed capture
- Break core into sub-components:
- RoomDatabase (with DAOs)
- Retrofit services
- Firebase services
- DataStore
- AppModule, FirebaseModule, RoomModule, RetrofitModule
- For bitapp module, emphasize navigation graphs, screen packages, and theme engine.

Putting it all together:
- Nest chat & syllabus modules under “Presentation” and show they depend on core domain.
- Within core, show DI modules at the bottom injecting into repositories, which interact with DataSources.
- External services sit on the far right: ERP API, Firebase, JSON API.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        bitapp["Android App Container"]:::presentation
        chat["Chat Module"]:::presentation
        syllabus["Syllabus Module"]:::presentation
        MainVM["MainViewModel"]:::presentation
        ChatVM["ChatViewModel"]:::presentation
        SubjectFrag["SubjectFragment"]:::presentation
    end

    bitapp -->|uses| MainVM
    chat -->|uses| ChatVM
    syllabus -->|uses| SubjectFrag

    MainVM -->|invoke| UseCases
    ChatVM -->|invoke| UseCases
    SubjectFrag -->|invoke| UseCases

    %% Domain Layer
    subgraph "Domain Layer"
        UseCases["Use Cases"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        Repos["Repositories"]:::data

        subgraph "DI Modules"
            AppMod["AppModule"]:::data
            RetMod["RetrofitModule"]:::data
            RoomMod["RoomModule"]:::data
            FirMod["FirebaseModule"]:::data
        end

        subgraph "Network Utility"
            NBR["NetworkBoundResource"]:::data
        end

        subgraph "Room Database & DAOs"
            DB["BitDatabase"]:::data
            AttDAO["AttendanceDao"]:::data
            ChatDAO["ChatDao"]:::data
            LibDAO["LibraryDao"]:::data
            SylDAO["SyllabusDao"]:::data
        end

        subgraph "Retrofit Services"
            BitAPI["BitAppApiService"]:::data
            NoticeAPI["CollegeNoticeApiService"]:::data
        end

        subgraph "Firebase Services"
            AuthMod["Auth Models"]:::data
            FirestoreMod["Firestore Models"]:::data
            RemoteCfg["RemoteConfigHelper"]:::data
        end

        DataStore["DataStore (Preferences)"]:::data
    end

    UseCases -->|calls| Repos
    Repos -->|injected by| AppMod
    Repos -->|injected by| RetMod
    Repos -->|injected by| RoomMod
    Repos -->|injected by| FirMod

    Repos -->|uses| NBR
    NBR -->|caches| DB
    NBR -->|fetches| BitAPI
    NBR -->|fetches| NoticeAPI
    NBR -->|fetches| AuthMod
    NBR -->|fetches| FirestoreMod
    NBR -->|fetches| RemoteCfg
    NBR -->|stores| DataStore

    DB --> AttDAO
    DB --> ChatDAO
    DB --> LibDAO
    DB --> SylDAO

    %% External Services
    subgraph "External Services"
        ERP["ERP REST API"]:::external
        FirebaseExt["Firebase Auth/Firestore/RemoteConfig"]:::external
        JSONAPI["JSON REST API"]:::external
    end

    BitAPI -->|calls| ERP
    NoticeAPI -->|calls| JSONAPI
    AuthMod -->|connects| FirebaseExt
    FirestoreMod -->|connects| FirebaseExt
    RemoteCfg -->|connects| FirebaseExt

    %% Click Events
    click bitapp "https://github.com/aiyu-ayaan/bit-app/tree/master/bitapp/"
    click chat "https://github.com/aiyu-ayaan/bit-app/tree/master/chat/src/main/java/com/atech/chat/"
    click syllabus "https://github.com/aiyu-ayaan/bit-app/tree/master/syllabus/src/main/java/com/atech/syllabus/"
    click MainVM "https://github.com/aiyu-ayaan/bit-app/blob/master/bitapp/src/main/java/com/atech/bit/ui/activity/main/MainViewModel.kt"
    click ChatVM "https://github.com/aiyu-ayaan/bit-app/blob/master/chat/src/main/java/com/atech/chat/ChatViewModel.kt"
    click SubjectFrag "https://github.com/aiyu-ayaan/bit-app/blob/master/syllabus/src/main/java/com/atech/syllabus/SubjectFragment.kt"
    click UseCases "https://github.com/aiyu-ayaan/bit-app/tree/master/core/src/main/java/com/atech/core/usecase/"
    click NBR "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/utils/NetworkBoundResource.kt"
    click AppMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/module/AppModule.kt"
    click RetMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/module/RetrofitModule.kt"
    click RoomMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/module/RoomModule.kt"
    click FirMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/module/FirebaseModule.kt"
    click DB "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/room/BitDatabase.kt"
    click AttDAO "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/room/attendance/AttendanceDao.kt"
    click ChatDAO "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/room/chat/ChatDao.kt"
    click LibDAO "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/room/library/LibraryDao.kt"
    click SylDAO "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/room/syllabus/SyllabusDao.kt"
    click BitAPI "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/retrofit/BitAppApiService.kt"
    click NoticeAPI "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/retrofit/CollegeNoticeApiService.kt"
    click AuthMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/firebase/auth/Model.kt"
    click FirestoreMod "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/firebase/firestore/Models.kt"
    click RemoteCfg "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/firebase/remote/RemoteConfigHelper.kt"
    click DataStore "https://github.com/aiyu-ayaan/bit-app/blob/master/core/src/main/java/com/atech/core/datasource/datastore/dataStore.kt"

    %% Styles
    classDef presentation fill:#E0F7FA,stroke:#006064
    classDef domain fill:#E8F5E9,stroke:#2E7D32
    classDef data fill:#FFF3E0,stroke:#EF6C00
    classDef external fill:#ECEFF1,stroke:#546E7A
```
