# harsh-p-shukla/epicircle-customer-app architecture

> Architecture diagram of the GitHub repository harsh-p-shukla/epicircle-customer-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harsh-p-shukla/epicircle-customer-app
- Repository: https://github.com/harsh-p-shukla/epicircle-customer-app

## Overview

##### Main Components
a. Mobile App Runtime
- Expo SDK container (App.js)
- React Navigation (NavigationContainer & Stack.Navigator)
b. UI Layer
- Screens (Dashboard, Login, OTP, SchedulePickup, OrderHistory, Splash)
- Reusable Components (CustomCard, PrimaryButton, StatusBadge, ErrorMessage, LoadingSpinner, HeaderBar, OrderCard)
c. State Management
- PickupContext (Context Provider & Hook)
d. Local Persistence
- AsyncStorage (Device Storage)
e. External Services
- Google Maps (Deep Link)
- No real backend—data is mocked in context

##### Relationships & Data Flow
- App.js initializes the Expo container, wraps the app in NavigationContainer and PickupContextProvider.
- NavigationContainer routes between screens; each screen consumes context state and dispatch functions.
- Screens render reusable components for UI.
- PickupContext handles all CRUD operations on pickups and persists data to AsyncStorage.
- On “Schedule Pickup,” context updates in-memory state and writes to AsyncStorage.
- On app launch, context reads from AsyncStorage to rehydrate session.

##### Architectural Patterns & Principles
- Separation of Concerns: UI (screens/components) versus business logic (context) versus persistence (AsyncStorage)
- Provider Pattern: Context API for global state
- Component Reusability: All buttons, cards, badges, spinners live in a “components” layer
- Mock-first development: No backend means context simulates API calls

##### Technologies & Frameworks to Annotate
- Expo SDK (App container)
- @react-navigation/native & @react-navigation/stack (Navigation)
- React Context API (State)
- @react-native-async-storage/async-storage (Persistence)
- expo-linear-gradient (Styling)
- Local JS modules (contexts/PickupContext.js, components/**, screens/**)

##### Essential Details
- Explicitly show mocked OTP flow inside context (annotate “OTP: 123456 (mock)”).
- That session persistence uses AsyncStorage for login tokens.
- Context Provider wrapping the entire navigation tree.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Expo / React Native Runtime"
        App["App.js"]:::runtime
        subgraph "Navigation Layer"
            NavContainer["NavigationContainer"]:::navigation
            StackNav["Stack.Navigator"]:::navigation
        end
        subgraph "State Layer"
            Context["PickupContextProvider"]:::state
        end
    end

    subgraph Screens
        Dashboard["DashboardScreen"]:::screen
        Login["LoginScreen"]:::screen
        OTP["OTPScreen"]:::screen
        Schedule["SchedulePickupScreen"]:::screen
        OrderHistory["OrderHistoryScreen"]:::screen
        Splash["SplashScreen"]:::screen
    end

    subgraph "Reusable Components"
        CustomCard["CustomCard"]:::component
        PrimaryBtn["PrimaryButton"]:::component
        StatusBadge["StatusBadge"]:::component
        ErrorMsg["ErrorMessage"]:::component
        Loading["LoadingSpinner"]:::component
        HeaderBar["HeaderBar"]:::component
        OrderCard["OrderCard"]:::component
    end

    AsyncStorage[(AsyncStorage)]:::storage
    GoogleMaps(("Google Maps")):::external

    App --> NavContainer
    App --> Context
    NavContainer --> StackNav
    StackNav --> Dashboard
    StackNav --> Login
    StackNav --> OTP
    StackNav --> Schedule
    StackNav --> OrderHistory
    StackNav --> Splash

    Context -->|provides state| Dashboard
    Context -->|provides state| Login
    Context -->|provides state| OTP
    Context -->|provides state| Schedule
    Context -->|provides state| OrderHistory
    Context -->|provides state| Splash

    Dashboard -->|uses| HeaderBar
    Login -->|uses| HeaderBar
    OTP -->|uses| HeaderBar
    Schedule -->|uses| HeaderBar
    OrderHistory -->|uses| HeaderBar
    Splash -->|uses| HeaderBar

    Dashboard -->|uses| PrimaryBtn
    Login -->|uses| PrimaryBtn
    OTP -->|uses| PrimaryBtn
    Schedule -->|uses| PrimaryBtn
    OrderHistory -->|uses| PrimaryBtn
    Splash -->|uses| PrimaryBtn

    Context <--> AsyncStorage
    Schedule -->|deep link| GoogleMaps
    HeaderBar -->|map icon| GoogleMaps

    click App "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/App.js"
    click NavContainer "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/App.js"
    click Dashboard "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/DashboardScreen.js"
    click Login "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/LoginScreen.js"
    click OTP "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/OTPScreen.js"
    click Schedule "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/SchedulePickupScreen.js"
    click OrderHistory "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/OrderHistoryScreen.js"
    click Splash "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/screens/SplashScreen.js"
    click CustomCard "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/CustomCard.js"
    click PrimaryBtn "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/PrimaryButton.js"
    click StatusBadge "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/StatusBadge.js"
    click ErrorMsg "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/ErrorMessage.js"
    click Loading "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/LoadingSpinner.js"
    click HeaderBar "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/HeaderBar.js"
    click OrderCard "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/components/OrderCard.js"
    click Context "https://github.com/harsh-p-shukla/epicircle-customer-app/blob/main/contexts/PickupContext.js"

    classDef runtime fill:#D6EAF8,stroke:#2980B9,color:#1B4F72
    classDef navigation fill:#AED6F1,stroke:#3498DB,color:#1B4F72
    classDef screen fill:#DAF7A6,stroke:#27AE60,color:#145A32
    classDef component fill:#A9CCE3,stroke:#5DADE2,color:#1B2631
    classDef state fill:#82E0AA,stroke:#28B463,color:#145A32
    classDef storage fill:#F9E79F,stroke:#F1C40F,color:#7D6608
    classDef external fill:#F5B041,stroke:#D68910,color:#78281F
```
