# hoanglehaithanh/react-native-expo-redux-template architecture

> Architecture diagram of the GitHub repository hoanglehaithanh/react-native-expo-redux-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hoanglehaithanh/react-native-expo-redux-template
- Repository: https://github.com/hoanglehaithanh/react-native-expo-redux-template

## Overview

##### Project type and purpose
- This is a mobile application template built with React Native on top of the Expo framework, using Redux for state management.
- Its purpose is to provide a starting point (“boilerplate”) for building cross-platform (iOS/Android) apps, with ready-made structure for UI components, screen navigation, global state, theming, localization, and API services.

##### File structure
- Top‐level:
- App.tsx, index.tsx, app.json, package.json, tsconfig.json, babel.config.js, eas.json – core Expo + TypeScript config and entry points.
- src/ – all application code, further divided into:
– Components: reusable UI pieces.
– Screens: page‐level UI (Welcome, Home).
– Navigation: React Navigation setup (stack/tab/drawer).
– Store: Redux store config and reducers.
– Hooks: custom & Redux hooks.
– Services: API wrappers (e.g. users).
– Localization: language keys & files.
– Config: environment or API endpoints.
- CI/CD: .github/workflows for OTA updates, publishing.
- Extras: assets folder, .expo-shared.

##### Key insights from README
- Confirms use of Redux, Expo CLI, file‐structure rationale.
- No backend service is shipped, but Services folder is intended for HTTP/Firebase integrations.

a. Main components to represent:
1. Expo Runtime / Native Shell
2. App Entry & Providers
– Redux <Provider>
– Localization <Provider>
– Theme (styled-components or context)
3. Navigation Layer
– StackNavigator / TabNavigator
4. Screens (WelcomeScreen, HomeScreen, etc.)
5. Presentational Components (Buttons, Lists…)
6. Hooks Layer
– useSelector/useDispatch wrappers
7. Services Layer
– API clients (e.g. UsersService)
8. Redux Store
– Reducers (home, theme, etc.)
– Actions / Effects (thunks or sagas)
9. Config & Localization
– API endpoints / env
– Language resources
10. Theme Variables

b. Relationships & interactions:
- App.tsx boots up → wraps Navigation inside Redux and Localization providers.
- Navigation determines which Screen component to mount.
- Screens dispatch actions via Hooks → trigger Services for network calls → Services return data → dispatch results → update Redux store.
- Store updates propagate to UI via useSelector Hooks → Components re-render.
- Config provides endpoints to Services; Localization feeds strings into Screens/Components; Theme injects design tokens.

c. Architectural patterns / design principles:
- Container (Screen) vs. Presentational (Component) separation
- Unidirectional data flow (Redux)
- Separation of concerns: UI, state, services, config, localization, theme
- Single source of truth (Redux store)
- Context providers (theme / i18n)

d. Key technologies / libraries:
- React Native + Expo
- Redux (+ Redux Toolkit or plain)
- React Navigation
- TypeScript
- Expo OTA / EAS
- Custom Hooks for Redux bindings
- Localization via context
- Styled-components or plain StyleSheet with Theme variables

