# pratzyy370/routewise architecture

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

- Interactive diagram: https://gitdiagram.com/pratzyy370/routewise
- Repository: https://github.com/pratzyy370/routewise

## Overview

RouteWise is a Bengaluru-focused mobility platform: users compare ride-hailing quotes or request optimized multimodal journeys, then receive ranked route options with cost, time, and provenance details. Its API also supports metro discovery, accounts and saved places, fare history and alerts, and trip-based savings analysis. The graph includes the documented background alert workflow and dashboard. Some endpoint and service implementations were not sampled; those capability branches are based on the README and source index, not inspection of unsampled code.

Main entry points: [`app/api/v1/router.py`](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/router.py) (API v1 router), [`app/services/journey_service.py`](https://github.com/pratzyy370/routewise/blob/main/app/services/journey_service.py) (Journey optimizer), [`app/main.py`](https://github.com/pratzyy370/routewise/blob/main/app/main.py) (FastAPI app), [`app/api/v1/endpoints/fares.py`](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/fares.py) (Fare endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and dashboard"]
  node_api["FastAPI app<br/>[main.py]"]
  node_router["API v1 router<br/>[router.py]"]
  node_dashboard["Web dashboard<br/>[app.js]"]
end

subgraph group_journeys["Journey planning"]
  node_journey_api["Journey endpoints<br/>[journeys.py]"]
  node_journey_service["Journey optimizer<br/>[journey_service.py]"]
  node_routing_engine["Routing engine<br/>[engine.py]"]
  node_journey_records["Journey records<br/>[journey_repo.py]"]
end

subgraph group_mobility["Mobility data"]
  node_fare_api["Fare endpoints<br/>[fares.py]"]
  node_fare_service["Fare comparison<br/>[fare_service.py]"]
  node_provider_registry["Provider registry<br/>[registry.py]"]
  node_demo_providers["Demo providers<br/>[demo_providers.py]"]
  node_fare_records["Fare repository<br/>[fare_repo.py]"]
  node_metro_api["Metro endpoints<br/>[metro.py]"]
  node_metro_service["Metro discovery<br/>[metro_service.py]"]
  node_metro_records["Metro repository<br/>[metro_repo.py]"]
end

subgraph group_accounts["Accounts and spending"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_dependencies["Auth dependencies<br/>[dependencies.py]"]
  node_security["Token security<br/>[security.py]"]
  node_places_api["Saved places<br/>[places.py]"]
  node_trips_api["Trip logging<br/>[trips.py]"]
  node_savings["Savings analysis<br/>[savings_service.py]"]
end

subgraph group_operations["Background operations"]
  node_alerts["Fare alerts<br/>[alert_service.py]"]
  node_analytics["Fare analytics"]
  node_worker["Celery worker<br/>[worker.py]"]
end

node_traveler(("Traveler"))
node_database[("Relational database")]

node_traveler -->|"uses"| node_api
node_api -->|"mounts"| node_router
node_api -.->|"serves dashboard"| node_dashboard
node_router -->|"routes to"| node_journey_api
node_router -->|"routes to"| node_fare_api
node_router -->|"routes to"| node_metro_api
node_router -->|"routes to"| node_auth_api
node_router -->|"routes to"| node_places_api
node_router -->|"routes to"| node_trips_api
node_journey_api -->|"calls"| node_journey_service
node_journey_service -->|"compares fares"| node_fare_service
node_journey_service -->|"uses routing"| node_routing_engine
node_journey_service -->|"uses metro"| node_metro_service
node_journey_service -->|"persists options"| node_journey_records
node_fare_api -->|"uses alerts"| node_alerts
node_fare_api -->|"uses analytics"| node_analytics
node_fare_service -->|"gets providers"| node_provider_registry
node_fare_service -->|"saves quotes"| node_fare_records
node_provider_registry -->|"registers"| node_demo_providers
node_metro_api -->|"calls"| node_metro_service
node_metro_api -->|"queries"| node_metro_records
node_metro_service -->|"reads stations"| node_metro_records
node_auth_api -->|"creates tokens"| node_security
node_auth_api -->|"uses auth"| node_dependencies
node_dependencies -->|"decodes tokens"| node_security
node_places_api -->|"manages places"| node_traveler
node_trips_api -.->|"analyzes spending"| node_savings
node_worker -->|"evaluates alerts"| node_alerts
node_alerts -->|"reads fare data"| node_fare_records
node_api -->|"initializes schema"| node_database
node_journey_records -.->|"persists journeys"| node_database
node_fare_records -.->|"persists fares"| node_database
node_metro_records -.->|"reads stations"| node_database

click node_api "https://github.com/pratzyy370/routewise/blob/main/app/main.py"
click node_router "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/router.py"
click node_dashboard "https://github.com/pratzyy370/routewise/blob/main/app/static/js/app.js"
click node_journey_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/journeys.py"
click node_journey_service "https://github.com/pratzyy370/routewise/blob/main/app/services/journey_service.py"
click node_routing_engine "https://github.com/pratzyy370/routewise/blob/main/app/routing/engine.py"
click node_journey_records "https://github.com/pratzyy370/routewise/blob/main/app/repositories/journey_repo.py"
click node_fare_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/fares.py"
click node_fare_service "https://github.com/pratzyy370/routewise/blob/main/app/services/fare_service.py"
click node_provider_registry "https://github.com/pratzyy370/routewise/blob/main/app/providers/registry.py"
click node_demo_providers "https://github.com/pratzyy370/routewise/blob/main/app/providers/demo_providers.py"
click node_fare_records "https://github.com/pratzyy370/routewise/blob/main/app/repositories/fare_repo.py"
click node_metro_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/metro.py"
click node_metro_service "https://github.com/pratzyy370/routewise/blob/main/app/services/metro_service.py"
click node_metro_records "https://github.com/pratzyy370/routewise/blob/main/app/repositories/metro_repo.py"
click node_auth_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/auth.py"
click node_dependencies "https://github.com/pratzyy370/routewise/blob/main/app/api/dependencies.py"
click node_security "https://github.com/pratzyy370/routewise/blob/main/app/core/security.py"
click node_places_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/places.py"
click node_trips_api "https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/trips.py"
click node_savings "https://github.com/pratzyy370/routewise/blob/main/app/services/savings_service.py"
click node_alerts "https://github.com/pratzyy370/routewise/blob/main/app/services/alert_service.py"
click node_analytics "https://github.com/pratzyy370/routewise/blob/main/app/services/fare_analytics_service.py"
click node_worker "https://github.com/pratzyy370/routewise/blob/main/app/tasks/worker.py"

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_api,node_router,node_dashboard toneBlue
class node_journey_api,node_journey_service,node_routing_engine,node_journey_records,node_database toneAmber
class node_fare_api,node_fare_service,node_provider_registry,node_demo_providers,node_fare_records,node_metro_api,node_metro_service,node_metro_records toneMint
class node_auth_api,node_dependencies,node_security,node_places_api,node_trips_api,node_savings toneRose
class node_alerts,node_analytics,node_worker,node_traveler toneIndigo
```

## Components

### API and dashboard

- [FastAPI app](https://github.com/pratzyy370/routewise/blob/main/app/main.py): `app/main.py`
- [API v1 router](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/router.py): `app/api/v1/router.py`
- [Web dashboard](https://github.com/pratzyy370/routewise/blob/main/app/static/js/app.js): `app/static/js/app.js`

### Journey planning

- [Journey endpoints](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/journeys.py): `app/api/v1/endpoints/journeys.py`
- [Journey optimizer](https://github.com/pratzyy370/routewise/blob/main/app/services/journey_service.py): `app/services/journey_service.py`
- [Routing engine](https://github.com/pratzyy370/routewise/blob/main/app/routing/engine.py): `app/routing/engine.py`
- [Journey records](https://github.com/pratzyy370/routewise/blob/main/app/repositories/journey_repo.py): `app/repositories/journey_repo.py`

### Mobility data

- [Fare endpoints](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/fares.py): `app/api/v1/endpoints/fares.py`
- [Fare comparison](https://github.com/pratzyy370/routewise/blob/main/app/services/fare_service.py): `app/services/fare_service.py`
- [Provider registry](https://github.com/pratzyy370/routewise/blob/main/app/providers/registry.py): `app/providers/registry.py`
- [Demo providers](https://github.com/pratzyy370/routewise/blob/main/app/providers/demo_providers.py): `app/providers/demo_providers.py`
- [Fare repository](https://github.com/pratzyy370/routewise/blob/main/app/repositories/fare_repo.py): `app/repositories/fare_repo.py`
- [Metro endpoints](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/metro.py): `app/api/v1/endpoints/metro.py`
- [Metro discovery](https://github.com/pratzyy370/routewise/blob/main/app/services/metro_service.py): `app/services/metro_service.py`
- [Metro repository](https://github.com/pratzyy370/routewise/blob/main/app/repositories/metro_repo.py): `app/repositories/metro_repo.py`

### Accounts and spending

- [Authentication](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/auth.py): `app/api/v1/endpoints/auth.py`
- [Auth dependencies](https://github.com/pratzyy370/routewise/blob/main/app/api/dependencies.py): `app/api/dependencies.py`
- [Token security](https://github.com/pratzyy370/routewise/blob/main/app/core/security.py): `app/core/security.py`
- [Saved places](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/places.py): `app/api/v1/endpoints/places.py`
- [Trip logging](https://github.com/pratzyy370/routewise/blob/main/app/api/v1/endpoints/trips.py): `app/api/v1/endpoints/trips.py`
- [Savings analysis](https://github.com/pratzyy370/routewise/blob/main/app/services/savings_service.py): `app/services/savings_service.py`

### Background operations

- [Fare alerts](https://github.com/pratzyy370/routewise/blob/main/app/services/alert_service.py): `app/services/alert_service.py`
- [Fare analytics](https://github.com/pratzyy370/routewise/blob/main/app/services/fare_analytics_service.py): `app/services/fare_analytics_service.py`
- [Celery worker](https://github.com/pratzyy370/routewise/blob/main/app/tasks/worker.py): `app/tasks/worker.py`

### Other components

- **Traveler**
- **Relational database**

## Connections

- Traveler → FastAPI app: uses
- FastAPI app → API v1 router: mounts (evidence: `app/main.py`)
- FastAPI app → Web dashboard: serves dashboard
- API v1 router → Journey endpoints: routes to (evidence: `app/api/v1/router.py`)
- API v1 router → Fare endpoints: routes to (evidence: `app/api/v1/router.py`)
- API v1 router → Metro endpoints: routes to (evidence: `app/api/v1/router.py`)
- API v1 router → Authentication: routes to (evidence: `app/api/v1/router.py`)
- API v1 router → Saved places: routes to (evidence: `app/api/v1/router.py`)
- API v1 router → Trip logging: routes to (evidence: `app/api/v1/router.py`)
- Journey endpoints → Journey optimizer: calls (evidence: `app/api/v1/endpoints/journeys.py`)
- Journey optimizer → Fare comparison: compares fares (evidence: `app/services/journey_service.py`)
- Journey optimizer → Routing engine: uses routing (evidence: `app/services/journey_service.py`)
- Journey optimizer → Metro discovery: uses metro (evidence: `app/services/journey_service.py`)
- Journey optimizer → Journey records: persists options (evidence: `app/services/journey_service.py`)
- Fare endpoints → Fare alerts: uses alerts (evidence: `app/api/v1/endpoints/fares.py`)
- Fare endpoints → Fare analytics: uses analytics (evidence: `app/api/v1/endpoints/fares.py`)
- Fare comparison → Provider registry: gets providers (evidence: `app/services/fare_service.py`)
- Fare comparison → Fare repository: saves quotes (evidence: `app/services/fare_service.py`)
- Provider registry → Demo providers: registers (evidence: `app/providers/registry.py`)
- Metro endpoints → Metro discovery: calls (evidence: `app/api/v1/endpoints/metro.py`)
- Metro endpoints → Metro repository: queries (evidence: `app/api/v1/endpoints/metro.py`)
- Metro discovery → Metro repository: reads stations (evidence: `app/services/metro_service.py`)
- Authentication → Token security: creates tokens (evidence: `app/api/v1/endpoints/auth.py`)
- Authentication → Auth dependencies: uses auth (evidence: `app/api/v1/endpoints/auth.py`)
- Auth dependencies → Token security: decodes tokens (evidence: `app/api/dependencies.py`)
- Saved places → Traveler: manages places
- Trip logging → Savings analysis: analyzes spending
- Celery worker → Fare alerts: evaluates alerts (evidence: `app/tasks/worker.py`)
- Fare alerts → Fare repository: reads fare data (evidence: `app/services/alert_service.py`)
- FastAPI app → Relational database: initializes schema (evidence: `app/main.py`)
- Journey records → Relational database: persists journeys
- Fare repository → Relational database: persists fares
- Metro repository → Relational database: reads stations
