# lizthegrey/awtrix-flights architecture

> Architecture diagram of the GitHub repository lizthegrey/awtrix-flights, 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/lizthegrey/awtrix-flights
- Repository: https://github.com/lizthegrey/awtrix-flights

## Overview

awtrix-flights polls public ADS-B data, selects aircraft likely to pass perceptibly close overhead, and publishes AWTRIX display updates. Its main workflow runs through a scheduled Lambda fanout and queued polling ticks; a separate Lambda authorizes the device’s MQTT connection. The graph also preserves the documented infrastructure and optional tracing integration. Relationships are based on the README and shown source/index references; Terraform resource-level wiring is documented at a high level rather than inspected in source excerpts.

Main entry points: [`internal/publisher/publisher.go`](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/publisher/publisher.go) (Polling tick), [`cmd/publisher/main.go`](https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/publisher/main.go) (Publisher Lambda), [`cmd/authorizer/main.go`](https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/authorizer/main.go) (Authorizer Lambda), [`terraform/iot.tf`](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/iot.tf) (AWS IoT Core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Polling runtime"]
  node_publisher_entry["Publisher Lambda<br/>[main.go]"]
  node_publisher["Polling tick<br/>[publisher.go]"]
  node_store[("Route cache and dedupe<br/>[store.go]")]
end

subgraph group_analysis["Flight analysis"]
  node_adsbfi["ADS-B feed client<br/>[client.go]"]
  node_filter["Perceptibility filter<br/>[filter.go]"]
  node_geo["Track geometry<br/>[geo.go]"]
  node_route_client["Route lookup client<br/>[client.go]"]
end

subgraph group_delivery["Display and access"]
  node_formatter["AWTRIX payload formatter<br/>[payload.go]"]
  node_iot_publisher["MQTT publisher<br/>[iotpub.go]"]
  node_authorizer_entry["Authorizer Lambda<br/>[main.go]"]
  node_authorizer["Credential and policy checks<br/>[authorizer.go]"]
end

subgraph group_cloud["AWS infrastructure"]
  node_scheduler(("EventBridge schedule<br/>[eventbridge.tf]"))
  node_tick_queue["Tick queue<br/>[sqs.tf]"]
  node_dynamodb[("DynamoDB table<br/>[dynamodb.tf]")]
  node_iot_core["AWS IoT Core<br/>[iot.tf]"]
  node_secrets[("Secrets Manager<br/>[secrets.tf]")]
end

subgraph group_telemetry["Observability"]
  node_otel["Tracing setup<br/>[otelinit.go]"]
end

node_adsb_service["adsb.fi"]
node_adsbdb_service["adsbdb.com"]
node_device(("AWTRIX display"))
node_honeycomb["Honeycomb OTLP"]

node_scheduler -->|"invokes"| node_publisher_entry
node_publisher_entry -->|"enqueues ticks"| node_tick_queue
node_tick_queue -->|"triggers tick"| node_publisher_entry
node_publisher_entry -->|"runs tick"| node_publisher
node_publisher -->|"fetches aircraft"| node_adsbfi
node_adsbfi -->|"requests state vectors"| node_adsb_service
node_adsbfi -->|"produces states"| node_filter
node_filter -->|"computes CPA"| node_geo
node_publisher -->|"selects candidates"| node_filter
node_publisher -->|"checks cache and dedupe"| node_store
node_publisher -->|"resolves routes"| node_route_client
node_route_client -->|"looks up callsigns"| node_adsbdb_service
node_publisher -->|"formats notification"| node_formatter
node_formatter -->|"returns payload"| node_publisher
node_publisher -->|"publishes payload"| node_iot_publisher
node_iot_publisher -->|"sends MQTT message"| node_iot_core
node_iot_core -->|"delivers update"| node_device
node_store -->|"reads and writes"| node_dynamodb
node_iot_core -->|"requests authorization"| node_authorizer_entry
node_authorizer_entry -->|"handles request"| node_authorizer
node_authorizer_entry -->|"loads credentials"| node_secrets
node_authorizer -->|"returns scoped policy"| node_iot_core
node_publisher_entry -->|"configures tracing"| node_otel
node_authorizer_entry -->|"configures tracing"| node_otel
node_otel -->|"exports traces"| node_honeycomb

click node_scheduler "https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/eventbridge.tf"
click node_publisher_entry "https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/publisher/main.go"
click node_tick_queue "https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/sqs.tf"
click node_publisher "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/publisher/publisher.go"
click node_adsbfi "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/adsbfi/client.go"
click node_filter "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/filter/filter.go"
click node_geo "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/geo/geo.go"
click node_route_client "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/adsbdb/client.go"
click node_store "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/store/store.go"
click node_dynamodb "https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/dynamodb.tf"
click node_formatter "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/awtrix/payload.go"
click node_iot_publisher "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/iotpub/iotpub.go"
click node_iot_core "https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/iot.tf"
click node_authorizer_entry "https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/authorizer/main.go"
click node_authorizer "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/authorizer/authorizer.go"
click node_secrets "https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/secrets.tf"
click node_otel "https://github.com/lizthegrey/awtrix-flights/blob/main/internal/otelinit/otelinit.go"

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_publisher_entry,node_publisher,node_store toneBlue
class node_adsbfi,node_filter,node_geo,node_route_client toneAmber
class node_formatter,node_iot_publisher,node_authorizer_entry,node_authorizer toneMint
class node_scheduler,node_tick_queue,node_dynamodb,node_iot_core,node_secrets toneRose
class node_otel,node_adsb_service,node_adsbdb_service,node_device,node_honeycomb toneIndigo
```

## Components

### Polling runtime

- [Publisher Lambda](https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/publisher/main.go): `cmd/publisher/main.go`
- [Polling tick](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/publisher/publisher.go): `internal/publisher/publisher.go`
- [Route cache and dedupe](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/store/store.go): `internal/store/store.go`

### Flight analysis

- [ADS-B feed client](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/adsbfi/client.go): `internal/adsbfi/client.go`
- [Perceptibility filter](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/filter/filter.go): `internal/filter/filter.go`
- [Track geometry](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/geo/geo.go): `internal/geo/geo.go`
- [Route lookup client](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/adsbdb/client.go): `internal/adsbdb/client.go`

### Display and access

- [AWTRIX payload formatter](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/awtrix/payload.go): `internal/awtrix/payload.go`
- [MQTT publisher](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/iotpub/iotpub.go): `internal/iotpub/iotpub.go`
- [Authorizer Lambda](https://github.com/lizthegrey/awtrix-flights/blob/main/cmd/authorizer/main.go): `cmd/authorizer/main.go`
- [Credential and policy checks](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/authorizer/authorizer.go): `internal/authorizer/authorizer.go`

### AWS infrastructure

- [EventBridge schedule](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/eventbridge.tf): `terraform/eventbridge.tf`
- [Tick queue](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/sqs.tf): `terraform/sqs.tf`
- [DynamoDB table](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/dynamodb.tf): `terraform/dynamodb.tf`
- [AWS IoT Core](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/iot.tf): `terraform/iot.tf`
- [Secrets Manager](https://github.com/lizthegrey/awtrix-flights/blob/main/terraform/secrets.tf): `terraform/secrets.tf`

### Observability

- [Tracing setup](https://github.com/lizthegrey/awtrix-flights/blob/main/internal/otelinit/otelinit.go): `internal/otelinit/otelinit.go`

### Other components

- **adsb.fi**
- **adsbdb.com**
- **AWTRIX display**
- **Honeycomb OTLP**

## Connections

- EventBridge schedule → Publisher Lambda: invokes (evidence: `README.md`)
- Publisher Lambda → Tick queue: enqueues ticks (evidence: `cmd/publisher/main.go`)
- Tick queue → Publisher Lambda: triggers tick (evidence: `cmd/publisher/main.go`)
- Publisher Lambda → Polling tick: runs tick (evidence: `cmd/publisher/main.go`)
- Polling tick → ADS-B feed client: fetches aircraft (evidence: `internal/publisher/publisher.go`)
- ADS-B feed client → adsb.fi: requests state vectors (evidence: `internal/adsbfi/client.go`)
- ADS-B feed client → Perceptibility filter: produces states (evidence: `internal/adsbfi/client.go`)
- Perceptibility filter → Track geometry: computes CPA (evidence: `internal/filter/filter.go`)
- Polling tick → Perceptibility filter: selects candidates (evidence: `internal/publisher/publisher.go`)
- Polling tick → Route cache and dedupe: checks cache and dedupe (evidence: `internal/publisher/publisher.go`)
- Polling tick → Route lookup client: resolves routes (evidence: `internal/publisher/publisher.go`)
- Route lookup client → adsbdb.com: looks up callsigns (evidence: `internal/adsbdb/client.go`)
- Polling tick → AWTRIX payload formatter: formats notification (evidence: `internal/publisher/publisher.go`)
- AWTRIX payload formatter → Polling tick: returns payload (evidence: `internal/publisher/publisher.go`)
- Polling tick → MQTT publisher: publishes payload (evidence: `internal/publisher/publisher.go`)
- MQTT publisher → AWS IoT Core: sends MQTT message (evidence: `README.md`)
- AWS IoT Core → AWTRIX display: delivers update (evidence: `README.md`)
- Route cache and dedupe → DynamoDB table: reads and writes (evidence: `internal/store/store.go`)
- AWS IoT Core → Authorizer Lambda: requests authorization (evidence: `README.md`)
- Authorizer Lambda → Credential and policy checks: handles request (evidence: `cmd/authorizer/main.go`)
- Authorizer Lambda → Secrets Manager: loads credentials (evidence: `cmd/authorizer/main.go`)
- Credential and policy checks → AWS IoT Core: returns scoped policy (evidence: `internal/authorizer/authorizer.go`)
- Publisher Lambda → Tracing setup: configures tracing (evidence: `cmd/publisher/main.go`)
- Authorizer Lambda → Tracing setup: configures tracing (evidence: `cmd/authorizer/main.go`)
- Tracing setup → Honeycomb OTLP: exports traces (evidence: `internal/otelinit/otelinit.go`)
