# alpadrive/app architecture

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

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

## Overview

1. This is a React Native mobile app built with the Expo workflow. The repository is almost entirely the client-side app shell and feature screens; there is no backend code here, so the main boundary is between the mobile UI and external services.

2. `App.js` is the root entry point. In a repo like this, it typically owns the top-level navigation container and initial routing decisions, such as whether the user lands in auth/onboarding flows or the main vehicle dashboard.

3. The UI is organized as screen-level modules under `src/screens`. Each screen has its own `*.js` component plus a sibling `styles.js`, which makes the architectural boundary very clear: feature logic is scoped per screen, while layout/styling stays local to that feature.

4. The screen set suggests the product flow:
   - `Landing`, `Login`, and `SignUp` form the user access/authentication path.
   - `Connect`, `Pairing`, and `Ques` appear to support device/vehicle setup and onboarding, likely including QR-based pairing mentioned in the README.
   - `Home`, `Profile`, `Share`, and `Empty` look like post-login app areas, with `Empty` likely used as a placeholder or no-data state.
   - `Stats` is a dedicated analytics/telemetry area.

5. `Stats` is the most internally structured feature. It contains subcomponents for `Daily`, `Overall`, and `Periodic`, plus an `Overall/ProgressBar.js` helper. That indicates a small feature hierarchy: the stats screen composes multiple time-scope views and visualizes progress/health metrics.

6. The app’s main data flow is user-driven UI events -> screen-local logic -> network calls to the alpaDrive API server -> refreshed UI state. The README explicitly calls out normal network calls for server communication, so the mobile app is a presentation/control layer over remote vehicle and account data.

7. External integrations matter to the architecture. The README mentions Google Maps API support, so location tracking is likely rendered through a map service rather than a purely custom visualization. QR code scanning is also part of the intended pairing flow, which means the app has a hardware/device onboarding path in addition to standard auth.

8. There is no obvious global state-management directory, service layer, or backend client abstraction in the file tree. That suggests the app is organized primarily around screen components, with shared behavior likely kept minimal and co-located rather than centralized in a large domain layer.

9. Shared static resources live under `src/assets`, including `configs.js` and image assets. `configs.js` is the likely place for app-wide constants such as endpoints, theme values, or feature configuration, while image assets support the branded mobile UI.

10. Styling is mostly co-located per screen/component. That keeps each feature self-contained and makes it easy to map UI sections in an architecture diagram without needing a separate design-system package.

11. The repository also includes Expo/EAS configuration files (`app.json`, `eas.json`, `babel.config.js`), which means runtime behavior and build/deploy are handled through Expo tooling rather than custom native project setup.

12. In diagram terms, the key architectural blocks are: Expo app shell, navigation/root entry, auth/onboarding screens, vehicle control and pairing screens, stats/telemetry screens, shared assets/configuration, and external dependencies such as the API server, QR scanner flow, and Google Maps.

