# 868-no/map architecture

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

- Interactive diagram: https://gitdiagram.com/868-no/map
- Repository: https://github.com/868-no/map

## Overview

868.no Map ingests Meshtastic MQTT traffic, retains packet receptions, and derives time-windowed mesh views for an interactive browser map. The principal flow is broker traffic through ingestion and PostgreSQL, then API/range retrieval into the browser’s WebAssembly engine and map or analysis panels. The README documents major capabilities whose implementation was not sampled, so their nodes use supported directories; edges are limited to documented flows or visible imports/calls.

Main entry points: [`frontend/src/App.tsx`](https://github.com/868-no/map/blob/main/frontend/src/App.tsx) (Application shell), [`backend/internal/ingest/pipeline.go`](https://github.com/868-no/map/blob/main/backend/internal/ingest/pipeline.go) (Packet ingestion), [`frontend/src/derive/worker.ts`](https://github.com/868-no/map/blob/main/frontend/src/derive/worker.ts) (Derivation worker), [`frontend/engine/src/lib.rs`](https://github.com/868-no/map/blob/main/frontend/engine/src/lib.rs) (Mesh engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection and storage"]
  node_mqtt["MQTT clients<br/>[clients.go]"]
  node_ingest["Packet ingestion<br/>[pipeline.go]"]
  node_decode["Protocol decoding<br/>[ports.go]"]
  node_security["Packet security"]
  node_storage[("Packet log<br/>[storage.go]")]
end

subgraph group_services["API and enrichment"]
  node_api["HTTP API<br/>[handlers.go]"]
  node_live["Live stream<br/>[stream.go]"]
  node_weather["Weather enrichment"]
  node_terrain["Terrain enrichment"]
  node_places["Place search"]
end

subgraph group_derive["Browser derivation"]
  node_fetch["Range fetching<br/>[range.ts]"]
  node_worker["Derivation worker<br/>[worker.ts]"]
  node_rowstore["Window row store<br/>[rowStore.ts]"]
  node_engine["Mesh engine<br/>[lib.rs]"]
  node_rows["Observation rows<br/>[row.rs]"]
  node_graph["Evidence links<br/>[graph.rs]"]
  node_views["Window views<br/>[mod.rs]"]
end

subgraph group_explore["Map and analysis UI"]
  node_app["Application shell<br/>[App.tsx]"]
  node_map["Interactive map<br/>[MapView.tsx]"]
  node_nodepanel["Node details<br/>[NodePanel.tsx]"]
  node_health["Mesh health<br/>[health.tsx]"]
  node_trends["Trends and regions<br/>[trends.tsx]"]
end

node_brokers(("MQTT brokers"))
node_browser(("Map viewer"))
node_weather_service["MET Norway"]
node_kartverket["Kartverket"]

node_brokers -->|"supply traffic"| node_mqtt
node_mqtt -->|"deliver packets"| node_ingest
node_ingest -->|"decode packets"| node_decode
node_ingest -->|"verify packets"| node_security
node_ingest -->|"store receptions"| node_storage
node_browser -->|"open map"| node_app
node_app -->|"renders"| node_map
node_app -->|"renders"| node_nodepanel
node_app -->|"renders"| node_health
node_app -->|"renders"| node_trends
node_api -->|"serves map data"| node_browser
node_live -->|"streams updates"| node_browser
node_worker -->|"creates store"| node_rowstore
node_worker -->|"creates fetcher"| node_fetch
node_worker -->|"builds views"| node_engine
node_engine -->|"parses observations"| node_rows
node_engine -->|"derives outputs"| node_views
node_views -->|"uses link evidence"| node_graph
node_weather -->|"queries archive"| node_weather_service
node_terrain -->|"queries heights"| node_kartverket
node_places -->|"searches names"| node_kartverket

click node_mqtt "https://github.com/868-no/map/blob/main/backend/internal/mqtt/clients.go"
click node_ingest "https://github.com/868-no/map/blob/main/backend/internal/ingest/pipeline.go"
click node_decode "https://github.com/868-no/map/blob/main/backend/internal/protocol/ports/ports.go"
click node_security "https://github.com/868-no/map/tree/main/backend/internal/security"
click node_storage "https://github.com/868-no/map/blob/main/backend/internal/storage/storage.go"
click node_api "https://github.com/868-no/map/blob/main/backend/internal/api/handlers.go"
click node_live "https://github.com/868-no/map/blob/main/backend/internal/api/stream.go"
click node_weather "https://github.com/868-no/map/tree/main/backend/internal/weather"
click node_terrain "https://github.com/868-no/map/tree/main/backend/internal/terrain"
click node_places "https://github.com/868-no/map/tree/main/backend/internal/places"
click node_app "https://github.com/868-no/map/blob/main/frontend/src/App.tsx"
click node_fetch "https://github.com/868-no/map/blob/main/frontend/src/derive/range.ts"
click node_worker "https://github.com/868-no/map/blob/main/frontend/src/derive/worker.ts"
click node_rowstore "https://github.com/868-no/map/blob/main/frontend/src/derive/rowStore.ts"
click node_engine "https://github.com/868-no/map/blob/main/frontend/engine/src/lib.rs"
click node_rows "https://github.com/868-no/map/blob/main/frontend/engine/src/row.rs"
click node_graph "https://github.com/868-no/map/blob/main/frontend/engine/src/graph.rs"
click node_views "https://github.com/868-no/map/blob/main/frontend/engine/src/views/mod.rs"
click node_map "https://github.com/868-no/map/blob/main/frontend/src/map/MapView.tsx"
click node_nodepanel "https://github.com/868-no/map/blob/main/frontend/src/features/node/NodePanel.tsx"
click node_health "https://github.com/868-no/map/blob/main/frontend/src/features/health.tsx"
click node_trends "https://github.com/868-no/map/blob/main/frontend/src/features/trends.tsx"

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_mqtt,node_ingest,node_decode,node_security,node_storage,node_browser toneBlue
class node_api,node_live,node_weather,node_terrain,node_places toneAmber
class node_fetch,node_worker,node_rowstore,node_engine,node_rows,node_graph,node_views toneMint
class node_app,node_map,node_nodepanel,node_health,node_trends toneRose
class node_brokers,node_weather_service,node_kartverket toneIndigo
```

## Components

### Collection and storage

- [MQTT clients](https://github.com/868-no/map/blob/main/backend/internal/mqtt/clients.go): `backend/internal/mqtt/clients.go`
- [Packet ingestion](https://github.com/868-no/map/blob/main/backend/internal/ingest/pipeline.go): `backend/internal/ingest/pipeline.go`
- [Protocol decoding](https://github.com/868-no/map/blob/main/backend/internal/protocol/ports/ports.go): `backend/internal/protocol/ports/ports.go`
- [Packet security](https://github.com/868-no/map/tree/main/backend/internal/security): `backend/internal/security`
- [Packet log](https://github.com/868-no/map/blob/main/backend/internal/storage/storage.go): `backend/internal/storage/storage.go`

### API and enrichment

- [HTTP API](https://github.com/868-no/map/blob/main/backend/internal/api/handlers.go): `backend/internal/api/handlers.go`
- [Live stream](https://github.com/868-no/map/blob/main/backend/internal/api/stream.go): `backend/internal/api/stream.go`
- [Weather enrichment](https://github.com/868-no/map/tree/main/backend/internal/weather): `backend/internal/weather`
- [Terrain enrichment](https://github.com/868-no/map/tree/main/backend/internal/terrain): `backend/internal/terrain`
- [Place search](https://github.com/868-no/map/tree/main/backend/internal/places): `backend/internal/places`

### Browser derivation

- [Range fetching](https://github.com/868-no/map/blob/main/frontend/src/derive/range.ts): `frontend/src/derive/range.ts`
- [Derivation worker](https://github.com/868-no/map/blob/main/frontend/src/derive/worker.ts): `frontend/src/derive/worker.ts`
- [Window row store](https://github.com/868-no/map/blob/main/frontend/src/derive/rowStore.ts): `frontend/src/derive/rowStore.ts`
- [Mesh engine](https://github.com/868-no/map/blob/main/frontend/engine/src/lib.rs): `frontend/engine/src/lib.rs`
- [Observation rows](https://github.com/868-no/map/blob/main/frontend/engine/src/row.rs): `frontend/engine/src/row.rs`
- [Evidence links](https://github.com/868-no/map/blob/main/frontend/engine/src/graph.rs): `frontend/engine/src/graph.rs`
- [Window views](https://github.com/868-no/map/blob/main/frontend/engine/src/views/mod.rs): `frontend/engine/src/views/mod.rs`

### Map and analysis UI

- [Application shell](https://github.com/868-no/map/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Interactive map](https://github.com/868-no/map/blob/main/frontend/src/map/MapView.tsx): `frontend/src/map/MapView.tsx`
- [Node details](https://github.com/868-no/map/blob/main/frontend/src/features/node/NodePanel.tsx): `frontend/src/features/node/NodePanel.tsx`
- [Mesh health](https://github.com/868-no/map/blob/main/frontend/src/features/health.tsx): `frontend/src/features/health.tsx`
- [Trends and regions](https://github.com/868-no/map/blob/main/frontend/src/features/trends.tsx): `frontend/src/features/trends.tsx`

### Other components

- **MQTT brokers**
- **Map viewer**
- **MET Norway**
- **Kartverket**

## Connections

- MQTT brokers → MQTT clients: supply traffic (evidence: `README.md`)
- MQTT clients → Packet ingestion: deliver packets (evidence: `README.md`)
- Packet ingestion → Protocol decoding: decode packets (evidence: `README.md`)
- Packet ingestion → Packet security: verify packets (evidence: `README.md`)
- Packet ingestion → Packet log: store receptions (evidence: `README.md`)
- Map viewer → Application shell: open map
- Application shell → Interactive map: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Node details: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Mesh health: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Trends and regions: renders (evidence: `frontend/src/App.tsx`)
- HTTP API → Map viewer: serves map data (evidence: `README.md`)
- Live stream → Map viewer: streams updates (evidence: `README.md`)
- Derivation worker → Window row store: creates store (evidence: `frontend/src/derive/worker.ts`)
- Derivation worker → Range fetching: creates fetcher (evidence: `frontend/src/derive/worker.ts`)
- Derivation worker → Mesh engine: builds views (evidence: `frontend/src/derive/worker.ts`)
- Mesh engine → Observation rows: parses observations (evidence: `frontend/engine/src/lib.rs`)
- Mesh engine → Window views: derives outputs (evidence: `frontend/engine/src/lib.rs`)
- Window views → Evidence links: uses link evidence (evidence: `frontend/engine/src/views/mod.rs`)
- Weather enrichment → MET Norway: queries archive (evidence: `README.md`)
- Terrain enrichment → Kartverket: queries heights (evidence: `README.md`)
- Place search → Kartverket: searches names (evidence: `README.md`)
