How shenmian/tracker works
Project type and purpose
• This is a Rust-based, terminal UI (TUI) open-source tool called “tracker” for real-time satellite tracking and orbit prediction.
• It fetches Two-Line Element (TLE) data automatically from the internet, propagates orbits using the SGP4 model, and renders a live world-map view plus object details in your terminal.
File structure
• Top-level Cargo manifest (Cargo.toml, Cargo.lock) and CI/CD workflows (.github/workflows).
• src/ is subdivided by responsibility:
• main.rs + app.rs – application entry point & orchestration
• config.rs – read/parse configuration (keymap, data sources, update interval)
• event.rs – keyboard/mouse input & event loop (Controller)
• object.rs, satellite_group.rs – domain models for tracked objects & collections (Model)
• utils.rs – shared helpers (parsers, date/time conversions)
• tui.rs – core TUI setup (terminal backend, layout)
• widgets/ – individual UI widgets: world_map, object_information, satellite_groups (View)
• docs/ holds supplementary architecture and configuration guides.
README for additional insights
• Confirms use-cases: display positions/trajectories, detailed info, auto-updating via internet.
• Mentions dependencies (SGP4 model, HTTP update).
Main components and relationships
a. Components:
1. Terminal UI Layer (tui.rs + widgets/*)
2. Event Loop / Controller (event.rs + app.rs)
3. Configuration Loader (config.rs)
4. Network Fetcher (part of utils.rs or a submodule)
5. Orbit Propagation Engine (object.rs + satellite_group.rs + SGP4 crate)
6. In-Memory Data Store (Rust structs for TLE and positions)
7. External Services (TLE provider via HTTP)
8. Filesystem (optional config file on disk)
b. Interactions & data flow:
• On launch: Configuration Loader reads defaults + ~/.tracker.toml.
• Controller schedules periodic “fetch TLE” events → Network Fetcher requests TLE data.
• Parser (utils) transforms raw TLE into Rust domain models.
• Orbit Engine computes current positions & trajectories.
• In-Memory store updated → Event Loop signals UI layer.
• UI Renderer (tui + widgets) reads the store and redraws the terminal.
• User input (keybindings) flows into Controller → may change focus, toggle groups, exit.
c. Architectural patterns:
• MVC-like separation:
• Model = domain modules (object.rs, satellite_group.rs)
• View = widgets/ + tui.rs
• Controller = event.rs + app.rs
• Event-driven update loop: decouples data updates from rendering.
• Modular utilities (parsing, config) extracted to utils.rs for reuse.
d. Key technologies:
• Rust & Cargo
• TUI library (e.g., tui-rs or crossterm)
• HTTP client crate (reqwest or similar)
• SGP4 crate for orbit propagation
• serde/toml for config parsing
Diagramming recommendations
• Controller / Event Loop
• Config Loader
• Network Fetcher
• Orbit Engine
• Data Store
• External TLE Service
• Config Loader → Controller (initialization)
• Controller → Network Fetcher (periodic fetch)
• Network Fetcher → Parser → Data Store
• Data Store → Orbit Engine → Data Store (compute & update)
• Data Store → UI Renderer (on each tick)
• User → Controller (input events)