# harshitvanani/apix architecture

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

- Interactive diagram: https://gitdiagram.com/harshitvanani/apix
- Repository: https://github.com/harshitvanani/apix

## Overview

APIx collects airline fares, standardizes and validates them, calculates a daily fare index, and serves fare, trend, and route analytics through an institutional dashboard and API. The principal ingestion and database relationships are supported by sampled source; the tree indicates additional API and visualization modules, but their internal calls were not sampled, so those connections are left conservative.

Main entry points: [`backend/api/main.py`](https://github.com/harshitvanani/apix/blob/main/backend/api/main.py) (FastAPI service), [`frontend/src/DashboardView.jsx`](https://github.com/harshitvanani/apix/blob/main/frontend/src/DashboardView.jsx) (Dashboard view), [`backend/scrapers/master_orchestrator.py`](https://github.com/harshitvanani/apix/blob/main/backend/scrapers/master_orchestrator.py) (Harvest coordinator), [`backend/tasks/ingestion_pipeline.py`](https://github.com/harshitvanani/apix/blob/main/backend/tasks/ingestion_pipeline.py) (Ingestion pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Fare collection"]
  node_master["Harvest coordinator"]
  node_airline_scrapers["Airline scrapers"]
  node_ota_scrapers["OTA scrapers<br/>[ota_scrapers.py]"]
  node_scrape_engines["Scrape engines"]
end

subgraph group_processing["Data processing"]
  node_ingestion["Ingestion pipeline"]
  node_cleaning["Fare cleansing"]
  node_index["Index calculation"]
  node_dgca_validation["DGCA validation"]
end

subgraph group_persistence["Persistence and cache"]
  node_mongo_manager["Mongo connection<br/>[mongo_manager.py]"]
  node_mongodb[("Fare and index store")]
  node_redis[("Redis cache")]
end

subgraph group_service["API and validation"]
  node_api["FastAPI service<br/>[main.py]"]
  node_db_service["Database access<br/>[db_service.py]"]
  node_fares_api["Fare endpoints<br/>[fares.py]"]
  node_analytics_api["Analytics endpoints<br/>[analytics.py]"]
end

subgraph group_presentation["Institutional dashboard"]
  node_app["Authenticated app<br/>[App.jsx]"]
  node_dashboard["Dashboard view<br/>[DashboardView.jsx]"]
  node_visualizations["Charts and metrics"]
  node_route_analytics["Route analytics view<br/>[RouteAnalytics.jsx]"]
  node_fare_table["Route fares table"]
end

node_officers(("Institutional users"))
node_airline_sources(("Airline and OTA sources"))

node_officers -->|"use portal"| node_app
node_app -->|"routes to"| node_dashboard
node_airline_sources -.->|"provide fares"| node_airline_scrapers
node_airline_sources -.->|"provide fares"| node_ota_scrapers
node_master -->|"dispatches harvest"| node_airline_scrapers
node_master -->|"dispatches harvest"| node_ota_scrapers
node_airline_scrapers -->|"use engines"| node_scrape_engines
node_ota_scrapers -->|"use engines"| node_scrape_engines
node_master -->|"submits fares"| node_ingestion
node_ingestion -->|"cleans fares"| node_cleaning
node_ingestion -->|"reads and writes"| node_mongodb
node_cleaning -->|"reads and writes"| node_mongodb
node_index -->|"stores index"| node_mongodb
node_dgca_validation -->|"reads fares"| node_mongodb
node_mongo_manager -->|"connects"| node_mongodb
node_api -->|"uses connection"| node_mongo_manager
node_api -->|"caches fare stats"| node_redis
node_api -->|"uses data access"| node_db_service
node_api -->|"mounts routes"| node_fares_api
node_api -->|"mounts routes"| node_analytics_api
node_dashboard -->|"renders charts"| node_visualizations
node_dashboard -->|"renders analytics"| node_route_analytics
node_dashboard -->|"renders fares"| node_fare_table
node_app -->|"requests data"| node_api

click node_master "https://github.com/harshitvanani/apix/blob/main/backend/scrapers/master_orchestrator.py"
click node_airline_scrapers "https://github.com/harshitvanani/apix/blob/main/backend/scrapers/airline_scrapers.py"
click node_ota_scrapers "https://github.com/harshitvanani/apix/blob/main/backend/scrapers/ota_scrapers.py"
click node_scrape_engines "https://github.com/harshitvanani/apix/tree/main/backend/scrapers/engine"
click node_ingestion "https://github.com/harshitvanani/apix/blob/main/backend/tasks/ingestion_pipeline.py"
click node_cleaning "https://github.com/harshitvanani/apix/blob/main/backend/tasks/data_cleansing_service.py"
click node_index "https://github.com/harshitvanani/apix/blob/main/backend/services/index_calculator.py"
click node_dgca_validation "https://github.com/harshitvanani/apix/blob/main/backend/services/dgca_validation_service.py"
click node_mongo_manager "https://github.com/harshitvanani/apix/blob/main/backend/services/mongo_manager.py"
click node_api "https://github.com/harshitvanani/apix/blob/main/backend/api/main.py"
click node_db_service "https://github.com/harshitvanani/apix/blob/main/backend/services/db_service.py"
click node_fares_api "https://github.com/harshitvanani/apix/blob/main/backend/api/routes/fares.py"
click node_analytics_api "https://github.com/harshitvanani/apix/blob/main/backend/api/routes/analytics.py"
click node_app "https://github.com/harshitvanani/apix/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/harshitvanani/apix/blob/main/frontend/src/DashboardView.jsx"
click node_visualizations "https://github.com/harshitvanani/apix/blob/main/frontend/src/components/VisualizationSuite.jsx"
click node_route_analytics "https://github.com/harshitvanani/apix/blob/main/frontend/src/components/RouteAnalytics.jsx"
click node_fare_table "https://github.com/harshitvanani/apix/blob/main/frontend/src/components/RouteFaresTable.jsx"

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_master,node_airline_scrapers,node_ota_scrapers,node_scrape_engines,node_officers toneBlue
class node_ingestion,node_cleaning,node_index,node_dgca_validation toneAmber
class node_mongo_manager,node_mongodb,node_redis toneMint
class node_api,node_db_service,node_fares_api,node_analytics_api toneRose
class node_app,node_dashboard,node_visualizations,node_route_analytics,node_fare_table,node_airline_sources toneIndigo
```

## Components

### Fare collection

- [Harvest coordinator](https://github.com/harshitvanani/apix/blob/main/backend/scrapers/master_orchestrator.py): `backend/scrapers/master_orchestrator.py`
- [Airline scrapers](https://github.com/harshitvanani/apix/blob/main/backend/scrapers/airline_scrapers.py): `backend/scrapers/airline_scrapers.py`
- [OTA scrapers](https://github.com/harshitvanani/apix/blob/main/backend/scrapers/ota_scrapers.py): `backend/scrapers/ota_scrapers.py`
- [Scrape engines](https://github.com/harshitvanani/apix/tree/main/backend/scrapers/engine): `backend/scrapers/engine`

### Data processing

- [Ingestion pipeline](https://github.com/harshitvanani/apix/blob/main/backend/tasks/ingestion_pipeline.py): `backend/tasks/ingestion_pipeline.py`
- [Fare cleansing](https://github.com/harshitvanani/apix/blob/main/backend/tasks/data_cleansing_service.py): `backend/tasks/data_cleansing_service.py`
- [Index calculation](https://github.com/harshitvanani/apix/blob/main/backend/services/index_calculator.py): `backend/services/index_calculator.py`
- [DGCA validation](https://github.com/harshitvanani/apix/blob/main/backend/services/dgca_validation_service.py): `backend/services/dgca_validation_service.py`

### Persistence and cache

- [Mongo connection](https://github.com/harshitvanani/apix/blob/main/backend/services/mongo_manager.py): `backend/services/mongo_manager.py`
- **Fare and index store**
- **Redis cache**

### API and validation

- [FastAPI service](https://github.com/harshitvanani/apix/blob/main/backend/api/main.py): `backend/api/main.py`
- [Database access](https://github.com/harshitvanani/apix/blob/main/backend/services/db_service.py): `backend/services/db_service.py`
- [Fare endpoints](https://github.com/harshitvanani/apix/blob/main/backend/api/routes/fares.py): `backend/api/routes/fares.py`
- [Analytics endpoints](https://github.com/harshitvanani/apix/blob/main/backend/api/routes/analytics.py): `backend/api/routes/analytics.py`

### Institutional dashboard

- [Authenticated app](https://github.com/harshitvanani/apix/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard view](https://github.com/harshitvanani/apix/blob/main/frontend/src/DashboardView.jsx): `frontend/src/DashboardView.jsx`
- [Charts and metrics](https://github.com/harshitvanani/apix/blob/main/frontend/src/components/VisualizationSuite.jsx): `frontend/src/components/VisualizationSuite.jsx`
- [Route analytics view](https://github.com/harshitvanani/apix/blob/main/frontend/src/components/RouteAnalytics.jsx): `frontend/src/components/RouteAnalytics.jsx`
- [Route fares table](https://github.com/harshitvanani/apix/blob/main/frontend/src/components/RouteFaresTable.jsx): `frontend/src/components/RouteFaresTable.jsx`

### Other components

- **Institutional users**
- **Airline and OTA sources**

## Connections

- Institutional users → Authenticated app: use portal
- Authenticated app → Dashboard view: routes to
- Airline and OTA sources → Airline scrapers: provide fares
- Airline and OTA sources → OTA scrapers: provide fares
- Harvest coordinator → Airline scrapers: dispatches harvest
- Harvest coordinator → OTA scrapers: dispatches harvest
- Airline scrapers → Scrape engines: use engines
- OTA scrapers → Scrape engines: use engines
- Harvest coordinator → Ingestion pipeline: submits fares
- Ingestion pipeline → Fare cleansing: cleans fares
- Ingestion pipeline → Fare and index store: reads and writes
- Fare cleansing → Fare and index store: reads and writes
- Index calculation → Fare and index store: stores index
- DGCA validation → Fare and index store: reads fares
- Mongo connection → Fare and index store: connects
- FastAPI service → Mongo connection: uses connection
- FastAPI service → Redis cache: caches fare stats
- FastAPI service → Database access: uses data access
- FastAPI service → Fare endpoints: mounts routes
- FastAPI service → Analytics endpoints: mounts routes
- Dashboard view → Charts and metrics: renders charts
- Dashboard view → Route analytics view: renders analytics
- Dashboard view → Route fares table: renders fares
- Authenticated app → FastAPI service: requests data
