back

Dreamer

Self-hosted PaaS with scale-to-zero and sub-30s cold starts, deploys any GitHub repo in under a minute.

<30s
Cold start
<1min
Push to live
0
State races under retry

→ built because I had an old PC which was underutilized, and wanted to know exactly what happens between git push and a live URL.

# problem

Replicating a correct Vercel-style deploy pipeline meant solving a thundering-herd race on container wake-up, and enforcing a deployment state machine under concurrent BullMQ workers without corrupting state.

# solution

Hosted on my old PC, A Redis SET NX distributed mutex coordinates container wake-up so exactly one job fires regardless of concurrent requests, and a Postgres trigger enforces valid state transitions at the database layer instead of trusting application code to get the race condition right.

# result

Dual execution engine (AWS ECS Fargate for cloud, local Docker for bare-metal) behind one interface, sub-30s cold starts, and zero state-machine races under concurrent retry attempts.

# architecture

git pushRedis SET NXdistributed mutexBullMQ workerECS FargatecloudDockerbare metalPostgres triggervalid state onlyone interface, two execution engines, zero races under concurrent retries

Try it: the race this mutex solves

5 concurrent wake-up requests hit a sleeping container. Watch what happens with and without the lock.

incoming requests

req-1waiting…
req-2waiting…
req-3waiting…
req-4waiting…
req-5waiting…

container state

asleep

event log

press "fire 5 concurrent requests" above.

DockerBullMQRedisPostgreSQLAWS ECSNext.js

More deep dives on infrastructure and systems on the blog.