Back to blog

Automatic DNS Tool for Coolify

February 23, 2026 Updated February 23, 2026 3 min read

I Built an Automatic DNS Tool for Coolify with Claude Code

I run a bunch of apps on a self-hosted Coolify server behind Cloudflare. Every single deploy meant the same thing: go to Cloudflare, add an A record, wait, redeploy so Traefik gets the cert. Got old fast.

So I built coolify-dns — a Go service that does it for me. The whole thing was built with Claude Code in a single session, from first line to production deploy.

What it does

Coolify fires a webhook on successful deploy. coolify-dns picks it up, reads Docker containers via the socket, finds Traefik Host() labels, and creates missing A records in Cloudflare. A background poller cleans up records when containers are fully removed.

It only touches records it created (tagged "managed by coolify-dns"). Your manual records are never modified. Stopped containers keep their DNS — only docker rm triggers deletion.

Design choices

Webhook over Docker event polling — Coolify's deploy lifecycle includes health checks, network setup, and label propagation. The webhook fires after all of that. Polling Docker events would mean guessing when labels are ready.

Runs outside Coolify — If coolify-dns itself were Coolify-managed and a deploy failed, DNS provisioning goes down with it. Running it directly with docker compose breaks the circular dependency.

Zero external dependencies — Stdlib-only Go. No module proxy, no vendored tree. go build . is the entire build.

Why not just a script?

Edge cases. What if the record exists? Multiple domains across multiple zones? Cleanup? A bash script gets messy quick. This handles all of it in a single binary. docker compose up -d and forget about it.

Getting started

Point Coolify's webhook to http://coolify-dns:3111/hook and you're done.

Full architecture docs with sequence diagrams and a Grafana dashboard included in the repo.