# nam18022001/meotalk-app architecture

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

- Interactive diagram: https://gitdiagram.com/nam18022001/meotalk-app
- Repository: https://github.com/nam18022001/meotalk-app

## Overview

##### Project’s Main Purpose and Type
- This is a full-stack mobile (and complementary web) chat and calling application. Its core functionality revolves around user authentication, real-time chat, video/audio calls, and supporting UI components.
- The README emphasizes installation with Firebase, Expo, and the Agora SDK, so include these as key external services.

##### Major Components
a. Frontend / Mobile Client:
- App Entry Point: Represent the application’s main entry (e.g., index.js, App.js, Landing.js).
- UI Components: Include folders like src/Components (AccountItem, ConverseItem, Modal, ProtectedRoute, Skeleton, GlobalStyles), Views (chat, call, login, friends, profiles), layouts, and routers.
- Presentation Layers: Different views (Chat, Home, Login, NewChat, Friends, Call components like VideoCall, VoiceCall) and their corresponding UI sub-components (Header, Input, Message, etc.).
b. Business Logic:
- Contexts and Hooks: Emphasize state management and business logic with src/contexts (AuthContext, CallContext, etc.) and custom hooks (useAuthContext, useCallContext, etc.).
- Functions & Configs: Also include src/functions (e.g., call logic and hash computations) and src/configs (for Agora, constants, routes) which provide necessary configuration details.
c. External and Integration Services:
- Firebase: Note the necessary files like google-services.json and README instructions for Firebase Cloud services (Firestore, Cloud Storage, Auth).
- Agora: Highlight integration via src/configs/agora.js for video/audio calls.
- Expo & other build configurations: Points such as app.json, metro.config.js, and eas.json are important for deployment and bundling.
d. Assets and Resources:
- Assets: Represent images, fonts, and other static resources (e.g., src/assets) that support the UI.

##### Relationships and Interactions
- User interactions flow from UI components in the Views and Layouts which call into Contexts/States.
- Context Providers (AuthContext, CallContext, etc.) coordinate with Hooks to allow the components to update and reflect real-time data.
- These layers interact with the Services layer that communicates with Firebase and Agora.
- The Routers component (src/routers/index.js) manages screen navigation based on user authentication status (as suggested by ProtectedRoute components).
- The functions and configs are utility and setup blocks that tie together these interactions and external dependencies.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Notice a clear separation between presentation (Components & Views), business logic (Contexts, Hooks, Services), and configuration/integration (Configs, Functions).
- Modular Design: The file structure is modularized by functionality (e.g., separate folders for AccountItem, ConverseItem, etc.).
- Component Reusability: Shared UI components (Skeleton loaders, Modals, Headers) are reused across different views.
- State Management: Use of context and custom hooks indicates a centralized approach to managing authentication and call state.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation/UI Layer
    subgraph "Presentation/UI Layer"
        A["App Entry (App.js / index.js)"]:::presentation
        subgraph "UI Components"
            B["Account Item"]:::presentation
            C["Converse Item"]:::presentation
            D["Modal"]:::presentation
            E["Protected Route"]:::presentation
            F["Skeleton Loaders"]:::presentation
            G["Global Styles"]:::presentation
        end
        subgraph "Views"
            H["Chat View"]:::presentation
            I["Private Chat View"]:::presentation
            J["New Chat View"]:::presentation
            K["New Chat Private"]:::presentation
            L["VideoCall"]:::presentation
            M["VoiceCall"]:::presentation
            N["Login View"]:::presentation
            O["Profile View"]:::presentation
            P["Friend Profile"]:::presentation
            Q["Friends View"]:::presentation
            R["Home View"]:::presentation
            S["Home Private View"]:::presentation
        end
        T["Routers"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        U["Contexts & Hooks"]:::logic
        V["Services Layer"]:::logic
    end

    %% Integration/Configuration Layer
    subgraph "Integration/Configuration Layer"
        W["Utility Configs & Functions"]:::integration
        X["Firebase Service"]:::integration
        Y["Agora Integration"]:::integration
        Z["Expo & Build Configs"]:::integration
    end

    %% Assets & Resources
    subgraph "Assets & Resources"
        AA["Assets"]:::asset
    end

    %% Connections between layers
    A --> B
    B --> H
    H --> T

    %% UI Components/Views interact with Business Logic
    B --> U
    H --> U
    T --> U

    U --> V

    %% Services Layer interactions with Integration/Config Layer
    V --> W
    V --> X
    V --> Y
    W --> Z

    %% UI Components/Views use Assets
    B --- AA
    H --- AA

    %% Class Definitions for color styling
    classDef presentation fill:#AED6F1,stroke:#2874A6,stroke-width:2px;
    classDef logic fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef integration fill:#FAD7A0,stroke:#D68910,stroke-width:2px;
    classDef asset fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;

    %% Click Events
    click A "https://github.com/nam18022001/meotalk-app/blob/main/App.js"
    click A "https://github.com/nam18022001/meotalk-app/blob/main/index.js"
    click B "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/AccountItem"
    click C "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/ConverseItem"
    click D "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/Modal"
    click E "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/ProtectedRoute"
    click F "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/Skeleton"
    click G "https://github.com/nam18022001/meotalk-app/tree/main/src/Components/GlobalStyles"
    click H "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Chat.js"
    click I "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/PrivateChat.js"
    click J "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/NewChat.js"
    click K "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/NewChatPrivate.js"
    click L "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Call/VideoCall.js"
    click M "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Call/VoiceCall.js"
    click N "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Login.js"
    click O "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Profile.js"
    click P "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/FriendProfile.js"
    click Q "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Friends.js"
    click R "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/Home.js"
    click S "https://github.com/nam18022001/meotalk-app/blob/main/src/Views/HomePrivate.js"
    click T "https://github.com/nam18022001/meotalk-app/blob/main/src/routers/index.js"
    click U "https://github.com/nam18022001/meotalk-app/tree/main/src/contexts"
    click V "https://github.com/nam18022001/meotalk-app/tree/main/src/Services"
    click W "https://github.com/nam18022001/meotalk-app/tree/main/src/configs"
    click X "https://github.com/nam18022001/meotalk-app/blob/main/google-services.json"
    click Y "https://github.com/nam18022001/meotalk-app/blob/main/src/configs/agora.js"
    click Z "https://github.com/nam18022001/meotalk-app/blob/main/app.json"
    click AA "https://github.com/nam18022001/meotalk-app/tree/main/src/assets"
```
