# karthik5718/flight-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/karthik5718/flight-tracker
- Repository: https://github.com/karthik5718/flight-tracker

## Overview

#### Purpose and entry points
This is a full-stack flight-information and tracking system with separate Django REST backend and React/Vite frontend. The backend process starts through `backend/manage.py`, with WSGI/ASGI deployment entry points at `backend/core/wsgi.py` and `backend/core/asgi.py`. The browser application starts at `frontend/src/main.jsx` and composes routes/UI in `frontend/src/App.jsx`.

#### Backend API composition
Django’s project-level URL boundary is split between general project routing and API routing in `backend/core/urls.py` and `backend/core/api_urls.py`. Feature apps expose their own endpoints through `backend/accounts/urls.py`, `backend/airports/urls.py`, `backend/flights/urls.py`, `backend/tracking/urls.py`, and `backend/weather/urls.py`. Views are the HTTP orchestration layer, serializing domain data and invoking adapters/services.

#### Identity and access control
The accounts domain manages users and air-traffic-controller profiles via `backend/accounts/models.py`, request/response representations in `backend/accounts/serializers.py`, and authorization rules in `backend/accounts/permissions.py`. On the frontend, authentication state is centralized in `frontend/src/context/AuthContext.jsx`; protected navigation is separated into ordinary-user and ATC-specific guards in `frontend/src/components/ProtectedRoute.jsx` and `frontend/src/components/ATCProtectedRoute.jsx`.

#### Flight, airport, and position domains
Persistent Django models organize the core aviation data: airports in `backend/airports/models.py`, flights in `backend/flights/models.py`, and live/historical flight positions in `backend/tracking/models.py`. Their serializers and views form the API-facing transformation boundary, for example `backend/flights/serializers.py`, `backend/flights/views.py`, and `backend/tracking/views.py`. Flight tracking is therefore distinct from flight metadata, allowing position updates to evolve independently of airport or flight records.

#### External data integration and caching
Provider-specific service modules isolate third-party API calls: AeroDataBox airport data in `backend/airports/services/aerodatabox.py`, AirLabs flight data in `backend/flights/services/airlabs.py`, and Open-Meteo weather data in `backend/weather/services/open_meteo.py`. Adapter modules—such as `backend/airports/adapters.py`, `backend/flights/adapters.py`, and `backend/weather/adapters.py`—are the normalization boundary between provider payloads and application-facing data. Shared cache behavior is centralized in `backend/core/cache.py`, likely protecting remote calls and repeat reads.

#### Frontend operational views
The UI is organized around authenticated workflows: tracking in `frontend/src/pages/Tracking.jsx`, airport information in `frontend/src/pages/Airport.jsx`, and controller operations in `frontend/src/pages/ATCDashboard.jsx`. Mapping and flight visualization are componentized in `frontend/src/components/Map.jsx`, `frontend/src/components/AircraftMarker.jsx`, and `frontend/src/components/FlightDetailsPanel.jsx`. `frontend/src/components/Layout.jsx` and `frontend/src/components/Navbar.jsx` provide the shared application shell.

#### Runtime and infrastructure boundaries
The backend uses Django settings layered as base, development, and production modules at `backend/core/settings/base.py`, `backend/core/settings/dev.py`, and `backend/core/settings/prod.py`; database schema evolution is represented by per-app migrations. The frontend is a Vite-managed React application (`frontend/vite.config.js`, `frontend/package.json`). Environment files exist separately for backend and frontend, while external aviation and weather services remain behind backend service boundaries rather than being called directly from browser components.

