How wiedehopf/tar1090 works
Project type and purpose
– tar1090 is a specialized full-stack application comprised of a static single-page web interface (HTML/JS/CSS) and a light backend layer that collects JSON data from an ADS-B decoder (readsb or dump1090-fa), maintains history snapshots, and serves everything via a web server (nginx or lighttpd). It adds a rich UI frontend on top of an existing ADS-B decoder.
File structure
– Top level
• install.sh / uninstall.sh / version.sh / tar1090.sh : installation and service scripts
• nginx-readsb-api.conf, nginx.conf : example web server configs
• tar1090.service : systemd unit
• toCSV.py, concat-example.sh, cachebust.sh : utility scripts
• 88-tar1090.conf, default : default runtime configs (/etc/default/tar1090)
– html/ (the entire frontend)
• index.html, script.js, config.js
• libs/ (OpenLayers, jQuery plugins, zstd decoder)
• layers.js, dbloader.js, jsonWorker.js : JS modules handling maps, data loading, decompression
• geojson/ and flags/ : static overlay data (airspaces, orbits, country flags)
• style.css, formatter.js, markers.js, planeObject.js, registrations.js : UI logic
– Multi-instance support
• Instances defined in /etc/default/tar1090_instances, separate html-<name>/, config.js per instance
README for additional insights
– The README details
• how the install script sets up systemd, config files, and web server includes
• how tar1090 reads JSON from /run/<instance> created by readsb/dump1090
• how JS modules request data via HTTP (optionally through nginx-readsb-api.conf)
• external integrations: flightawareLinks, shareBaseUrl, heywhatsthat.com outlines, AIS catcher
a. Main components
– ADS-B Decoder Service (readsb or dump1090-fa)
– Tar1090 Daemon (systemd service + tar1090.sh)
– Data Storage
• Live data socket or files in /run/<instance>
• History snapshots (JSON files written periodically)
• Optional globe history (zstd-compressed heatmap data)
– Web Server (nginx or lighttpd)
– Static Frontend (html directory)
– Client Browser (end user interface)
– External Services (FlightAware, ADSB-exchange, heywhatsthat.com, AIS-catcher)
b. Relationships and interactions
1. Decoder Service → writes live JSON feed & history files → Tar1090 service reads these and rotates snapshots.
2. Tar1090 service ↔ configuration files (/etc/default/tar1090, config.js) define intervals, ports, instance names.
3. Web Server
• Serves static files from /usr/local/share/tar1090/html
• Proxies or directly exposes decoder JSON endpoints (e.g., /data/aircraft.json)
• Optionally uses nginx-readsb-api.conf to consolidate API calls.
4. Browser → HTTP GET static assets (HTML/JS/CSS/GeoJSON) → runs JS modules.
5. Browser JS modules → poll decoder API endpoints → render map via OpenLayers → overlay geojson & history.
6. Browser → may call external URLs (flightawareLinks, shareBaseUrl) or load heywhatsthat.com outlines via getupintheair.sh.
c. Architectural patterns & design principles
– Separation of concerns: Data decoding vs. UI rendering vs. installation/config
– Static SPA frontend fetching JSON data asynchronously
– File-based “database”: snapshots instead of a traditional DB
– Modular JS with workers (jsonWorker.js) for off-main-thread parsing / decompression
– Multi-instance tenancy via directory naming and config files
d. Key technologies & libraries
– readsb / dump1090-fa (C/C++ decoder)
– systemd service + shell scripts (bash)
– nginx or lighttpd web server
– JavaScript, OpenLayers 8.x, jQuery UI Touch Punch
– zstddec-tar1090 for zstd decompression in JS
– GeoJSON overlays, CSS for theming
Detail without overthinking
– Capture every file-based interface (e.g., /run/<instance>/aircraft.json)
– Show optional components (heatmap folder, multiple map options, flag overlays)
– Include multi-instance branching prominently