# sailenceresw/myride architecture

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

- Interactive diagram: https://gitdiagram.com/sailenceresw/myride
- Repository: https://github.com/sailenceresw/myride

## Overview

MyRide is a Pokhara ride-hailing, parcel-delivery, and goods-logistics product with customer and driver mobile apps, a Node.js API, and a staff Ops console. The main workflow is customer sign-in and trip quoting/booking, server-side matching and trip updates, then driver acceptance and completion; rider applications, KYC review, payments, and weekly payroll are supporting domain stages. Several links reflect README documentation because the corresponding mobile screens and some backend modules were not sampled.

Main entry points: [`src/app.js`](https://github.com/sailenceresw/myride/blob/main/src/app.js) (Express API), [`src/service.js`](https://github.com/sailenceresw/myride/blob/main/src/service.js) (Trip and account logic), [`mobile/src/lib/api.ts`](https://github.com/sailenceresw/myride/blob/main/mobile/src/lib/api.ts) (API client), [`src/geo.js`](https://github.com/sailenceresw/myride/blob/main/src/geo.js) (Places and routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile apps"]
  node_customer["Customer app<br/>[index.tsx]"]
  node_drive["Driver app<br/>[index.tsx]"]
  node_application["Rider application"]
  node_mobile_api["API client<br/>[api.ts]"]
  node_events["Live events<br/>[useEvents.ts]"]
end

subgraph group_backend["API and trip operations"]
  node_api["Express API<br/>[app.js]"]
  node_service["Trip and account logic<br/>[service.js]"]
  node_pricing["Fare calculation<br/>[pricing.js]"]
  node_geo["Places and routing<br/>[geo.js]"]
  node_dispatch["Driver matching<br/>[dispatch.js]"]
  node_store[("JSON state store<br/>[store.js]")]
  node_simulator["Demo fleet simulator<br/>[simulator.js]"]
  node_server["Server entrypoint<br/>[server.js]"]
end

subgraph group_trust["Rider trust and earnings"]
  node_kyc["KYC validation<br/>[kyc.js]"]
  node_face["Selfie verification<br/>[faceVerify.js]"]
  node_rewards["Membership and rewards<br/>[rewards.js]"]
  node_payments["Payment processing<br/>[payments.js]"]
  node_payroll["Weekly payroll<br/>[payroll.js]"]
  node_sms["SMS messaging<br/>[sms.js]"]
end

subgraph group_ops["Staff operations"]
  node_economics["Unit economics<br/>[economics.js]"]
  node_ops_console["Ops console<br/>[admin.js]"]
end

node_staff(("MyRide staff"))
node_osrm["OSRM routing"]
node_sms_gateway["SMS gateways"]
node_payment_provider["eSewa and Khalti"]

node_customer -.->|"uses"| node_mobile_api
node_drive -.->|"uses"| node_mobile_api
node_application -.->|"submits to"| node_mobile_api
node_mobile_api -.->|"REST requests"| node_api
node_events -.->|"receives SSE"| node_api
node_api -->|"delegates"| node_service
node_api -->|"calculates fares"| node_pricing
node_api -->|"uses places and routes"| node_geo
node_api -->|"serves projections"| node_economics
node_api -->|"serves payroll"| node_payroll
node_api -->|"handles payments"| node_payments
node_api -->|"creates and uses"| node_store
node_service -->|"quotes fares"| node_pricing
node_service -->|"checks and routes"| node_geo
node_service -->|"finds candidates"| node_dispatch
node_service -->|"uses rewards"| node_rewards
node_service -->|"validates riders"| node_kyc
node_service -->|"verifies selfies"| node_face
node_service -->|"uses payroll"| node_payroll
node_service -->|"sends messages"| node_sms
node_server -->|"starts"| node_simulator
node_simulator -->|"uses routing"| node_geo
node_geo -->|"requests routes"| node_osrm
node_sms -.->|"sends SMS"| node_sms_gateway
node_payments -.->|"processes payments"| node_payment_provider
node_staff -->|"reviews and monitors"| node_ops_console
node_ops_console -.->|"uses API"| node_api
node_api -.->|"supports review"| node_kyc

click node_customer "https://github.com/sailenceresw/myride/blob/main/mobile/src/app/customer/index.tsx"
click node_drive "https://github.com/sailenceresw/myride/blob/main/mobile/src/app/drive/index.tsx"
click node_application "https://github.com/sailenceresw/myride/blob/main/mobile/src/components/RiderApplication.tsx"
click node_mobile_api "https://github.com/sailenceresw/myride/blob/main/mobile/src/lib/api.ts"
click node_events "https://github.com/sailenceresw/myride/blob/main/mobile/src/lib/useEvents.ts"
click node_api "https://github.com/sailenceresw/myride/blob/main/src/app.js"
click node_service "https://github.com/sailenceresw/myride/blob/main/src/service.js"
click node_pricing "https://github.com/sailenceresw/myride/blob/main/src/pricing.js"
click node_geo "https://github.com/sailenceresw/myride/blob/main/src/geo.js"
click node_dispatch "https://github.com/sailenceresw/myride/blob/main/src/dispatch.js"
click node_store "https://github.com/sailenceresw/myride/blob/main/src/store.js"
click node_simulator "https://github.com/sailenceresw/myride/blob/main/src/simulator.js"
click node_server "https://github.com/sailenceresw/myride/blob/main/server.js"
click node_kyc "https://github.com/sailenceresw/myride/blob/main/src/kyc.js"
click node_face "https://github.com/sailenceresw/myride/blob/main/src/faceVerify.js"
click node_rewards "https://github.com/sailenceresw/myride/blob/main/src/rewards.js"
click node_payments "https://github.com/sailenceresw/myride/blob/main/src/payments.js"
click node_payroll "https://github.com/sailenceresw/myride/blob/main/src/payroll.js"
click node_sms "https://github.com/sailenceresw/myride/blob/main/src/sms.js"
click node_economics "https://github.com/sailenceresw/myride/blob/main/src/economics.js"
click node_ops_console "https://github.com/sailenceresw/myride/blob/main/public/admin.js"

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_customer,node_drive,node_application,node_mobile_api,node_events toneBlue
class node_api,node_service,node_pricing,node_geo,node_dispatch,node_store,node_simulator,node_server toneAmber
class node_kyc,node_face,node_rewards,node_payments,node_payroll,node_sms toneMint
class node_economics,node_ops_console toneRose
class node_staff,node_osrm,node_sms_gateway,node_payment_provider toneIndigo
```

## Components

### Mobile apps

- [Customer app](https://github.com/sailenceresw/myride/blob/main/mobile/src/app/customer/index.tsx): `mobile/src/app/customer/index.tsx`
- [Driver app](https://github.com/sailenceresw/myride/blob/main/mobile/src/app/drive/index.tsx): `mobile/src/app/drive/index.tsx`
- [Rider application](https://github.com/sailenceresw/myride/blob/main/mobile/src/components/RiderApplication.tsx): `mobile/src/components/RiderApplication.tsx`
- [API client](https://github.com/sailenceresw/myride/blob/main/mobile/src/lib/api.ts): `mobile/src/lib/api.ts`
- [Live events](https://github.com/sailenceresw/myride/blob/main/mobile/src/lib/useEvents.ts): `mobile/src/lib/useEvents.ts`

### API and trip operations

- [Express API](https://github.com/sailenceresw/myride/blob/main/src/app.js): `src/app.js`
- [Trip and account logic](https://github.com/sailenceresw/myride/blob/main/src/service.js): `src/service.js`
- [Fare calculation](https://github.com/sailenceresw/myride/blob/main/src/pricing.js): `src/pricing.js`
- [Places and routing](https://github.com/sailenceresw/myride/blob/main/src/geo.js): `src/geo.js`
- [Driver matching](https://github.com/sailenceresw/myride/blob/main/src/dispatch.js): `src/dispatch.js`
- [JSON state store](https://github.com/sailenceresw/myride/blob/main/src/store.js): `src/store.js`
- [Demo fleet simulator](https://github.com/sailenceresw/myride/blob/main/src/simulator.js): `src/simulator.js`
- [Server entrypoint](https://github.com/sailenceresw/myride/blob/main/server.js): `server.js`

### Rider trust and earnings

- [KYC validation](https://github.com/sailenceresw/myride/blob/main/src/kyc.js): `src/kyc.js`
- [Selfie verification](https://github.com/sailenceresw/myride/blob/main/src/faceVerify.js): `src/faceVerify.js`
- [Membership and rewards](https://github.com/sailenceresw/myride/blob/main/src/rewards.js): `src/rewards.js`
- [Payment processing](https://github.com/sailenceresw/myride/blob/main/src/payments.js): `src/payments.js`
- [Weekly payroll](https://github.com/sailenceresw/myride/blob/main/src/payroll.js): `src/payroll.js`
- [SMS messaging](https://github.com/sailenceresw/myride/blob/main/src/sms.js): `src/sms.js`

### Staff operations

- [Unit economics](https://github.com/sailenceresw/myride/blob/main/src/economics.js): `src/economics.js`
- [Ops console](https://github.com/sailenceresw/myride/blob/main/public/admin.js): `public/admin.js`

### Other components

- **MyRide staff**
- **OSRM routing**
- **SMS gateways**
- **eSewa and Khalti**

## Connections

- Customer app → API client: uses (evidence: `README.md`)
- Driver app → API client: uses (evidence: `README.md`)
- Rider application → API client: submits to (evidence: `README.md`)
- API client → Express API: REST requests (evidence: `README.md`)
- Live events → Express API: receives SSE (evidence: `mobile/src/lib/useEvents.ts`)
- Express API → Trip and account logic: delegates (evidence: `src/app.js`)
- Express API → Fare calculation: calculates fares (evidence: `src/app.js`)
- Express API → Places and routing: uses places and routes (evidence: `src/app.js`)
- Express API → Unit economics: serves projections (evidence: `src/app.js`)
- Express API → Weekly payroll: serves payroll (evidence: `src/app.js`)
- Express API → Payment processing: handles payments (evidence: `src/app.js`)
- Express API → JSON state store: creates and uses (evidence: `server.js`)
- Trip and account logic → Fare calculation: quotes fares (evidence: `src/service.js`)
- Trip and account logic → Places and routing: checks and routes (evidence: `src/service.js`)
- Trip and account logic → Driver matching: finds candidates (evidence: `src/service.js`)
- Trip and account logic → Membership and rewards: uses rewards (evidence: `src/service.js`)
- Trip and account logic → KYC validation: validates riders (evidence: `src/service.js`)
- Trip and account logic → Selfie verification: verifies selfies (evidence: `src/service.js`)
- Trip and account logic → Weekly payroll: uses payroll (evidence: `src/service.js`)
- Trip and account logic → SMS messaging: sends messages (evidence: `src/service.js`)
- Server entrypoint → Demo fleet simulator: starts (evidence: `server.js`)
- Demo fleet simulator → Places and routing: uses routing (evidence: `src/simulator.js`)
- Places and routing → OSRM routing: requests routes (evidence: `src/geo.js`)
- SMS messaging → SMS gateways: sends SMS (evidence: `README.md`)
- Payment processing → eSewa and Khalti: processes payments (evidence: `README.md`)
- MyRide staff → Ops console: reviews and monitors (evidence: `README.md`)
- Ops console → Express API: uses API (evidence: `README.md`)
- Express API → KYC validation: supports review (evidence: `README.md`)
