Nebula PaaS: A Self-Hosted Vercel Alternative
Nebula is an open-source, self-hosted Platform-as-a-Service (PaaS) designed to mimic the developer experience of Vercel or Heroku. It allows developers to link their GitHub repositories, automatically build applications, and deploy them to an AWS ECS Fargate cluster with zero-downtime rollouts.
Core Infrastructure
Building a PaaS requires coordinating multiple complex distributed systems. Nebula achieves this through a microservice architecture built on Next.js 16 and PostgreSQL.
1. The Control Plane
The Next.js backend serves as the control plane. It handles user authentication (GitHub OAuth), repository listing, environment variable management, and triggers deployments. All state is reliably stored in PostgreSQL, mapped via Prisma ORM.
2. The Build Engine
When a user triggers a deployment, Nebula pushes a job to a Redis-backed message queue (BullMQ). A dedicated fleet of worker nodes picks up these jobs.
- The worker clones the repository.
- It detects the framework (Next.js, Vite, React, etc.) and injects the appropriate Dockerfile if one isn't present.
- It builds the Docker image and pushes it to an AWS Elastic Container Registry (ECR).
3. Execution & Routing (AWS ECS)
Once the image is built, the control plane orchestrates an AWS ECS Fargate service update.
- Traffic routing is managed via AWS ALB (Application Load Balancer) combined with custom Nginx reverse proxies to map custom domains dynamically.
- Logs are streamed in real-time from the ECS containers back to the user dashboard using WebSockets.
Key Technical Challenges Solved
- Real-Time Build Logs: Streaming gigabytes of build logs from a remote worker node to a web client required implementing a highly efficient WebSocket multiplexer.
- Secrets Management: Environment variables are encrypted at rest using AES-256-GCM before being stored in PostgreSQL. They are only decrypted at build/deploy time inside the isolated worker environment.