How mdhruvil/deplit works
Project Type and Purpose
• It’s a multi-app system that appears to provide both backend and frontend services along with supporting utilities for deployment and management.
• The apps folder contains several key services – an API server, a builder service, a control plane (likely a user interface), a sidecar, and a spawner – which together suggest that the system orchestrates deployments or project management.
• The existence of “bruno” scripts (with .bru extensions) for creating, updating, and deleting deployments and projects, plus the “api/src/routers” for deployments and projects, reinforces that the project is aimed at managing or deploying projects/environments, possibly through a command-line or web dashboard interface.
• Shared “packages” for eslint, TypeScript, and UI indicate shared internal libraries that provide consistency and reusable components across apps.
Main Components and Their Roles
• API Service (apps/api):
• Serves as the primary backend.
• Contains routers for "deployments" and "projects", middleware (auth-middleware.ts), and a database layer (db/queries, db/schema).
• Manages schema migrations (drizzle) with SQL scripts.
• Builder Service (apps/builder):
• Likely responsible for orchestrating builds, handling git operations, post-processing, and upload tasks.
• Acts as a background or command-line service to trigger build processes.
• Control Plane (apps/controlplane):
• A frontend application (React/TypeScript, using Vite) that provides a web UI.
• Communicates with the API, includes UI components (from packages/ui) and custom libraries for authentication and utilities.
• Sidecar Service (apps/sidecar):
• A lightweight service (with its own Dockerfile and configurations) that might perform auxiliary tasks or add extra functionality alongside other services.
• Spawner Service (apps/spawner):
• Uses Azure Functions-style conventions (host.json, .funcignore) to run serverless functions.
• Contains a “Spawner.ts” function which implies a role in dynamic task execution or service instantiation.
• Bruno Scripts (bruno directory):
• Contains scripts with a custom “.bru” extension that handle deployment and project operations.
• Likely serve as CLI tools or configuration scripts for interacting with the API or deployment system.
• Shared Packages (packages folder):
• ESLint, TypeScript, and UI packages providing consistent configurations and reusable components across apps.
Relationships and Interactions
• The Control Plane (frontend UI) interacts with the API to fetch and update data regarding deployments and projects.
• The API service connects to a database (as indicated by SQL migrations and schema definitions) and exposes REST endpoints (via routers) which the Control Plane consumes.
• The Builder service might be triggered (perhaps via CI/CD pipelines – see .github/workflows) to build, process, and deploy changes to the system.
• The Sidecar could be used for monitoring or extending functionality alongside the main API or Builder.
• The Spawner, as a function-based component, might dynamically create or manage additional instances or underlying infrastructure.
• Bruno CLI scripts appear to provide a user-facing, script-based layer to manage deployments and projects on top of the API’s functionality.
• The shared packages (ui, eslint-config, typescript-config) integrate with various apps to enforce consistency in code style and UI design.
Architectural Patterns and Design Principles
• Modular/microservices architecture: Each application (api, builder, controlplane, sidecar, spawner) functions as a distinct service with its own responsibilities.
• Separation of concerns: Frontend (Control Plane) is clearly separated from backend (API) while supporting services (Builder, Sidecar, Spawner) offer specialized functionality.
• Shared library usage: Common configurations (eslint, TypeScript) and UI components minimize duplication and reinforce design consistency.
• CI/CD integration: GitHub workflows for building/deploying images suggest an automated build and release process.
• Infrastructure as code elements: Dockerfiles and function host definition hint at containerization and potential serverless deployment.