# developers-b11/erythraeanlogistics architecture

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

- Interactive diagram: https://gitdiagram.com/developers-b11/erythraeanlogistics
- Repository: https://github.com/developers-b11/erythraeanlogistics

## Overview

##### Project Type and Purpose
- This is a React Native mobile client application (iOS and Android).
- It uses Redux (with slices under src/store), React Navigation (under src/navigation), and communicates with external services (REST APIs and WebSocket).

##### High-Level Architectural Components
a. Native Shells
– Android (android/…)
– iOS (ios/…)
b. JavaScript Layer
– Entry point (index.js → App.js)
– UI Presentation
- src/components (stateless, reusable UI elements)
- src/assets (images, fonts, SVGs)
– Container/Screens
- src/containers (connect components to state & side effects)
– Navigation
- src/navigation/authStack & appStack
- AppNavigation.js toggles auth vs app flows
– State Management
- src/store (Redux Toolkit slices for auth, user, socket, common)
- Services (src/store/services) for API clients
– Side-Effects & Data Flow
- Async calls to backend REST endpoints
- WebSocket client (src/store/socket/socketSlice.js)
c. External Systems
– Backend REST APIs (e.g., OTP, orders, notifications)
– WebSocket or Socket.io server (real-time messaging)
– Firebase services (google-services.json, GoogleService-Info.plist) for analytics/push
– Authentication provider (could be custom or Firebase Auth)

##### Relationships & Interactions
- User taps button → Container dispatches Redux action → Thunk in services layer calls REST API → Response updates store → Connected component re-renders.
- WebSocket middleware listens to server push → Emits Redux events → UI updates (e.g., chat, notifications).
- Navigation flows: authStack (login/signup/splash) vs appStack (home, orders, settings).

##### Architectural Patterns & Principles
- Unidirectional Data Flow (Redux)
- Presentational vs Container components
- Feature-based module structure (components/constants/layout/view, containers grouped by feature)
- React Navigation for screen routing
- Native bridge for platform-specific modules (Flipper integration, Google services)

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Native Shells"
        Android["Android Native Shell"]:::native
        iOS["iOS Native Shell"]:::native
    end

    JSRuntime["JS Engine (Hermes/JSC)"]:::runtime
    MetroBundler["Metro Bundler (dev only)"]:::dev

    Android --> JSRuntime
    iOS --> JSRuntime
    MetroBundler -.-> JSRuntime

    subgraph "JavaScript Layer"
        UIComponents["UI Components\n(src/components)"]:::ui
        click UIComponents "https://github.com/developers-b11/erythraeanlogistics/tree/main/src/components"
        subgraph Assets
            Fonts["Fonts"]:::ui
            click Fonts "https://github.com/developers-b11/erythraeanlogistics/tree/main/src/assets/Fonts"
            Images["Images"]:::ui
            click Images "https://github.com/developers-b11/erythraeanlogistics/tree/main/src/assets/Images"
            Svgs["SVGs"]:::ui
            click Svgs "https://github.com/developers-b11/erythraeanlogistics/tree/main/src/assets/Svgs"
        end

        Containers["Containers\n(Auth & App)"]:::container
        click Containers "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/containers/authContainer/SplashScreen/index.js"

        subgraph Navigation
            AuthStack["authStack"]:::nav
            click AuthStack "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/navigation/authStack/index.js"
            AppStack["appStack"]:::nav
            click AppStack "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/navigation/appStack/index.js"
            AppNav["AppNavigation.js"]:::nav
            click AppNav "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/navigation/AppNavigation.js"
            NavRef["navigationRef"]:::nav
            click NavRef "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/navigationRef/index.js"
        end

        subgraph Store
            StoreSetup["Store Setup\n(src/store/index.js)"]:::store
            click StoreSetup "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/index.js"
            AuthSlice["authSlice"]:::store
            click AuthSlice "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/auth/authSlice.js"
            UserSlice["userSlice"]:::store
            click UserSlice "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/user/userSlice.js"
            SocketSlice["socketSlice"]:::store
            click SocketSlice "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/socket/socketSlice.js"
            CommonSlice["commonSlice"]:::store
            click CommonSlice "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/common/commonSlice.js"
        end

        Services["API & WebSocket Services"]:::services
        click Services "https://github.com/developers-b11/erythraeanlogistics/blob/main/src/store/services/index.js"
    end

    subgraph "External Services"
        RESTAPI[(REST API Server)]:::external
        WebSocket[(WebSocket Server)]:::external
        Firebase[(Firebase Services)]:::external
    end

    JSRuntime --> UIComponents
    UIComponents --> Containers
    Containers --> StoreSetup
    StoreSetup --> Services
    Services --> RESTAPI
    RESTAPI --> Services
    Services --> StoreSetup
    StoreSetup --> UIComponents

    WebSocket --> Services
    Services --> StoreSetup
    StoreSetup --> UIComponents

    Firebase --> Services

    classDef native fill:#f3e5f5,stroke:#7e57c2,stroke-width:1px
    classDef runtime fill:#bbdefb,stroke:#1e88e5,stroke-width:1px
    classDef dev fill:#e0e0e0,stroke:#616161,stroke-width:1px,stroke-dasharray:5 5
    classDef ui fill:#c8e6c9,stroke:#388e3c,stroke-width:1px
    classDef container fill:#ffe0b2,stroke:#f57c00,stroke-width:1px
    classDef nav fill:#f8bbd0,stroke:#d81b60,stroke-width:1px
    classDef store fill:#bbdefb,stroke:#1976d2,stroke-width:1px
    classDef services fill:#ffccbc,stroke:#d84315,stroke-width:1px
    classDef external fill:#ffcdd2,stroke:#c62828,stroke-width:1px,stroke-dasharray:2 2
```