##### Detail checklist for the engineer
- Important protocols (HTTP/REST) or middleware if used.
- Call out the entry point (App.tsx) and major providers at the top.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% App Entry & Providers
    subgraph "App Entry & Providers"
        direction TB
        Index["src/index.tsx"]:::ui
        App["App.tsx"]:::ui
        StoreProvider["Redux Provider"]:::state
        LocProvider["Localization Provider"]:::config
        ThemeProvider["Theme Provider"]:::config
    end

    %% UI Layer
    subgraph "UI Layer"
        direction TB
        NavRoot["src/Navigation/index.tsx"]:::ui
        NavMain["src/Navigation/Main/index.tsx"]:::ui
        subgraph "Screens"
            direction TB
            WelcomeContainer["src/Screens/Welcome/WelcomeContainer.tsx"]:::ui
            Welcome["src/Screens/Welcome/Welcome.tsx"]:::ui
            HomeContainer["src/Screens/Home/HomeContainer.tsx"]:::ui
            Home["src/Screens/Home/Home.tsx"]:::ui
        end
        Components["src/Components/index.ts"]:::ui
    end

    %% Hooks Layer
    subgraph "Hooks Layer"
        direction TB
        HooksIndex["src/Hooks/index.ts"]:::state
        ReduxHook["src/Hooks/redux.ts"]:::state
    end

    %% State Management
    subgraph "Redux Store"
        direction TB
        StoreSetup["src/Store/index.ts"]:::state
        RootReducer["src/Store/reducers/index.ts"]:::state
        HomeReducer["src/Store/reducers/home.ts"]:::state
        ThemeReducer["src/Store/reducers/theme.ts"]:::state
    end

    %% Services Layer
    subgraph "Services Layer"
        direction TB
        ServicesIndex["src/Services/index.ts"]:::service
        BaseAPI["src/Services/base.ts"]:::service
        UsersService["src/Services/users/index.ts"]:::service
    end

    %% Config & Localization & Theme
    subgraph "Config / Localization / Theme"
        direction TB
        ConfigIndex["src/Config/index.ts"]:::config
        LocCore["src/Localization/index.ts"]:::config
        LocKeys["src/Localization/keys/index.ts"]:::config
        LangIndex["src/Localization/languages/index.ts"]:::config
        LangEN["src/Localization/languages/en.ts"]:::config
        LangVI["src/Localization/languages/vi.ts"]:::config
        ThemeVars["src/Theme/Variables.ts"]:::config
    end

    %% CI/CD Workflows
    subgraph "CI/CD Workflows"
        direction TB
        PRPreview[".github/workflows/PR-preview.yml"]:::external
        Publish[".github/workflows/publish.yml"]:::external
        UpdateWF[".github/workflows/update.yml"]:::external
    end

    %% External Services
    ExternalAPI["External API"]:::external
    ExpoRuntime["Expo Runtime / Native Shell"]:::external

    %% Connections
    Index --> App
    App --> StoreProvider
    App --> LocProvider
    App --> ThemeProvider

    StoreProvider --> NavRoot
    LocProvider --> NavRoot
    ThemeProvider --> NavRoot

    NavRoot --> NavMain
    NavMain --> WelcomeContainer
    NavMain --> HomeContainer

    WelcomeContainer --> Welcome
    HomeContainer --> Home
    Welcome --> Components
    Home --> Components

    WelcomeContainer -->|dispatch| ReduxHook
    HomeContainer -->|dispatch| ReduxHook
    ReduxHook --> ServicesIndex
    ServicesIndex --> BaseAPI
    BaseAPI --> UsersService
    BaseAPI -->|HTTP/REST| ExternalAPI

    ServicesIndex -->|dispatch result| StoreSetup
    StoreSetup --> RootReducer
    RootReducer --> HomeReducer
    RootReducer --> ThemeReducer
    StoreSetup -->|state| ReduxHook
    ReduxHook --> WelcomeContainer
    ReduxHook --> HomeContainer

    ConfigIndex --> BaseAPI
    ConfigIndex -->|env| ServicesIndex
    LocCore --> Welcome
    LocCore --> Home
    LocKeys --> LocCore
    LangIndex --> LocCore
    LangEN --> LocCore
    LangVI --> LocCore
    ThemeVars --> ThemeProvider

    ExpoRuntime --> App

    PRPreview --> ExpoRuntime
    Publish --> ExpoRuntime
    UpdateWF --> ExpoRuntime

    %% Click Events
    click Index "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/index.tsx"
    click App "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/App.tsx"
    click StoreProvider "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Store/index.ts"
    click LocProvider "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/index.ts"
    click ThemeProvider "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Theme/index.ts"
    click NavRoot "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Navigation/index.tsx"
    click NavMain "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Navigation/Main/index.tsx"
    click WelcomeContainer "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Screens/Welcome/WelcomeContainer.tsx"
    click Welcome "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Screens/Welcome/Welcome.tsx"
    click HomeContainer "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Screens/Home/HomeContainer.tsx"
    click Home "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Screens/Home/Home.tsx"
    click Components "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Components/index.ts"
    click HooksIndex "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Hooks/index.ts"
    click ReduxHook "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Hooks/redux.ts"
    click StoreSetup "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Store/index.ts"
    click RootReducer "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Store/reducers/index.ts"
    click HomeReducer "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Store/reducers/home.ts"
    click ThemeReducer "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Store/reducers/theme.ts"
    click ServicesIndex "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Services/index.ts"
    click BaseAPI "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Services/base.ts"
    click UsersService "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Services/users/index.ts"
    click ConfigIndex "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Config/index.ts"
    click LocCore "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/index.ts"
    click LocKeys "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/keys/index.ts"
    click LangIndex "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/languages/index.ts"
    click LangEN "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/languages/en.ts"
    click LangVI "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Localization/languages/vi.ts"
    click ThemeVars "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/src/Theme/Variables.ts"
    click PRPreview "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/.github/workflows/PR-preview.yml"
    click Publish "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/.github/workflows/publish.yml"
    click UpdateWF "https://github.com/hoanglehaithanh/react-native-expo-redux-template/blob/master/.github/workflows/update.yml"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0066CC,color:#000;
    classDef state fill:#DFFFE0,stroke:#339900,color:#000;
    classDef service fill:#FFE8C0,stroke:#CC6600,color:#000;
    classDef config fill:#F0F0F0,stroke:#999999,color:#000;
    classDef external fill:#F8D7DA,stroke:#CC0033,color:#000;
```
