How olofblomqvist/odd-box works
Project’s Purpose and Type
• It combines a Rust backend—which manages the reverse proxy logic, configuration parsing, certificate management (including automatic self-signed and Lets-Encrypt certificates), custom server logic, TCP/HTTP proxies—and a web-based UI (in the “web-ui” directory) to provide a graphical administration interface.
File Structure and Map Out the Main Components
• Backend (Rust code):
• src/ – Contains the core application.
◦ main.rs: The application entry point.
◦ src/api: API controllers (e.g., settings, sites) that provide an administration API.
◦ src/configuration: Handles parsing of TOML configuration files (supporting legacy and multiple versions).
◦ src/http_proxy and src/tcp_proxy: Modules handling different levels of proxying (HTTP/1.1, HTTP2, TCP tunneling, TLS logic).
◦ src/custom_servers: Implements support for additional or experimental server types.
◦ Other modules (src/letsencrypt.rs, src/logging.rs, src/self_update.rs, src/tui): Manage certificate generation, logging, self-update functionality, and even a terminal-based UI.
• Web UI:
• web-ui/ – Contains a modern frontend built with TypeScript/React (or similar frameworks using TSX files). It includes components, pages, routing, and asset management via Vite.
• This web UI communicates with the backend’s API for configuration and status updates.
• Configuration & Documentation:
• Deployment / Infrastructure/ DevOps:
• Dockerfile(s), .dockerignore, and various devcontainer and devbox configurations indicate containerization and local development integration.
• CI/CD workflows in .github provide automated building, testing, and release pipelines.
Link the Components with Their Relationships
• A central Reverse Proxy Backend (Rust) that is responsible for processing incoming HTTP/TCP requests, parsing configuration, managing proxies, and orchestrating hosted processes.
• Development and deployment tools (containerization via Docker, devbox, CI/CD workflows) can be represented as external components/tools that interact with the codebase.
Important Architectural Patterns & Design Principles
• Modular Design: Each concern—routing, configuration, API handling, UI rendering—is separated into its own module.
• Declarative Configuration: The use of TOML files for configuration and versioning (v1, v2, v3) shows a design that favors configuration-as-code.
• Cross-platform and extensibility: The architecture’s structure (in src and custom_servers) promotes flexibility and pluggability.
• Reverse Proxy Patterns: The handling of both HTTP-level and TCP-level proxying is clearly central, as is the integration of automated certificate management.