# hodinhtuankiet/native-linkedin-cross-platform architecture

> Architecture diagram of the GitHub repository hodinhtuankiet/native-linkedin-cross-platform, 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/hodinhtuankiet/native-linkedin-cross-platform
- Repository: https://github.com/hodinhtuankiet/native-linkedin-cross-platform

## Overview

- Client Application: Represent the mobile/app side (located in the “client” directory). Indicate that it’s built on Expo/React Native with screens, navigation, and UI components. Consider labeling important portions like “Authentication Screens,” “Chat/Message Screens,” “Profile & Networking Sections,” etc.
- API Server: Represent the backend (located in the “api” directory) with its controllers, models, and routes. Highlight endpoints for authentication (JWT usage stored in AsyncStorage), connection handling, messaging, post creation, and search functionalities.
- Database & Persistence: Note that the API config files refer to MongoDB, Redis, and possibly connections to Firebase (for articles/media uploads), so show components for a MongoDB database (for user data, posts, messages) and Redis (for caching or session management).
- Docker/Deployment: Show a Docker container component (using Docker Compose, etc.) for containerized deployment of the API server and possibly the client or supporting services.

##### Interactions and Data Flow
- To show JWT-based authentication flows from the client side to the API server, highlighting token issuance and verification.
- Internal communication between various modules on the API (for instance, controllers calling model methods, and route definitions that map to controller functions).

##### Architectural Patterns and Design Choices
- Separation of concerns with a clear distinction between the front end (client) and the back end (API server). This separation supports a typical MVC (Controller, Model, Route) or REST API pattern.
- Use of design principles such as modularization (each API functionality divided into specific controllers and routes) and secure API practices (JWT and token management using AsyncStorage on the client).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        FA["Client Application (Expo/React Native)"]:::frontend
        FS["Authentication Screens"]:::frontend
        subgraph "Chat/Message Screens"
            direction TB
            CM1["Chat Tab"]:::frontend
            CM2["Chat Screen"]:::frontend
            CM3["Chat Messages Screen"]:::frontend
        end
        subgraph "Profile & Networking"
            direction TB
            PF["Profile Tab"]:::frontend
            NW["Network Tab"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        B1["API Server"]:::backend
        subgraph "API Components"
            direction TB
            BR["Routes & Endpoints"]:::backend
            BC["Controllers"]:::backend
            BM["Models"]:::backend
        end
        subgraph "Authentication & Connection Endpoints"
            direction TB
            BA["Authentication Endpoint"]:::backend
            BCX["Connection Endpoint"]:::backend
        end
    end

    %% Database & External Services
    subgraph "Database & External Services"
        direction TB
        DB["MongoDB"]:::database
        RD["Redis"]:::database
        FB["Firebase"]:::external
    end

    %% Deployment
    subgraph "Deployment"
        direction TB
        D1["API Dockerfile"]:::deployment
        D2["API Docker Compose"]:::deployment
        D3["Dockerfile (Container)"]:::deployment
        D4["Root Docker Compose"]:::deployment
    end

    %% Connections Between Layers
    FA -->|"API_Calls(JWT_Auth)"| B1
    B1 -->|"CRUD_Operations"| DB
    B1 -->|"Cache_Sessions"| RD
    B1 -->|"Media_Storage"| FB
    B1 -->|"Containerized_in"| D1

    %% Click Events for Frontend Components
    click FA "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/client/app"
    click FS "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/client/app/(authenticate)"
    click CM1 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/client/app/(tab)/chat"
    click CM2 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/client/screens/ChatScreen.js"
    click CM3 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/client/screens/ChatMessagesScreen.js"
    click PF "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/client/app/(tab)/profile"
    click NW "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/client/app/(tab)/network"

    %% Click Events for Backend Components
    click B1 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api"
    click BR "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/route"
    click BC "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/controllers"
    click BM "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/models"
    click BA "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/route/authenticate"
    click BCX "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/route/connection"

    %% Click Events for Database & External Services
    click DB "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/api/config/mongodb.js"
    click RD "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/api/config/init.redis.js"

    %% Click Events for Deployment Components
    click D1 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/api/Dockerfile"
    click D2 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/api/docker-compose.yml"
    click D3 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/tree/master/docker/Dockerfile"
    click D4 "https://github.com/hodinhtuankiet/native-linkedin-cross-platform/blob/master/docker-compose.yml"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef database fill:#A9DFBF,stroke:#27AE60,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef external fill:#F5B7B1,stroke:#C0392B,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef deployment fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px,stroke-dasharray: 2, 2;
```
