# sumit-22/chit-chat architecture

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

- Interactive diagram: https://gitdiagram.com/sumit-22/chit-chat
- Repository: https://github.com/sumit-22/chit-chat

## Overview

##### Project Type & Purpose
- Type: Single-module Android mobile application
- Purpose: Real-time chat client (Chit-Chat) with screens for login, signup, chat list, single chat, statuses, and user profile.
- Key technologies (inferred from file tree and google-services.json):
– Android SDK, Jetpack Compose for UI
– Hilt for Dependency Injection
– MVVM architectural pattern (ViewModels + Composables)
– Firebase services (Authentication, Firestore/Realtime Database, Cloud Messaging)

##### File Structure & Architectural Patterns
Top-Level:
- app/ : Android application module
– build.gradle.kts, google-services.json → configures Firebase
– src/main/java/com/example/chatsphere/
- LCApplication.kt → custom Application class (initializes Hilt)
- HiltModule.kt → DI bindings
- LCViewModel.kt → central ViewModel
- MainActivity.kt → single-Activity entrypoint
- Screens/ → Compose UI screens
- data/ → data types, constants, event definitions
- ui/theme/ → theming resources
– src/main/res/ → drawables, layouts, themes, XML rules
– androidTest, test/ → instrumentation & unit tests

Architectural Pattern:
- MVVM
– View layer: Compose Screens
– ViewModel: LCViewModel injected via Hilt
– Data layer: Repositories (not explicit in file tree but implied in data package) interacting with Firebase

##### Key Components
A. Android App (Single module)
1. UI Layer (Jetpack Compose)
– BottomNavigationMenu
– LoginScreen, SignUpScreen
– ChatListScreen, SingleChatScreen
– StatusScreen, SingleStatusScreen, ProfileScreen
2. Presentation / ViewModel Layer
– LCViewModel
– Hilt injection (HiltModule)
3. Data Layer
– Repository interfaces & implementations (wrap Firebase calls)
– DataTypes.kt, Constants.kt, Event.kt
B. External Services (Firebase)
1. Firebase Authentication
2. Firebase Firestore / Realtime Database
3. Firebase Cloud Messaging (for push notifications)
C. Android Platform
– MainActivity (NavHost for Compose)
– Application class (LCApplication) for Hilt integration
D. Local Resources
– Resources (drawables, themes, strings)

##### Relationships & Interactions
- UI Composables ← (observe LiveData/StateFlow) → LCViewModel
- LCViewModel → (invokes) Repository methods
- Repository → (SDK calls) Firebase Auth / Firestore / Messaging
- Firebase services → (callbacks / listeners) → Repository → LCViewModel → UI
- HiltModule binds Repository and ViewModel into LCApplication

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "UI Layer"
        direction TB
        BNM["BottomNavigationMenu"]:::ui
        Login["LoginScreen"]:::ui
        Signup["SignUpScreen"]:::ui
        ChatList["ChatListScreen"]:::ui
        SingleChat["SingleChatScreen"]:::ui
        Status["StatusScreen"]:::ui
        SingleStatus["SingleStatusScreen"]:::ui
        Profile["ProfileScreen"]:::ui
    end

    subgraph "Theming & UI Utilities"
        direction TB
        Theme["Theme.kt"]:::ui
        ColorPalette["Color.kt"]:::ui
        Typography["Type.kt"]:::ui
        TextFieldShape["CustomTextFieldShape.kt"]:::ui
        Util["Util.kt"]:::ui
    end

    LM["LCViewModel"]:::viewmodel

    subgraph "Data Layer"
        direction TB
        ChatRepo["ChatRepository"]:::data
        AuthRepo["AuthRepository"]:::data
        StatusRepo["StatusRepository"]:::data
        Constants["Constants.kt"]:::data
        DataTypes["DataTypes.kt"]:::data
        Event["Event.kt"]:::data
    end

    subgraph "Firebase Services"
        direction TB
        AuthService["Firebase Authentication"]:::external
        DBService["Firestore / Realtime DB"]:::external
        Messaging["Cloud Messaging"]:::external
    end

    subgraph "Android Framework"
        direction TB
        MainActivity["MainActivity (NavHost)"]:::framework
        App["LCApplication (Hilt init)"]:::framework
        Hilt["HiltModule"]:::viewmodel
    end

    BNM -->|"observes state"| LM
    Login -->|"observes state"| LM
    Signup -->|"observes state"| LM
    ChatList -->|"observes state"| LM
    SingleChat -->|"observes state"| LM
    Status -->|"observes state"| LM
    SingleStatus -->|"observes state"| LM
    Profile -->|"observes state"| LM

    LM -->|"calls"| ChatRepo
    LM -->|"calls"| AuthRepo
    LM -->|"calls"| StatusRepo

    ChatRepo -->|"SDK calls"| DBService
    AuthRepo -->|"SDK calls"| AuthService
    StatusRepo -->|"SDK calls"| DBService

    AuthService -->|"listeners"| AuthRepo
    DBService -->|"listeners"| ChatRepo
    Messaging -->|"push callbacks"| StatusRepo

    App -->|"initializes"| Hilt
    Hilt -->|"injects into"| LM
    Hilt -->|"injects into"| ChatRepo
    Hilt -->|"injects into"| AuthRepo
    Hilt -->|"injects into"| StatusRepo
    MainActivity -->|"hosts"| BNM

    click BNM "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/BottomNavigationMenu.kt"
    click Login "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/LoginScreen.kt"
    click Signup "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/SignUpScreen.kt"
    click ChatList "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/ChatListScreen.kt"
    click SingleChat "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/SingleChatScreen.kt"
    click Status "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/StatusScreen.kt"
    click SingleStatus "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/SingleStatusScreen.kt"
    click Profile "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Screens/ProfileScreen.kt"
    click Theme "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/ui/theme/Theme.kt"
    click ColorPalette "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/ui/theme/Color.kt"
    click Typography "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/ui/theme/Type.kt"
    click TextFieldShape "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/CustomTextFieldShape.kt"
    click Util "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/Util.kt"
    click LM "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/LCViewModel.kt"
    click Hilt "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/HiltModule.kt"
    click MainActivity "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/MainActivity.kt"
    click App "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/LCApplication.kt"
    click Constants "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/data/Constants.kt"
    click DataTypes "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/data/DataTypes.kt"
    click Event "https://github.com/sumit-22/chit-chat/blob/main/app/src/main/java/com/example/chatsphere/data/Event.kt"

    classDef ui fill:#B3E5FC,stroke:#01579B,color:#000;
    classDef viewmodel fill:#C8E6C9,stroke:#1B5E20,color:#000;
    classDef data fill:#FFF9C4,stroke:#F57F17,color:#000;
    classDef external fill:#FFCCBC,stroke:#BF360C,color:#000;
    classDef framework fill:#CFD8DC,stroke:#37474F,color:#000;
```
