# falconslayer51/whatsapp_ui architecture

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

- Interactive diagram: https://gitdiagram.com/falconslayer51/whatsapp_ui
- Repository: https://github.com/falconslayer51/whatsapp_ui

## Overview

##### Main Components

a. Client-Side (Mobile App):
- Present this as the top layer with separate modules for:
- Authentication Module
- Chat Module
- Status Module
- Calls Module
- Contact Selection Module
- Layout Management (Mobile/Web Responsive)

b. Backend Services:
- Firebase Services (evident from firebase_options.dart and google-services.json):
- Authentication Service
- Real-time Database/Firestore
- Firebase Storage
- Cloud Functions (if any)

c. External Services:
- Agora (for video/voice calls, indicated by agora_config.dart)

##### Architecture Patterns to Highlight

The project follows a clean architecture pattern with:
- Feature-based modular architecture
- MVC+Repository pattern within each feature
- Provider pattern for state management

**┌─ UI Layer ─────────────────────────────────────┐**
- Mobile Layout │ Web Layout │ Responsive Layout  │
- Feature Modules ─────────────────────────────┐ │
- ┌─────────┐ ┌───────┐ ┌─────────┐ ┌────────┐ │ │
- Auth   │ │ Chat  │ │ Status  │ │ Calls  │ │ │
- ┘ └───────┘ └─────────┘ └────────┘ │ │
- Controllers/Providers ───────────────────────┐ │
- Repositories ─────────────────────────────────┤
- External Services ──────────────────────────────┤
- Firebase Services │ Agora Services              │
- ┘

##### Important Details

a. For each feature module, show:
- Screens
- Controllers
- Repositories
- Models
- Widgets

b. Data flow indicators:
- User interaction flows
- API calls
- State management flow
- Storage operations

##### Specific Implementation Notes

Clear separation between:
- Authentication flow (login_screen → otp_screen → user_info_screen)
- Chat feature (mobile_chat_screen, chat_list, message handling)
- Status feature (status creation and viewing flow)
- Calls feature (voice and video call handling)

##### Cross-Cutting Concerns

Common components:
- Error handling
- Loading states
- File storage
- Shared widgets
- Utilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef feature fill:#2ecc71,stroke:#27ae60,color:white
    classDef controller fill:#e67e22,stroke:#d35400,color:white
    classDef repository fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef common fill:#95a5a6,stroke:#7f8c8d,color:white

    %% UI Layer
    subgraph UILayer
        Layout["Layout Management"]
        MobileLayout["Mobile Layout"]
        WebLayout["Web Layout"]
        ResponsiveLayout["Responsive Layout"]
        
        Layout --> MobileLayout
        Layout --> WebLayout
        Layout --> ResponsiveLayout
    end

    %% Feature Modules
    subgraph FeatureModules
        %% Auth Feature
        AuthModule["Authentication Module"]
        LoginScreen["Login Screen"]
        OTPScreen["OTP Screen"]
        UserInfoScreen["User Info Screen"]
        AuthController["Auth Controller"]
        
        AuthModule --> LoginScreen
        AuthModule --> OTPScreen
        AuthModule --> UserInfoScreen
        AuthModule --> AuthController

        %% Chat Feature
        ChatModule["Chat Module"]
        ChatScreen["Mobile Chat Screen"]
        ChatController["Chat Controller"]
        ChatWidgets["Chat Widgets"]
        
        ChatModule --> ChatScreen
        ChatModule --> ChatController
        ChatModule --> ChatWidgets

        %% Status Feature
        StatusModule["Status Module"]
        StatusController["Status Controller"]
        StatusScreens["Status Screens"]
        
        StatusModule --> StatusController
        StatusModule --> StatusScreens

        %% Calls Feature
        CallsModule["Calls Module"]
        CallController["Call Controller"]
        CallScreens["Call Screens"]
        
        CallsModule --> CallController
        CallsModule --> CallScreens

        %% Contact Selection
        ContactModule["Contact Selection Module"]
        ContactController["Contact Controller"]
        ContactScreen["Select Contacts Screen"]
        
        ContactModule --> ContactController
        ContactModule --> ContactScreen
    end

    %% Common Components
    subgraph CommonComponents
        CommonWidgets["Common Widgets"]
        FirebaseStorage["Firebase Storage Repository"]
        MessageProvider["Message Reply Provider"]
    end

    %% Data Models
    subgraph DataModels
        CallModel["Call Model"]
        ChatModel["Chat Contact Model"]
        MessageModel["Message Model"]
        StatusModel["Status Model"]
        UserModel["User Model"]
    end

    %% External Services
    subgraph ExternalServices
        Firebase["Firebase Services"]
        AgoraService["Agora Service"]
        FirebaseConfig["Firebase Config"]
        AgoraConfig["Agora Config"]
        
        Firebase --> FirebaseConfig
        AgoraService --> AgoraConfig
    end

    %% Relationships
    UILayer --> FeatureModules
    FeatureModules --> CommonComponents
    FeatureModules --> ExternalServices
    FeatureModules --> DataModels

    %% Click events for component mapping
    click AuthModule "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/auth/"
    click AuthController "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/auth/controller/authcontroller.dart"
    click LoginScreen "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/auth/screens/login_screen.dart"
    click OTPScreen "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/auth/screens/otp_screen.dart"
    click UserInfoScreen "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/auth/screens/user_info_screen.dart"
    click ChatModule "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/chat/"
    click ChatController "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/chat/controller/chat_controller.dart"
    click ChatScreen "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/chat/screens/mobile_chat_screen.dart"
    click ChatWidgets "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/chat/widgets/"
    click StatusModule "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/status/"
    click StatusController "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/status/controller/status_controller.dart"
    click StatusScreens "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/status/screens/"
    click CallsModule "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/calls/"
    click CallController "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/calls/controller/call_controller.dart"
    click CallScreens "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/calls/screens/"
    click ContactModule "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/features/select_contacts/"
    click ContactController "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/select_contacts/controller/select_contacts_controller.dart"
    click ContactScreen "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/features/select_contacts/screens/select_contacts_screen.dart"
    click MobileLayout "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/screens/mobile_layout_screen.dart"
    click WebLayout "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/screens/web_layout_screen.dart"
    click ResponsiveLayout "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/utils/responsive_layout.dart"
    click AgoraConfig "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/config/agora_config.dart"
    click FirebaseConfig "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/firebase_options.dart"
    click CallModel "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/models/call.dart"
    click ChatModel "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/models/chat_contact.dart"
    click MessageModel "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/models/message.dart"
    click StatusModel "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/models/status_model.dart"
    click UserModel "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/models/userModel.dart"
    click CommonWidgets "https://github.com/FalconSlayer51/whatsapp_ui/tree/main/lib/common/widgets/"
    click FirebaseStorage "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/common/repositories/common_firebase_storage_repos.dart"
    click MessageProvider "https://github.com/FalconSlayer51/whatsapp_ui/blob/main/lib/common/provider/message_reply_provider.dart"
```
