How midorin-linux/guardian-web works
Main Components
a. Front-end (ts-src)
• Built with React + TypeScript, bundled by Vite.
• UI components under ts-src/components (dashboard, monitor, device_info, etc.).
• Served as static assets (index.html, CSS, JS) in static/assets or via the Vite dev server.
b. Back-end (src/)
• Rust web server (main.rs).
• Configuration loader (src/app/config.rs, settings.toml, .env).
• Request handlers in src/handles/ (specifications API, stream_monitor for real-time streams).
• Business models in src/models/.
• Utility modules (logging, shutdown coordination).
c. External Targets / Services
• Managed computers or agents (over SSH, HTTP, gRPC, or custom protocol).
• Potential external storage or telemetry stores (if introduced later).
Interactions & Data Flow
• Browser requests front-end assets → HTTP GET to web server or static host.
• Browser UI → HTTP REST calls or WebSocket/SSE for real-time monitoring → Rust API endpoints (/api/specifications, /api/stream).
• Rust handlers → business logic using models and utils/logging.
• Rust server → remote managed computers (polling, streaming metrics) via stream_monitor.
• Rust server → graceful shutdown coordination (shutdown.rs).
Architectural Patterns & Design Principles
• Clear separation of concerns:
• “config” layer for settings
• “handles” for HTTP layer
• “models” for domain data
• “utils” for cross-cutting concerns (logging, shutdown)
• Modular code structure for testability and future microservice extraction.
• Front-end: component-based UI with hooks and utility libs.
Technologies & Frameworks to Call Out
• Back-end: Rust (Cargo.toml), likely using an async web framework (Actix, Axum or similar).
• Front-end: React + TypeScript, Vite bundler (vite.config.ts), ESLint.
• Configuration: .env, settings.toml.
• Build & CI: GitHub Actions (.github/workflows/rust.yml), bun.lock (JS runtime?), package.json.
Essential Elements
• Clear labels (e.g., “React App”, “Vite Dev Server”, “Rust API Server”, “Specification Handler”, “Stream Monitor Handler”)