How younes101020/delivery works
Project Type and Purpose
• This is a full-stack, self-hostable deployment platform (“Delivery”)—an open-source Netlify/Vercel alternative.
• The monorepo uses pnpm+Turborepo, with:
• apps/web: Next.js web UI (React)
• apps/jobs: Node.js/TypeScript HTTP API & background job service (Express/Koa-style + Bull/Redis)
• packages/*: shared libraries (auth, DB migrations via Drizzle, utils, ESLint configs)
• infrastructure: Traefik reverse proxy + Docker Compose configs
High-Level Architecture Components
a. Ingress & Routing
• Traefik (Docker) routes incoming HTTP/S requests to the web app or API.
• Docker-Compose defines service networks for web, jobs, Redis, SQL DB, etc.
b. Frontend (apps/web)
• Next.js app with pages + API routes
• React components subscribe to SSE endpoints for real-time status
• Client-side calls Next.js API routes under /api/…
c. API & Job Service (apps/jobs)
• Exposes REST endpoints (auth, applications, databases, deployments, envvars, version, GitHub webhooks)
• Uses Bull + Redis as job queue
• Background workers pick up jobs: start/stop containers, provision databases, handle deployments
• Tasks interact with remote Docker hosts over SSH (packages/jobs/src/lib/remote-docker + ssh utils)
d. Persistence
• Postgres (managed via Drizzle ORM + migrations in packages/drizzle)
• Redis (used by Bull for job queue)
e. External Integrations
• GitHub (OAuth apps + webhooks for deployments)
• Remote Docker Hosts (Docker Engine over SSH)
Relationships & Data/Control Flows
• User → (HTTPS) Traefik → Next.js UI
• UI → (HTTP/JSON or SSE) Next.js API routes
• Next.js API → (HTTP/gRPC) Job Service REST API
• Job Service → (Bull) Redis queue → Worker processes
• Workers → (Docker Engine via SSH) create/stop containers
• Job Service & Workers → (SQL) Postgres for metadata, configuration
• GitHub Webhooks → Traefik → Job Service /api/webhooks/github → trigger deployment jobs
Architectural Patterns & Design Principles
• Microservices-style separation: UI vs API/jobs vs background workers
• Queue-based async processing (Bull + Redis) for long-running tasks
• Server-side rendering + API co-location in Next.js for fast UX and incremental adoption
• Shared packages for cross-cutting concerns (auth, DB migrations, utilities)
• Infrastructure as code: Docker Compose + Traefik dynamic/static configs