A self-hosted CI/CD platform: draw a pipeline as a graph, then watch it run.
Deplo is a full-stack deployment automation tool built with Next.js 16, React 19, TypeScript, PostgreSQL, Redis and BullMQ. You build a pipeline in a drag-and-drop graph editor, where each node is a stage, a shell command such as build, test, or deploy, and each edge between nodes is a dependency. Deplo saves it as a versioned definition and checks it for problems like cycles before it can run.
A separate worker process, the runner, then executes the stages in dependency order, running independent ones in parallel, retrying failures, pausing at manual approval gates, and sending each stage's logs back to the UI while it runs. Secrets are encrypted at rest with AES-256-GCM, injected only into the stages that need them, and masked in the logs. The runner is built to survive crashes: if it dies mid-run, it picks up where it left off on restart.
- Visual pipeline editor. Drag stages onto a canvas and connect them (React Flow). Each stage has its own command, timeout, retry count, environment variables and secrets.
- Versioned definitions. Saving a pipeline creates a new version only when something actually changed, so a run always records exactly which pipeline it executed.
- Validation before running. Deplo rejects cycles (and shows the loop as a readable path), connections to or from a stage that no longer exist, stages without a command, and deploy stages that have no approval gate in front of them.
- Parallel, dependency-ordered execution. Independent stages run at the same time. Each stage has a timeout and a retry budget, and a run can be cancelled partway through.
- Manual approval gates. A run pauses at an approval stage until someone approves or rejects it.
- Live logs. Stage output appears on the run page while the command is still running, and each retry attempt keeps its own logs and exit code.
- Logs Mask Secrets. An Aho-Corasick matcher masks secrets in the logs by checking each chunk of text from the stage output, even when chunks arrive in separate intervals.
- Environments and encrypted secrets. Secrets are scoped to an environment (dev, staging, production) and decrypted just before the stage that uses them starts.
- Audit log. Changes to pipelines, runs, environments, secrets and webhooks are recorded along with who made them.
- GitHub sign-in via OAuth (NextAuth).
flowchart LR
browser([Browser])
subgraph web["Next.js app"]
pages["Server components<br/>(pages poll for updates)"]
actions["Server actions<br/>(forms, run trigger, approvals)"]
end
pg[("PostgreSQL<br/>via Prisma")]
subgraph redis["Redis · BullMQ"]
runq[["pipeline-runs queue"]]
stageq[["pipeline-stages queue"]]
end
subgraph runner["Runner (separate Node process)"]
sched["Run worker<br/>decides which stages are ready"]
exec["Stage worker<br/>runs one attempt of one stage"]
recovery["Reaper + sweeper<br/>crash recovery"]
end
shell[/"Stage shell command"/]
browser --> pages
browser --> actions
pages -- read --> pg
actions -- write --> pg
actions -- "run X changed" --> runq
runq --> sched
sched -- "claim ready stages" --> pg
sched -- "run stage S" --> stageq
stageq --> exec
exec -- spawn --> shell
exec -- "status, exit code, log tail" --> pg
exec -- "stage done, check run" --> sched
recovery -. "resume unfinished runs" .-> sched
How a run works:
- Clicking Run writes a
PipelineRunrow to Postgres and adds a job to thepipeline-runsqueue. - The runner reads the run's stage rows, works out which stages have all their dependencies finished, marks them queued, and adds one
pipeline-stagesjob for each. - A stage worker loads the stage's config from Postgres, decrypts its secrets, and runs the command in a working directory set aside for that run. Every 2 seconds it saves the latest output so the UI can show it.
- When the command exits, the worker records the result (or opens a retry) and hands the run back to step 2. This repeats until every stage has finished or one has failed.
The runner keeps nothing in memory between steps. All state lives in Postgres, so a restarted runner can continue any run from where it stopped.
Parts of the project that took the most care to get right:
- Crash-safe scheduling. Every database write in the runner is a compare-and-swap: an
UPDATE ... WHERE status = <expected>. When two workers race, exactly one succeeds and the other backs off, so a stage can never be queued twice. On boot, a reaper retries or fails stages leftRUNNINGby a dead process and frees their jobs in Redis. A sweeper runs every 60 seconds and restarts any run that stalled while Redis or Postgres was briefly unavailable. - Retries that don't lose history. Each retry is a new row in the database, so the failed attempt keeps its own exit code and logs. The retry row is written before the failure is recorded. If it was written after, then it leaves a gap in which a parallel stage finishing could mark the whole run failed while the retry is still pending.
- Secrets never reach Redis. Queue jobs carry only IDs. Secrets are decrypted just before the command starts, and only for the run's own environment. Keys like
ENCRYPTION_KEYandDATABASE_URLare removed from the command's environment. Secret values are masked in log output with a single-pass Aho-Corasick matcher. - Killing the whole process tree. A command run with
shell: truestarts a shell, which then starts the real command. Killing only the shell would leave the real command running. Timeouts and cancellation therefore kill the entire process group, using a negative PID on Linux andtaskkill /Ton Windows. Both are tested, because development happens on Windows and CI runs on Ubuntu. - No hanging requests when Redis is down. A Redis command made during an outage waits indefinitely instead of failing. Therefore, every queue call from the web app has a timeout, and a run that couldn't be queued is removed rather than waiting indefinitely.
| Area | Tools |
|---|---|
| Frontend | Next.js 16 (App Router, React Server Components, Server Actions), React 19 + React Compiler, React Flow, CSS Modules |
| Backend | Node.js, TypeScript, Prisma ORM, PostgreSQL 16 |
| Job queue | BullMQ on Redis 8 |
| Auth | NextAuth v5 (GitHub OAuth, JWT sessions) |
| Testing | Jest, React Testing Library, Playwright |
| Tooling | GitHub Actions CI, Docker Compose, ESLint |
- Node.js 24 (the version CI uses)
- Docker, which runs Postgres and Redis for you
- A GitHub OAuth App for signing in. Create one at github.com/settings/developers with the callback URL
http://localhost:3000/api/auth/callback/github.
# 1. Clone and install (postinstall also generates the Prisma client)
git clone https://github.com/kylegutierrez51/Deplo.git
cd Deplo
npm install
# 2. Configure environment variables, then fill in the blanks in .env
cp .env.example .env
# 3. Start Postgres and Redis
docker compose up -d
# 4. Create the database schema, and optionally load demo data
npx prisma migrate deploy
npx prisma generate
npx prisma db seed.env.example explains every variable and how to generate each value. The ones you have to fill in yourself are:
| Variable | What it is |
|---|---|
AUTH_SECRET |
Key that signs session tokens. Generate with node -e "console.log(require('crypto').randomBytes(32).toString('base64'))". |
AUTH_GITHUB_ID / AUTH_GITHUB_SECRET |
The Client ID and Client Secret of your GitHub OAuth App. |
ENCRYPTION_KEY |
32 random bytes written as 64 hex characters, used to encrypt secrets. |
RUNNER_WORKSPACE_ROOT |
Directory where the runner creates a working folder for each run. |
PROJECT_DIR |
Optional: Absolute path to this repo. Only the seeded demo pipeline uses it. |
Deplo is two processes, so start each one in its own terminal:
npm run dev # web app at http://localhost:3000
npm run runner # worker that executes pipeline stagesSign in with GitHub, open Pipelines, and either build a pipeline or open the seeded verify-and-build pipeline, which runs Deplo's own test suite (If you use the seed, you must have PROJECT_DIR set to the absolute path of Deplo for it to run Deplo's test suite!)
Pushes and pull requests on GitHub can trigger a pipeline run. GitHub cannot reach localhost, so a smee.io channel relays its deliveries to your machine.
- Create a pipeline with a Repo URL (an
https://…orgit@…address), open its editor, and save a valid pipeline graph. Webhook runs check out the pushed commit from this URL before the first stage. - Create a webhook on the Webhooks page with that pipeline as Pipeline to trigger. Copy the Webhook secret before saving; it is not shown again.
- Add a Relay URL: use Create a channel to open a new smee.io channel, and paste its URL into the webhook's Relay URL.
- Run the relay command shown in the webhook's Connect GitHub section, and keep it running while you work:
npx smee-client --url https://smee.io/<channel> --target http://localhost:3000/api/webhook/<webhook-id>
- Add the webhook on GitHub under your repository's Settings → Webhooks → Add webhook:
- Payload URL: the smee.io channel URL
- Content type:
application/json - Secret: the webhook secret from step 2
- Which events: Let me select individual events → Pull requests and Pushes
- Active: checked
GitHub sends a ping when you save; it appears on Webhooks → View Events as Processed. Keep npm run runner running so the runs it triggers execute.
Tests are split into three tiers, and CI runs all of them on every push and pull request, along with lint and type checks.
npm test # unit + component tests (Jest, jsdom, Prisma mocked)
npm run test:integration # against a real Postgres: constraints, cascades, concurrency
npm run test:e2e # Playwright: builds and starts the app, drives a real browserUnit tests need no setup. The integration and E2E tests read their settings from .env.test instead of .env, and use a separate database in the same Postgres container:
cp .env.test.example .env.test
docker exec deplo-postgres createdb -U deplo deplo_testIntegration tests delete everything in the database between tests, which is why they need their own database. The setup refuses to run against a database whose name looks like the dev database. They also apply migrations before they start, but E2E tests don't, so run npm run test:integration once before your first npm run test:e2e.
app/ Next.js pages (one route per resource)
components/ UI: pipeline editor, run detail, modals, shared primitives
lib/ Data access, server actions, pipeline validation, encryption, queue client, utilities
runner/ The worker process that executes stages (see runner/README.md)
prisma/ Database schema, migrations, seed data
e2e/ Playwright tests
- Pipeline Graph gets lost if you refresh the page without saving. For now, it's recommended to just consistently save a pipeline graph.
- Nodes can't be copied and pasted in the pipeline editor.
- Search boxes don't filter anything. The search input on each list page accepts text but isn't connected to the query.
- Stage commands run directly on the runner's machine, with the runner's permissions. There is no container isolation.
- Only one runner process is supported. Crash recovery assumes it's the only runner, so you can't scale out by starting more.
- The seeded demo pipeline only runs on Windows. Its commands use
cmdsyntax (cd /d "%PROJECT_DIR%").