How grim-sudo/busqueda works
1. Top-level deployment: this repo is built to run as a single Docker container. The runtime boundary is one Linux container with Nginx on port 80, a Flask backend in Python 3, and an internal Gitea simulation on port 3000. There is no separate database, message queue, or external SaaS dependency.
2. Request ingress and routing: all browser traffic enters through Nginx. Nginx serves the compiled frontend assets and forwards application requests to the Flask API. The frontend is built during image creation, so the final container does not need Node.js at runtime.
3. Frontend subsystem: the UI is a Vite + React + TypeScript app under frontend/. It is a small client-side dashboard with three visible pieces: SearchPanel, ServiceTable, and StatusBar. The UI is responsible for calling backend endpoints and rendering service registry/status data; it does not do server-side rendering.
4. Backend API subsystem: backend/app.py is the main Flask application. It exposes:
- GET /api/status for basic application metadata,
- GET /api/health for container health and internal IP visibility,
- GET /api/services for the full registry dataset, protected by an X-Api-Key,
- POST /search for service search.
This backend is the central business-logic layer for the app.
5. Data model / registry source: the service inventory appears to come from backend-local code, primarily fake_services.py and configuration in config.py. The backend acts as the authoritative source for service registry content that the frontend displays.
6. Static asset delivery: the frontend bundle and public assets are served as static files, likely through the Flask/Nginx combination rather than a separate CDN or app server. That means the browser talks to one origin for both UI and API, simplifying the diagram to a single user-facing entry point.
7. Internal simulation service: backend/gitea_sim.py represents an internal Gitea-like service used for the lab theme. It is not a full external dependency; it exists inside the container boundary to simulate a developer repository exposure and to support the challenge narrative around leaked implementation details.
8. Startup and orchestration: entrypoint.sh is the container bootstrap layer. It coordinates startup of the web stack and any initialization needed for the runtime environment, while backend/scripts/system_check.py suggests an internal diagnostic or readiness-check path.
9. Configuration boundaries: backend/config.py and backend/nginx.conf are the main operational configuration points. They define runtime behavior such as service addresses, proxy behavior, and environment-sensitive values like the embedded container IP or flag defaults mentioned in the README.
10. Security-relevant architecture: the repo intentionally contains an exposed .git directory served as static content and a vulnerable /search path that uses templating on user input. Those are not separate subsystems, but they are important boundaries in the architecture because they bridge the public web tier to privileged backend behavior.
11. Overall data flow: browser → Nginx → Flask API → registry data / simulated internal services. The frontend consumes status and service data, while the search path accepts user-supplied formatting parameters that are processed server-side. The internal Gitea simulation and exposed repo metadata act as supporting sources for the lab’s intended workflow.
12. Operational shape: this is best diagrammed as a monolith-in-a-container with a proxy front end, a single Python application backend, and a compiled SPA frontend. The main architectural separation is between public web ingress, application logic, and internal simulation/debug artifacts rather than between multiple deployable services.
Main entry points: app.py Flask API · App.tsx Dashboard · nginx.conf Nginx · entrypoint.sh Entrypoint
Components 16
Container runtime
Single-container deployment, startup, and request ingress.
- Browser · User-facing entry point that reaches the app over one origin.
- Dockerfile · Builds the single runtime image and compiles the frontend during image creation.
Dockerfile - Entrypoint · Container startup script that launches the web stack.
entrypoint.sh - Nginx · Public ingress on port 80; serves static frontend assets and proxies API traffic.
backend/nginx.conf
Frontend
Vite + React client-side dashboard.
- Index page · HTML entry for the client-side app.
frontend/index.html - App bootstrap · Bootstraps the React/TypeScript application.
frontend/src/main.tsx - Dashboard · Top-level client dashboard composition and API interaction.
frontend/src/App.tsx - Search panel · Search input and request controls for backend search.
frontend/src/components/SearchPanel.tsx - Service table · Renders the service registry and status rows.
frontend/src/components/ServiceTable.tsx - Status bar · Shows application and runtime status summary.
frontend/src/components/StatusBar.tsx - Vite config · Frontend build-time configuration.
frontend/vite.config.ts
Backend
Flask API, registry data, and internal simulation.
- Flask API · Main backend application exposing status, health, services, and search endpoints.
backend/app.py - Config · Backend configuration and environment-sensitive values.
backend/config.py - Registry data · Authoritative service inventory used by the API and UI.
backend/fake_services.py - Gitea sim · In-container Gitea-like simulation supporting the lab narrative.
backend/gitea_sim.py - System check · Internal readiness and environment check utility.
backend/scripts/system_check.py
Connections 17
- Browser → Nginx: HTTP · All browser traffic enters through the Nginx front door.
- Nginx → Index page: serve · Nginx serves the compiled SPA assets as static files.
- Nginx → Flask API: proxy /api · Application requests are forwarded to the Flask backend.
- Entrypoint → Nginx: start · Container bootstrap launches the proxy stack.
- Entrypoint → Flask API: start · Container bootstrap launches the Python backend.
- Dockerfile → Entrypoint: runtime image · The image assembles the final single-container runtime around the entrypoint.
- Dockerfile → Vite config: build frontend · Frontend assets are built during image creation.
- Index page → App bootstrap: load · The browser loads the SPA entry script from the HTML shell.
- App bootstrap → Dashboard: mount · React mounts the top-level dashboard.
- Dashboard → Search panel: compose · The dashboard includes search controls.
- Dashboard → Service table: compose · The dashboard includes the service registry view.
- Dashboard → Status bar: compose · The dashboard includes the status summary.
- Dashboard → Flask API: fetch data · The UI calls backend endpoints for status and registry data.
- Flask API → Config: reads · The API uses backend configuration to control runtime behavior.
- Flask API → Registry data: serves registry · The registry dataset is sourced from backend-local service definitions.
- Flask API → Gitea sim: internal sim · The backend exposes an internal Gitea-like simulation within the container boundary.
- Flask API → System check: diagnostics · The backend has an internal diagnostic/readiness path.