# bellingcat/adsb-history architecture

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

- Interactive diagram: https://gitdiagram.com/bellingcat/adsb-history
- Repository: https://github.com/bellingcat/adsb-history

## Overview

Turnstone loads historical tar1090 heatmap data into PostGIS, then lets authenticated users build spatial and temporal ADS-B searches and inspect results as maps, tables, charts, and aircraft aggregates. The principal flow is query controls → query state/API request → Flask validation and database search → result views; successful searches are also saved for replay. The graph preserves documented ingestion, authentication, query history, and export capabilities. Some backend query and persistence details come from the README; unsampled implementation relationships are not inferred beyond those documented.

Main entry points: [`frontend/src/App.vue`](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/App.vue) (Vue application shell), [`frontend/src/stores/query.js`](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/query.js) (Query state and execution), [`backend-api/flask-adsb-api.py`](https://github.com/bellingcat/adsb-history/blob/main/backend-api/flask-adsb-api.py) (Flask ADS-B API), [`frontend/src/components/SearchResults/SearchResults.vue`](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResults.vue) (Search results container)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data ingestion"]
  node_loader["Heatmap importer"]
  node_modes["Aircraft metadata<br/>[modes.csv]"]
  node_postgres[("PostgreSQL / PostGIS")]
end

subgraph group_backend["API and access"]
  node_api["Flask ADS-B API<br/>[flask-adsb-api.py]"]
  node_validators["Parameter validation"]
  node_serverauth["Firebase token verification<br/>[firebase_utils.py]"]
end

subgraph group_query["Search experience"]
  node_app["Vue application shell<br/>[App.vue]"]
  node_authui["Sign-in interface<br/>[Auth.vue]"]
  node_authstore["Authentication state<br/>[auth.js]"]
  node_firebaseclient["Firebase client<br/>[firebase.js]"]
  node_builder["Query filter controls"]
  node_querystore["Query state and execution<br/>[query.js]"]
  node_apiservice["HTTP API client<br/>[api.js]"]
end

subgraph group_results["Results and history"]
  node_historyui["Query history interface<br/>[QueryHistory.vue]"]
  node_historystore["Query history state<br/>[queryHistory.js]"]
  node_localdb[("Browser result storage<br/>[indexedDB.js]")]
  node_ui["Result interaction state<br/>[ui.js]"]
  node_resultsview["Search results container<br/>[SearchResults.vue]"]
  node_map["Aircraft results map"]
  node_datatable["Raw data table"]
  node_aggregate["Aircraft aggregates"]
  node_chart["Temporal chart"]
  node_csv["CSV export<br/>[csvExport.js]"]
end

node_operator(("Data operator"))
node_user(("Authenticated user"))
node_firebase[("Firebase services")]

node_operator -->|"runs import"| node_loader
node_loader -->|"loads records"| node_postgres
node_modes -->|"provides metadata"| node_postgres
node_user -->|"uses"| node_app
node_app -->|"renders"| node_authui
node_app -->|"renders"| node_builder
node_app -->|"renders"| node_resultsview
node_app -->|"renders"| node_chart
node_app -->|"renders"| node_historyui
node_authui -->|"invokes auth"| node_authstore
node_authstore -->|"uses auth functions"| node_firebaseclient
node_firebaseclient -->|"authenticates"| node_firebase
node_builder -.->|"updates query"| node_querystore
node_querystore -->|"sends search"| node_apiservice
node_apiservice -->|"gets token"| node_authstore
node_apiservice -->|"requests search"| node_api
node_api -->|"validates parameters"| node_validators
node_api -->|"verifies identity"| node_serverauth
node_serverauth -->|"checks token"| node_firebase
node_api -->|"queries records"| node_postgres
node_querystore -->|"saves search"| node_historystore
node_historyui -->|"manages history"| node_historystore
node_historystore -->|"stores metadata/results"| node_firebase
node_historystore -->|"stores large results"| node_localdb
node_resultsview -->|"renders"| node_map
node_resultsview -->|"renders"| node_datatable
node_resultsview -->|"renders"| node_aggregate
node_map -->|"reads results"| node_querystore
node_map -->|"reads interaction state"| node_ui
node_datatable -->|"reads results"| node_querystore
node_datatable -->|"exports rows"| node_csv
node_aggregate -->|"exports data"| node_csv
node_chart -->|"reads results"| node_querystore

click node_loader "https://github.com/bellingcat/adsb-history/blob/main/backend-data-loading/process_adsb_data.py"
click node_modes "https://github.com/bellingcat/adsb-history/blob/main/backend-data-loading/modes.csv"
click node_api "https://github.com/bellingcat/adsb-history/blob/main/backend-api/flask-adsb-api.py"
click node_validators "https://github.com/bellingcat/adsb-history/blob/main/backend-api/validators/parameter_validators.py"
click node_serverauth "https://github.com/bellingcat/adsb-history/blob/main/backend-api/firebase_utils.py"
click node_app "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/App.vue"
click node_authui "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/Auth.vue"
click node_authstore "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/auth.js"
click node_firebaseclient "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/firebase.js"
click node_builder "https://github.com/bellingcat/adsb-history/tree/main/frontend/src/components/QueryBuilder"
click node_querystore "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/query.js"
click node_apiservice "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/services/api.js"
click node_historyui "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/QueryHistory.vue"
click node_historystore "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/queryHistory.js"
click node_localdb "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/indexedDB.js"
click node_ui "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/ui.js"
click node_resultsview "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResults.vue"
click node_map "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResultsMap.vue"
click node_datatable "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResultsDataTable.vue"
click node_aggregate "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/AircraftAggregateTable.vue"
click node_chart "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/PlanesPerDayChart.vue"
click node_csv "https://github.com/bellingcat/adsb-history/blob/main/frontend/src/utils/csvExport.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_loader,node_modes,node_postgres,node_user toneBlue
class node_api,node_validators,node_serverauth,node_firebase toneAmber
class node_app,node_authui,node_authstore,node_firebaseclient,node_builder,node_querystore,node_apiservice toneMint
class node_historyui,node_historystore,node_localdb,node_ui,node_resultsview,node_map,node_datatable,node_aggregate,node_chart,node_csv toneRose
class node_operator toneIndigo
```

## Components

### Data ingestion

- [Heatmap importer](https://github.com/bellingcat/adsb-history/blob/main/backend-data-loading/process_adsb_data.py): `backend-data-loading/process_adsb_data.py`
- [Aircraft metadata](https://github.com/bellingcat/adsb-history/blob/main/backend-data-loading/modes.csv): `backend-data-loading/modes.csv`
- **PostgreSQL / PostGIS**

### API and access

- [Flask ADS-B API](https://github.com/bellingcat/adsb-history/blob/main/backend-api/flask-adsb-api.py): `backend-api/flask-adsb-api.py`
- [Parameter validation](https://github.com/bellingcat/adsb-history/blob/main/backend-api/validators/parameter_validators.py): `backend-api/validators/parameter_validators.py`
- [Firebase token verification](https://github.com/bellingcat/adsb-history/blob/main/backend-api/firebase_utils.py): `backend-api/firebase_utils.py`

### Search experience

- [Vue application shell](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Sign-in interface](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/Auth.vue): `frontend/src/components/Auth.vue`
- [Authentication state](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/auth.js): `frontend/src/stores/auth.js`
- [Firebase client](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/firebase.js): `frontend/src/firebase.js`
- [Query filter controls](https://github.com/bellingcat/adsb-history/tree/main/frontend/src/components/QueryBuilder): `frontend/src/components/QueryBuilder`
- [Query state and execution](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/query.js): `frontend/src/stores/query.js`
- [HTTP API client](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Results and history

- [Query history interface](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/QueryHistory.vue): `frontend/src/components/QueryHistory.vue`
- [Query history state](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/queryHistory.js): `frontend/src/stores/queryHistory.js`
- [Browser result storage](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/indexedDB.js): `frontend/src/stores/indexedDB.js`
- [Result interaction state](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/stores/ui.js): `frontend/src/stores/ui.js`
- [Search results container](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResults.vue): `frontend/src/components/SearchResults/SearchResults.vue`
- [Aircraft results map](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResultsMap.vue): `frontend/src/components/SearchResults/SearchResultsMap.vue`
- [Raw data table](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/SearchResultsDataTable.vue): `frontend/src/components/SearchResults/SearchResultsDataTable.vue`
- [Aircraft aggregates](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/AircraftAggregateTable.vue): `frontend/src/components/SearchResults/AircraftAggregateTable.vue`
- [Temporal chart](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/components/SearchResults/PlanesPerDayChart.vue): `frontend/src/components/SearchResults/PlanesPerDayChart.vue`
- [CSV export](https://github.com/bellingcat/adsb-history/blob/main/frontend/src/utils/csvExport.js): `frontend/src/utils/csvExport.js`

### Other components

- **Data operator**
- **Authenticated user**
- **Firebase services**

## Connections

- Data operator → Heatmap importer: runs import (evidence: `README.md`)
- Heatmap importer → PostgreSQL / PostGIS: loads records (evidence: `README.md`)
- Aircraft metadata → PostgreSQL / PostGIS: provides metadata (evidence: `README.md`)
- Authenticated user → Vue application shell: uses (evidence: `README.md`)
- Vue application shell → Sign-in interface: renders (evidence: `frontend/src/App.vue`)
- Vue application shell → Query filter controls: renders (evidence: `frontend/src/App.vue`)
- Vue application shell → Search results container: renders (evidence: `frontend/src/App.vue`)
- Vue application shell → Temporal chart: renders (evidence: `frontend/src/App.vue`)
- Vue application shell → Query history interface: renders (evidence: `frontend/src/App.vue`)
- Sign-in interface → Authentication state: invokes auth (evidence: `frontend/src/components/Auth.vue`)
- Authentication state → Firebase client: uses auth functions (evidence: `frontend/src/stores/auth.js`)
- Firebase client → Firebase services: authenticates (evidence: `README.md`)
- Query filter controls → Query state and execution: updates query (evidence: `frontend/src/components/QueryBuilder/HexCodeInput.vue`)
- Query state and execution → HTTP API client: sends search (evidence: `frontend/src/stores/query.js`)
- HTTP API client → Authentication state: gets token (evidence: `frontend/src/services/api.js`)
- HTTP API client → Flask ADS-B API: requests search (evidence: `README.md`)
- Flask ADS-B API → Parameter validation: validates parameters (evidence: `backend-api/flask-adsb-api.py`)
- Flask ADS-B API → Firebase token verification: verifies identity (evidence: `backend-api/flask-adsb-api.py`)
- Firebase token verification → Firebase services: checks token (evidence: `README.md`)
- Flask ADS-B API → PostgreSQL / PostGIS: queries records (evidence: `README.md`)
- Query state and execution → Query history state: saves search (evidence: `frontend/src/stores/query.js`)
- Query history interface → Query history state: manages history (evidence: `frontend/src/components/QueryHistory.vue`)
- Query history state → Firebase services: stores metadata/results (evidence: `frontend/src/stores/queryHistory.js`)
- Query history state → Browser result storage: stores large results (evidence: `frontend/src/stores/queryHistory.js`)
- Search results container → Aircraft results map: renders (evidence: `frontend/src/components/SearchResults/SearchResults.vue`)
- Search results container → Raw data table: renders (evidence: `frontend/src/components/SearchResults/SearchResults.vue`)
- Search results container → Aircraft aggregates: renders (evidence: `frontend/src/components/SearchResults/SearchResults.vue`)
- Aircraft results map → Query state and execution: reads results (evidence: `frontend/src/components/SearchResults/SearchResultsMap.vue`)
- Aircraft results map → Result interaction state: reads interaction state (evidence: `frontend/src/components/SearchResults/SearchResultsMap.vue`)
- Raw data table → Query state and execution: reads results (evidence: `frontend/src/components/SearchResults/SearchResultsDataTable.vue`)
- Raw data table → CSV export: exports rows (evidence: `frontend/src/components/SearchResults/SearchResultsDataTable.vue`)
- Aircraft aggregates → CSV export: exports data (evidence: `frontend/src/components/SearchResults/AircraftAggregateTable.vue`)
- Temporal chart → Query state and execution: reads results (evidence: `frontend/src/components/SearchResults/PlanesPerDayChart.vue`)