Main entry points: [`backend/flights/views.py`](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/views.py) (API views), [`backend/flights/services/airlabs.py`](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/services/airlabs.py) (Provider services), [`frontend/src/App.jsx`](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/App.jsx) (App routes and UI), [`backend/core/api_urls.py`](https://github.com/karthik5718/flight-tracker/blob/main/backend/core/api_urls.py) (API URL routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Django backend"]
  node_django_runtime{{"Django runtime<br/>process entry<br/>[manage.py]"}}
  node_settings["Layered settings<br/>configuration boundary<br/>[base.py]"]
  node_project_urls["Project URL routing<br/>HTTP routing<br/>[urls.py]"]
  node_api_urls["API URL routing<br/>API boundary<br/>[api_urls.py]"]
  node_feature_endpoints["Feature endpoints<br/>Django app routes<br/>[urls.py]"]
  node_api_views["API views<br/>HTTP orchestration<br/>[views.py]"]
  node_identity_access["Identity and access<br/>accounts domain<br/>[models.py]"]
  node_aviation_models[("Aviation records<br/>persistent domain<br/>[models.py]")]
  node_position_models[("Flight positions<br/>tracking domain<br/>[models.py]")]
  node_provider_adapters["Provider adapters<br/>normalization layer<br/>[adapters.py]"]
  node_provider_services["Provider services<br/>integration layer<br/>[airlabs.py]"]
  node_cache[("Shared cache<br/>cache service<br/>[cache.py]")]
end

subgraph group_frontend["React frontend"]
  node_browser_entry{{"Browser entry<br/>React entry<br/>[main.jsx]"}}
  node_app_routes["App routes and UI<br/>application composition<br/>[App.jsx]"]
  node_auth_state["Authentication state<br/>React context<br/>[AuthContext.jsx]"]
  node_route_guards["Route guards<br/>access control<br/>[ProtectedRoute.jsx]"]
  node_operational_pages["Operational pages<br/>workflow views<br/>[Tracking.jsx]"]
  node_map_visualization["Map visualization<br/>flight UI<br/>[Map.jsx]"]
end

subgraph group_providers["External providers"]
  node_aerodatabox(("AeroDataBox<br/>airport provider<br/>[aerodatabox.py]"))
  node_airlabs(("AirLabs<br/>flight provider<br/>[airlabs.py]"))
  node_open_meteo(("Open-Meteo<br/>weather provider<br/>[open_meteo.py]"))
end

node_django_runtime -->|"loads"| node_settings
node_django_runtime -->|"serves"| node_project_urls
node_project_urls -->|"delegates API routes"| node_api_urls
node_api_urls -->|"includes"| node_feature_endpoints
node_feature_endpoints -->|"dispatches"| node_api_views
node_api_views -->|"authenticates and authorizes"| node_identity_access
node_api_views -->|"reads and writes"| node_aviation_models
node_api_views -->|"reads and writes"| node_position_models
node_api_views -->|"uses external data"| node_provider_adapters
node_provider_adapters -->|"normalizes responses from"| node_provider_services
node_provider_services -->|"uses"| node_cache
node_provider_services -->|"airport data"| node_aerodatabox
node_provider_services -->|"flight data"| node_airlabs
node_provider_services -->|"weather data"| node_open_meteo
node_browser_entry -->|"mounts"| node_app_routes
node_app_routes -->|"consumes"| node_auth_state
node_app_routes -->|"applies"| node_route_guards
node_route_guards -->|"allows"| node_operational_pages
node_operational_pages -->|"renders tracking UI"| node_map_visualization
node_app_routes -->|"calls REST API"| node_api_urls
node_auth_state -->|"uses account API"| node_identity_access
node_map_visualization -.->|"displays positions via API"| node_position_models

click node_django_runtime "https://github.com/karthik5718/flight-tracker/blob/main/backend/manage.py"
click node_settings "https://github.com/karthik5718/flight-tracker/blob/main/backend/core/settings/base.py"
click node_project_urls "https://github.com/karthik5718/flight-tracker/blob/main/backend/core/urls.py"
click node_api_urls "https://github.com/karthik5718/flight-tracker/blob/main/backend/core/api_urls.py"
click node_feature_endpoints "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/urls.py"
click node_api_views "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/views.py"
click node_identity_access "https://github.com/karthik5718/flight-tracker/blob/main/backend/accounts/models.py"
click node_aviation_models "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/models.py"
click node_position_models "https://github.com/karthik5718/flight-tracker/blob/main/backend/tracking/models.py"
click node_provider_adapters "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/adapters.py"
click node_provider_services "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/services/airlabs.py"
click node_cache "https://github.com/karthik5718/flight-tracker/blob/main/backend/core/cache.py"
click node_browser_entry "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/main.jsx"
click node_app_routes "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/App.jsx"
click node_auth_state "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/context/AuthContext.jsx"
click node_route_guards "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/components/ProtectedRoute.jsx"
click node_operational_pages "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/pages/Tracking.jsx"
click node_map_visualization "https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/components/Map.jsx"
click node_aerodatabox "https://github.com/karthik5718/flight-tracker/blob/main/backend/airports/services/aerodatabox.py"
click node_airlabs "https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/services/airlabs.py"
click node_open_meteo "https://github.com/karthik5718/flight-tracker/blob/main/backend/weather/services/open_meteo.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_django_runtime,node_settings,node_project_urls,node_api_urls,node_feature_endpoints,node_api_views,node_identity_access,node_aviation_models,node_position_models,node_provider_adapters,node_provider_services,node_cache toneBlue
class node_browser_entry,node_app_routes,node_auth_state,node_route_guards,node_operational_pages,node_map_visualization toneAmber
class node_aerodatabox,node_airlabs,node_open_meteo toneMint
```

## Components

### Django backend

REST API, domain data, and provider integrations.

- [Django runtime](https://github.com/karthik5718/flight-tracker/blob/main/backend/manage.py): process entry · Starts the backend and supports WSGI/ASGI deployment. · `backend/manage.py`
- [Layered settings](https://github.com/karthik5718/flight-tracker/blob/main/backend/core/settings/base.py): configuration boundary · Base settings are specialized for development and production. · `backend/core/settings/base.py`
- [Project URL routing](https://github.com/karthik5718/flight-tracker/blob/main/backend/core/urls.py): HTTP routing · `backend/core/urls.py`
- [API URL routing](https://github.com/karthik5718/flight-tracker/blob/main/backend/core/api_urls.py): API boundary · `backend/core/api_urls.py`
- [Feature endpoints](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/urls.py): Django app routes · Accounts, airports, flights, tracking, and weather routes. · `backend/flights/urls.py`
- [API views](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/views.py): HTTP orchestration · Serialize domain data and invoke services. · `backend/flights/views.py`
- [Identity and access](https://github.com/karthik5718/flight-tracker/blob/main/backend/accounts/models.py): accounts domain · Users, controller profiles, serializers, and permissions. · `backend/accounts/models.py`
- [Aviation records](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/models.py): persistent domain · Airport and flight metadata models. · `backend/flights/models.py`
- [Flight positions](https://github.com/karthik5718/flight-tracker/blob/main/backend/tracking/models.py): tracking domain · Live and historical position records remain separate from flight metadata. · `backend/tracking/models.py`
- [Provider adapters](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/adapters.py): normalization layer · Converts provider payloads into application-facing data. · `backend/flights/adapters.py`
- [Provider services](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/services/airlabs.py): integration layer · Isolates third-party API calls. · `backend/flights/services/airlabs.py`
- [Shared cache](https://github.com/karthik5718/flight-tracker/blob/main/backend/core/cache.py): cache service · Protects remote calls and repeat reads. · `backend/core/cache.py`

### React frontend

Authenticated browser workflows.

- [Browser entry](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/main.jsx): React entry · `frontend/src/main.jsx`
- [App routes and UI](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/App.jsx): application composition · `frontend/src/App.jsx`
- [Authentication state](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/context/AuthContext.jsx): React context · Centralizes client authentication state. · `frontend/src/context/AuthContext.jsx`
- [Route guards](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/components/ProtectedRoute.jsx): access control · Separates user and ATC-protected navigation. · `frontend/src/components/ProtectedRoute.jsx`
- [Operational pages](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/pages/Tracking.jsx): workflow views · Tracking, airport information, and ATC operations. · `frontend/src/pages/Tracking.jsx`
- [Map visualization](https://github.com/karthik5718/flight-tracker/blob/main/frontend/src/components/Map.jsx): flight UI · Map, aircraft markers, and flight details panel. · `frontend/src/components/Map.jsx`

### External providers

Aviation and weather data sources.

- [AeroDataBox](https://github.com/karthik5718/flight-tracker/blob/main/backend/airports/services/aerodatabox.py): airport provider · `backend/airports/services/aerodatabox.py`
- [AirLabs](https://github.com/karthik5718/flight-tracker/blob/main/backend/flights/services/airlabs.py): flight provider · `backend/flights/services/airlabs.py`
- [Open-Meteo](https://github.com/karthik5718/flight-tracker/blob/main/backend/weather/services/open_meteo.py): weather provider · `backend/weather/services/open_meteo.py`

## Connections

- Django runtime → Layered settings: loads
- Django runtime → Project URL routing: serves
- Project URL routing → API URL routing: delegates API routes
- API URL routing → Feature endpoints: includes
- Feature endpoints → API views: dispatches
- API views → Identity and access: authenticates and authorizes
- API views → Aviation records: reads and writes
- API views → Flight positions: reads and writes
- API views → Provider adapters: uses external data
- Provider adapters → Provider services: normalizes responses from
- Provider services → Shared cache: uses
- Provider services → AeroDataBox: airport data
- Provider services → AirLabs: flight data
- Provider services → Open-Meteo: weather data
- Browser entry → App routes and UI: mounts
- App routes and UI → Authentication state: consumes
- App routes and UI → Route guards: applies
- Route guards → Operational pages: allows
- Operational pages → Map visualization: renders tracking UI
- App routes and UI → API URL routing: calls REST API
- Authentication state → Identity and access: uses account API
- Map visualization → Flight positions: displays positions via API
