# drago-03/price-pilot architecture

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

- Interactive diagram: https://gitdiagram.com/drago-03/price-pilot
- Repository: https://github.com/drago-03/price-pilot

## Overview

##### Project type and purpose
- From the file tree and README, Price Pilot is a single-page, front-end web application (React + TypeScript) that runs entirely in the browser.
- Purpose: provide real-time ride-hailing price comparisons (Uber, Ola, Rapido), show routes on Google Maps, and redirect users for booking.

##### File structure
- Top-level config & tooling:
- package.json, tsconfig*.json, vite.config.ts, tailwind.config.js, eslint.config.js
- .env for API keys, CI workflow under .github/workflows
- Public & assets:
- index.html, public/images, assets/images
- src/:
- App.tsx & main.tsx as entry points
- components/: UI building blocks (Map, About, Contact, HowItWorks, Team, Footer)
- index.css for base styles
- No custom backend code—services live in-browser via external HTTP calls.

##### README for additional insights
- Tech stack: React 18, TS 5.0+, Tailwind CSS, React Context API, Vite.
- External integrations:
- Google Maps JavaScript & Places & Directions & Geocoding APIs
- Ride-service APIs: Uber Rides API, Ola API, (implied Rapido)
- State: managed client-side with Context.
- Testing: Jest + React Testing Library.

##### Components
a. Main components
- Browser / Client
- React Application:
- UI Layer (components folder)
- State Layer (React Context)
- Service Layer (API‐calling functions)
- External Services:
- Google Maps Platform (Maps JS, Directions, Places, Geocoding)
- Ride Providers (Uber, Ola, Rapido APIs)
- Build & Deployment: Vite → dist → Vercel/Netlify/GitHub Pages
b. Relationships & interactions
- User interacts with UI → Context stores origin/destination → Service Layer issues HTTP calls → External Services respond with location, route, price data → Context updates state → UI updates Map & price list → Booking button triggers redirect to provider.
- Dev pipeline: Code → Vite builds → CI runs lint/tests → Deploy to hosting.
c. Architectural patterns & design principles
- Component-driven architecture (Atomic UI)
- Unidirectional data flow (React Context → props)
- Separation of concerns: UI vs. state vs. side-effects (API calls)
- Responsive design (Tailwind + mobile-first)
d. Key technologies & libraries
- React 18 + TypeScript + React Context API
- Google Maps Platform (JS, Places, Directions, Geocoding)
- Uber/Ola/Rapido REST APIs
- Vite build tool, Tailwind CSS, ESLint, Jest

##### Essential elements—don’t overcomplicate
- Environment variables store (.env) feeding into build.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User(("User")):::user

    %% Browser and React App
    subgraph "Browser" 
        direction TB
        subgraph "React Application" 
            direction TB
            %% Entry Points
            Main["src/main.tsx"]:::frontend
            App["src/App.tsx"]:::frontend

            %% UI Layer
            subgraph "UI Layer" 
                direction TB
                About["About Component"]:::frontend
                Contact["Contact Component"]:::frontend
                HowItWorks["HowItWorks Component"]:::frontend
                MapComp["Map Component"]:::frontend
                Team["Team Component"]:::frontend
                Footer["Footer Component"]:::frontend
            end

            %% State Layer
            Context["React Context (State Store)"]:::frontend

            %% Service Layer
            subgraph "Service Layer" 
                direction TB
                MapService["Google Maps Adapter"]:::frontend
                RideAdapter["RideServiceAdapter (Uber, Ola, Rapido)"]:::frontend
            end
        end

    end

    %% External Services
    subgraph "External Services" 
        direction TB
        GoogleMaps["Google Maps Platform"]:::external
        UberAPI["Uber Rides API"]:::external
        OlaAPI["Ola API"]:::external
        RapidoAPI["Rapido API"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment" 
        direction TB
        Env[".env"]:::build
        Vite["vite.config.ts"]:::build
        CI[".github/workflows/dart.yml"]:::build
        Dist["dist"]:::build
        Host["Vercel/Netlify/GitHub Pages"]:::build
    end

    %% Public & Assets and Config
    Public["public/images & assets/images"]:::frontend
    Styles["src/index.css\ntailwind.config.js\npostcss.config.js"]:::frontend
    TSConfig["tsconfig.json\ntsconfig.app.json\ntsconfig.node.json"]:::frontend
    Package["package.json\npackage-lock.json"]:::frontend

    %% Interactions
    User -->|"interacts with"| About
    User --> MapComp
    About --> Context
    Contact --> Context
    HowItWorks --> Context
    MapComp --> Context
    Team --> Context
    Footer --> Context

    Context -->|"requests geocoding"| MapService
    Context -->|"requests pricing"| RideAdapter

    MapService --> GoogleMaps
    RideAdapter --> UberAPI
    RideAdapter --> OlaAPI
    RideAdapter --> RapidoAPI

    GoogleMaps --> Context
    UberAPI --> Context
    OlaAPI --> Context
    RapidoAPI --> Context

    Context --> MapComp
    Context --> About
    Context --> Contact
    Context --> HowItWorks
    Context --> Team
    Context --> Footer

    %% Build flow
    Package -->|"uses"| Vite
    Env --> Vite
    TSConfig --> Vite
    Styles --> Vite
    CI --> Vite
    Vite --> Dist
    Dist --> Host

    %% Public assets serve
    Public --> Host

    %% Click Events
    click Main "https://github.com/drago-03/price-pilot/blob/main/src/main.tsx"
    click App "https://github.com/drago-03/price-pilot/blob/main/src/App.tsx"
    click About "https://github.com/drago-03/price-pilot/blob/main/src/components/About.tsx"
    click Contact "https://github.com/drago-03/price-pilot/blob/main/src/components/Contact.tsx"
    click HowItWorks "https://github.com/drago-03/price-pilot/blob/main/src/components/HowItWorks.tsx"
    click MapComp "https://github.com/drago-03/price-pilot/blob/main/src/components/Map.tsx"
    click Team "https://github.com/drago-03/price-pilot/blob/main/src/components/Team.tsx"
    click Footer "https://github.com/drago-03/price-pilot/blob/main/src/components/Footer.tsx"
    click Styles "https://github.com/drago-03/price-pilot/blob/main/src/index.css"
    click Styles "https://github.com/drago-03/price-pilot/blob/main/tailwind.config.js"
    click Styles "https://github.com/drago-03/price-pilot/blob/main/postcss.config.js"
    click TSConfig "https://github.com/drago-03/price-pilot/blob/main/tsconfig.json"
    click TSConfig "https://github.com/drago-03/price-pilot/blob/main/tsconfig.app.json"
    click TSConfig "https://github.com/drago-03/price-pilot/blob/main/tsconfig.node.json"
    click Vite "https://github.com/drago-03/price-pilot/blob/main/vite.config.ts"
    click Env "https://github.com/drago-03/price-pilot/blob/main/.env"
    click CI "https://github.com/drago-03/price-pilot/blob/main/.github/workflows/dart.yml"
    click Public "https://github.com/drago-03/price-pilot/tree/main/public/images"
    click Public "https://github.com/drago-03/price-pilot/tree/main/assets/images"
    click Package "https://github.com/drago-03/price-pilot/blob/main/package.json"
    click Package "https://github.com/drago-03/price-pilot/blob/main/package-lock.json"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px
    classDef build fill:#FFA500,stroke:#000,stroke-width:1px
    classDef user fill:#FFB6C1,stroke:#000,stroke-width:1px
```
