Skip to content

ChristianECG/squawk

Repository files navigation

Squawk — Global aviation at a glance

Real-time global aviation dashboard powered by ADS-B transponder data.

Next.js TypeScript License: MIT


What is a squawk?

Emergency squawk codes: 7700 general emergency, 7600 radio failure, 7500 hijack

A squawk is a 4-digit transponder code assigned by air traffic control to each aircraft. It appears on radar screens to identify flights. The three codes above are reserved worldwide for emergencies and trigger real-time alerts on the dashboard.


Features

Features: live SSE updates, density map, 6 charts, emergency alerts, 3 languages


Architecture

Data flow: OpenSky API → Worker (60s) → SQLite (WAL) → Next.js BFF → SSE (5s) → Browser

A Node.js worker polls the OpenSky Network API every 60 seconds, upserts raw aircraft state into the aircraft table, then computes and persists pre-aggregated metrics into snapshot and agg_* tables. The Next.js BFF reads from SQLite every 5 seconds and pushes updates to the browser over a Server-Sent Events stream. SQLite WAL mode allows the server to read concurrently while the worker is writing.


Data source

Flight data comes from the OpenSky Network — a community-driven receiver network that aggregates ADS-B transponder signals from aircraft worldwide. The anonymous endpoint is used (no credentials required), which provides ~400 free requests/day. At 1 request/minute the worker uses ~1,440 requests/day; rate limiting is handled with exponential backoff up to a 10-minute ceiling.


Stack

Layer Technology
Framework Next.js 15 (App Router)
Language TypeScript 5
Map deck.gl 9 + MapLibre GL + react-map-gl
Charts Apache ECharts 5 via echarts-for-react
Database SQLite via better-sqlite3
Streaming Server-Sent Events
Worker runner tsx
Concurrency concurrently
Package manager pnpm

Local development

Prerequisites: Node.js ≥ 20, pnpm

# Install dependencies
pnpm install

# Start the worker (polls OpenSky, writes squawk.db)
pnpm worker

# In a separate terminal — start the Next.js dev server
pnpm dev

Open http://localhost:7700.

The worker needs a few seconds to populate the database on first run. The dashboard shows a "connecting…" state until the first snapshot is written.


Production

pnpm build
pnpm start:prod

start:prod uses concurrently to run both processes under a single command with colour-coded output (blue → Next.js, yellow → worker).

Host requirements:

  • Persistent disk at $CWDsquawk.db is created there at runtime and must survive restarts.
  • Start command must be pnpm start:prod, not next start, so the worker is included.
  • No environment variables required — OpenSky anonymous endpoint needs no credentials.

Deploy (GitHub Actions)

The repository ships .github/workflows/deploy.yml which triggers on every push to main and deploys via floo.

Required repository secrets:

Secret Description
FLOO_URL Deployment target URL
FLOO_TOKEN Authentication token

License

MIT © Christian ECG

About

Real-time global aviation dashboard — ADS-B transponder data via OpenSky Network, radar heatmap, live charts, emergency squawk alerts.

Topics

Resources

Stars

Watchers

Forks

Contributors