Main entry points: [`src/screens/Stats/Stats.js`](https://github.com/alpadrive/app/blob/main/src/screens/Stats/Stats.js) (Stats), [`App.js`](https://github.com/alpadrive/app/blob/main/App.js) (App.js), [`src/screens/Home/Home.js`](https://github.com/alpadrive/app/blob/main/src/screens/Home/Home.js) (Home), [`src/screens/Login/Login.js`](https://github.com/alpadrive/app/blob/main/src/screens/Login/Login.js) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App shell"]
  node_app_entry["App.js<br/>entrypoint<br/>[App.js]"]
end

subgraph group_access["Access flow"]
  node_landing["Landing<br/>screen<br/>[Landing.js]"]
  node_login["Login<br/>screen<br/>[Login.js]"]
  node_signup["Sign Up<br/>screen<br/>[SignUp.js]"]
end

subgraph group_onboarding["Pairing flow"]
  node_connect["Connect<br/>screen<br/>[Connect.js]"]
  node_pairing["Pairing<br/>screen<br/>[Pairing.js]"]
  node_ques["Ques<br/>screen<br/>[Ques.js]"]
end

subgraph group_main["Main app"]
  node_home["Home<br/>screen<br/>[Home.js]"]
  node_profile["Profile<br/>screen<br/>[Profile.js]"]
  node_share["Share<br/>screen<br/>[styles.js]"]
  node_empty["Empty<br/>screen<br/>[Empty.js]"]
end

subgraph group_stats["Stats"]
  node_stats_screen["Stats<br/>screen<br/>[Stats.js]"]
  node_daily["Daily<br/>stats view<br/>[Daily.js]"]
  node_overall["Overall<br/>stats view<br/>[Overall.js]"]
  node_progress["Progress bar<br/>ui helper<br/>[ProgressBar.js]"]
  node_periodic["Periodic<br/>stats view<br/>[Periodic.js]"]
end

subgraph group_shared["Shared assets"]
  node_configs["Configs<br/>shared config<br/>[configs.js]"]
  node_images["Images<br/>assets"]
end

subgraph group_external["External services"]
  node_api_server[("API server<br/>external api")]
  node_maps(("Google Maps<br/>external map service"))
  node_qr_scan(("QR scan<br/>external device flow"))
end

node_app_entry -->|"routes to"| node_landing
node_app_entry -->|"routes to"| node_login
node_app_entry -->|"routes to"| node_home
node_landing -->|"auth path"| node_login
node_landing -->|"auth path"| node_signup
node_login -->|"auth call"| node_api_server
node_signup -->|"create account"| node_api_server
node_home -->|"setup"| node_connect
node_connect -->|"pair vehicle"| node_pairing
node_pairing -->|"scan"| node_qr_scan
node_pairing -->|"register device"| node_api_server
node_connect -->|"onboard"| node_ques
node_home -->|"open stats"| node_stats_screen
node_stats_screen -->|"composes"| node_daily
node_stats_screen -->|"composes"| node_overall
node_stats_screen -->|"composes"| node_periodic
node_overall -->|"uses"| node_progress
node_stats_screen -->|"fetch stats"| node_api_server
node_home -->|"map view"| node_maps
node_profile -->|"profile data"| node_api_server
node_share -->|"share data"| node_api_server
node_configs -.->|"configure"| node_app_entry
node_configs -.->|"configure"| node_login
node_configs -.->|"configure"| node_stats_screen
node_images -.->|"assets"| node_app_entry

click node_app_entry "https://github.com/alpadrive/app/blob/main/App.js"
click node_landing "https://github.com/alpadrive/app/blob/main/src/screens/Landing/Landing.js"
click node_login "https://github.com/alpadrive/app/blob/main/src/screens/Login/Login.js"
click node_signup "https://github.com/alpadrive/app/blob/main/src/screens/SignUp/SignUp.js"
click node_connect "https://github.com/alpadrive/app/blob/main/src/screens/Connect/Connect.js"
click node_pairing "https://github.com/alpadrive/app/blob/main/src/screens/Pairing/Pairing.js"
click node_ques "https://github.com/alpadrive/app/blob/main/src/screens/Ques/Ques.js"
click node_home "https://github.com/alpadrive/app/blob/main/src/screens/Home/Home.js"
click node_profile "https://github.com/alpadrive/app/blob/main/src/screens/Profile/Profile.js"
click node_share "https://github.com/alpadrive/app/blob/main/src/screens/Share/styles.js"
click node_empty "https://github.com/alpadrive/app/blob/main/src/screens/Empty/Empty.js"
click node_stats_screen "https://github.com/alpadrive/app/blob/main/src/screens/Stats/Stats.js"
click node_daily "https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Daily/Daily.js"
click node_overall "https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Overall/Overall.js"
click node_progress "https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Overall/ProgressBar.js"
click node_periodic "https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Periodic/Periodic.js"
click node_configs "https://github.com/alpadrive/app/blob/main/src/assets/configs.js"
click node_images "https://github.com/alpadrive/app/tree/main/src/assets/img"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_api_server,node_maps,node_qr_scan toneBlue
class node_landing,node_login,node_signup toneAmber
class node_connect,node_pairing,node_ques toneMint
class node_home,node_profile,node_share,node_empty toneRose
class node_stats_screen,node_daily,node_overall,node_progress,node_periodic toneIndigo
class node_configs,node_images toneTeal
```

## Components

### App shell

Expo app entry and runtime setup

- [App.js](https://github.com/alpadrive/app/blob/main/App.js): entrypoint · Root Expo entry and top-level navigation · `App.js`

### Access flow

Landing, login, and sign-up screens

- [Landing](https://github.com/alpadrive/app/blob/main/src/screens/Landing/Landing.js): screen · Initial landing screen · `src/screens/Landing/Landing.js`
- [Login](https://github.com/alpadrive/app/blob/main/src/screens/Login/Login.js): screen · Authentication screen · `src/screens/Login/Login.js`
- [Sign Up](https://github.com/alpadrive/app/blob/main/src/screens/SignUp/SignUp.js): screen · Account creation screen · `src/screens/SignUp/SignUp.js`

### Pairing flow

Device and vehicle setup screens

- [Connect](https://github.com/alpadrive/app/blob/main/src/screens/Connect/Connect.js): screen · Vehicle connection screen · `src/screens/Connect/Connect.js`
- [Pairing](https://github.com/alpadrive/app/blob/main/src/screens/Pairing/Pairing.js): screen · QR or device pairing flow · `src/screens/Pairing/Pairing.js`
- [Ques](https://github.com/alpadrive/app/blob/main/src/screens/Ques/Ques.js): screen · Onboarding questions screen · `src/screens/Ques/Ques.js`

### Main app

Post-login app areas and profile views

- [Home](https://github.com/alpadrive/app/blob/main/src/screens/Home/Home.js): screen · Primary post-login dashboard · `src/screens/Home/Home.js`
- [Profile](https://github.com/alpadrive/app/blob/main/src/screens/Profile/Profile.js): screen · User profile screen · `src/screens/Profile/Profile.js`
- [Share](https://github.com/alpadrive/app/blob/main/src/screens/Share/styles.js): screen · Sharing screen · `src/screens/Share/styles.js`
- [Empty](https://github.com/alpadrive/app/blob/main/src/screens/Empty/Empty.js): screen · Placeholder or no-data screen · `src/screens/Empty/Empty.js`

### Stats

Telemetry and analytics screens

- [Stats](https://github.com/alpadrive/app/blob/main/src/screens/Stats/Stats.js): screen · Telemetry and analytics hub · `src/screens/Stats/Stats.js`
- [Daily](https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Daily/Daily.js): stats view · Daily stats breakdown · `src/screens/Stats/components/Daily/Daily.js`
- [Overall](https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Overall/Overall.js): stats view · Aggregate stats summary · `src/screens/Stats/components/Overall/Overall.js`
- [Progress bar](https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Overall/ProgressBar.js): ui helper · Overall progress visualization · `src/screens/Stats/components/Overall/ProgressBar.js`
- [Periodic](https://github.com/alpadrive/app/blob/main/src/screens/Stats/components/Periodic/Periodic.js): stats view · Time-windowed stats breakdown · `src/screens/Stats/components/Periodic/Periodic.js`

### Shared assets

Common config and static resources

- [Configs](https://github.com/alpadrive/app/blob/main/src/assets/configs.js): shared config · App-wide constants and settings · `src/assets/configs.js`
- [Images](https://github.com/alpadrive/app/tree/main/src/assets/img): assets · Brand and UI image assets · `src/assets/img`

### External services

Remote APIs and third-party integrations

- **API server**: external api · alpaDrive backend for account and vehicle data
- **Google Maps**: external map service · Location and map rendering support
- **QR scan**: external device flow · QR-based pairing integration

## Connections

- App.js → Landing: routes to · Initial route into access flow
- App.js → Login: routes to · Auth navigation entry
- App.js → Home: routes to · Main app entry after access
- Landing → Login: auth path · Landing leads into login
- Landing → Sign Up: auth path · Landing leads into sign-up
- Login → API server: auth call · Validates credentials against backend
- Sign Up → API server: create account · Sends registration data to backend
- Home → Connect: setup · Leads into vehicle connection flow
- Connect → Pairing: pair vehicle · Moves into pairing step
- Pairing → QR scan: scan · Uses QR-based device pairing
- Pairing → API server: register device · Sends pairing result to backend
- Connect → Ques: onboard · Collects onboarding questions
- Home → Stats: open stats · Navigates to telemetry views
- Stats → Daily: composes · Stats screen includes daily view
- Stats → Overall: composes · Stats screen includes overall view
- Stats → Periodic: composes · Stats screen includes periodic view
- Overall → Progress bar: uses · Overall view renders progress visualization
- Stats → API server: fetch stats · Loads telemetry and vehicle metrics
- Home → Google Maps: map view · Location or trip views rely on map service
- Profile → API server: profile data · Reads and updates account data
- Share → API server: share data · Coordinates sharing via backend data
- Configs → App.js: configure · Shared constants inform app startup
- Configs → Login: configure · Screen-level configuration values
- Configs → Stats: configure · Shared metric or UI settings
- Images → App.js: assets · Branded media used by the app shell
