Coolify Tutorial: Self-Host Like Heroku for Free
Deploy any app with Coolify, the open-source Heroku alternative. Complete setup guide with Docker and SSL.
Molted Team
Molted.cloud
Heroku free tier died. Vercel bills stack up fast once you pass the hobby limits. Meanwhile, a $5/month VPS from Hetzner or DigitalOcean sits there with 2 CPUs and 4GB RAM, mostly idle. Coolify turns that VPS into your own Heroku-style platform, complete with Git deployments, SSL certificates, and database provisioning.
The pitch is simple: open-source, self-hosted, and genuinely free (besides server costs). You push code, Coolify builds and deploys it. No vendor lock-in, no surprise bills, and you own everything.
What Coolify actually does
Coolify is a Platform-as-a-Service that runs on your own infrastructure. Under the hood, it manages Docker containers, handles reverse proxy configuration with Traefik, provisions SSL via Let's Encrypt, and gives you a clean UI to manage it all.
You connect your GitHub/GitLab repos, define build settings, and Coolify handles the rest. Push to main, your app rebuilds. Need a PostgreSQL database? Click a button. Redis? Same deal.
It competes with:
- Heroku - Similar developer experience, but you pay Heroku for compute you could own
- Vercel/Netlify - Great for static/JAMstack, but Coolify handles full-stack better
- Railway - Managed PaaS with usage billing that can surprise you
- CapRover - Similar concept, older project, less polished UI
Prerequisites
You need a few things before starting:
- A VPS with 2GB+ RAM - Hetzner CX23 ($3.97/mo), DigitalOcean Basic ($4/mo), or Vultr equivalent
- Ubuntu 22.04 or Debian 12 - Fresh install recommended
- A domain name - You will point it to your server for SSL
- SSH access - Root or sudo user
For this tutorial, I am using a Hetzner CX23 (2 vCPU, 4GB RAM, 40GB SSD) running Ubuntu 22.04. Total cost: around $4/month.
Installing Coolify
SSH into your server:
ssh root@your-server-ipRun the one-liner installer:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bashThis installs Docker, Docker Compose, and Coolify itself. Takes 2-3 minutes depending on your server speed.
Once done, the script outputs your Coolify URL:
Coolify is ready! Open http://your-server-ip:8000Open that URL in your browser. Create your admin account on first visit. Use a strong password since this is your deployment dashboard.
Configuring your domain
Before deploying apps, point a domain (or subdomain) to your server. In your DNS provider:
A record: coolify.yourdomain.com → your-server-ip
A record: *.coolify.yourdomain.com → your-server-ip (wildcard for apps)The wildcard record lets Coolify auto-assign subdomains to your apps (like myapp.coolify.yourdomain.com).
In Coolify dashboard, go to Settings → Configuration and set your domain. Coolify will provision SSL certificates automatically.
Deploying your first app
Let's deploy a Next.js application.
Connect your Git provider
Go to Sources → Add Source. Connect GitHub or GitLab with OAuth. Authorize Coolify to access your repositories.
Create new resource
Click "New Resource" → Application → Select your repo and branch.
Coolify auto-detects most frameworks. For Next.js, it sets:
- Build command:
npm run build - Start command:
npm run start - Port: 3000
Configure domain
Set the domain for your app. Either use a subdomain of your Coolify domain (myapp.coolify.yourdomain.com) or a completely separate domain.
Deploy
Click Deploy. Coolify clones your repo, runs the build, creates a Docker container, configures Traefik routing, and provisions SSL. First deploy takes a few minutes; subsequent deploys are faster due to caching.
Watch the build logs in real-time. If something fails, the logs tell you exactly what went wrong.
Adding a database
Most apps need a database. Coolify provisions them as Docker containers.
PostgreSQL
New Resource → Database → PostgreSQL. Set a name and password. Click Create.
Coolify gives you the connection string:
postgresql://postgres:your-password@postgresql:5432/postgresAdd this as an environment variable in your app configuration:
DATABASE_URL=postgresql://postgres:your-password@your-db-name:5432/postgresThe internal Docker network handles DNS, so your app reaches the database by container name.
Redis
Same process: New Resource → Database → Redis. Connection string:
redis://default:your-password@your-redis-name:6379Environment variables and secrets
In your app settings, find the Environment Variables section. Add variables one by one or paste a .env file format:
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
API_KEY=sk-your-secret-key
NODE_ENV=productionCoolify encrypts these at rest. They are injected into your container at runtime, never baked into the image.
For build-time secrets (like private npm tokens), use the Build Variables section instead.
Focus on building, not ops
24-hour free trial. No credit card.
SSL and HTTPS
Coolify handles SSL automatically via Let's Encrypt. When you add a domain to a resource, Coolify:
- Creates an ACME challenge
- Verifies domain ownership
- Issues and installs the certificate
- Sets up auto-renewal
All traffic routes through Traefik, which terminates SSL and proxies to your containers. No nginx config files, no certbot cron jobs.
If certificate provisioning fails, check that your DNS is propagated (use dig your-domain.com) and that port 80/443 is open on your server.
Backups
Coolify can backup databases to S3-compatible storage (AWS S3, Backblaze B2, MinIO).
Go to your database settings → Backup. Configure:
- S3 endpoint, bucket, access key, secret key
- Backup frequency (daily recommended)
- Retention period
Backups run as scheduled jobs. You can also trigger manual backups and download them directly.
Monitoring
Built-in monitoring is basic: container status, restart counts, and logs. For production workloads, consider adding:
- Uptime monitoring - UptimeRobot, Healthchecks.io (free tiers available)
- Log aggregation - Deploy a Loki stack via Coolify for searchable logs
- Metrics - Prometheus + Grafana stack, also deployable via Coolify
Coolify has a one-click deploy for monitoring stacks in their service marketplace.
Limits and when to move on
Coolify works great for small to medium workloads. However:
- Single server - No built-in clustering. If your VPS dies, everything dies.
- Resource contention - All your apps share one server's resources.
- No auto-scaling - Traffic spikes hit your server limits.
- DIY maintenance - You handle updates, security patches, and 3 AM outages.
For hobby projects and early-stage startups, these limits rarely matter. As you grow, you might migrate to Kubernetes, managed services, or specialized hosting per workload type.
The beauty of Coolify: your apps are standard Docker containers. Migration means pointing your CI/CD elsewhere. No proprietary lock-in.
Coolify vs alternatives
| Feature | Coolify | CapRover | Dokku |
|---|---|---|---|
| UI | Modern, polished | Functional, dated | CLI only |
| Git integration | Native OAuth | Webhook-based | Git push |
| Databases | One-click | One-click | Plugins |
| Active development | Very active | Slower | Active |
Coolify is the most user-friendly option for self-hosted PaaS in 2026. If you like the terminal, Dokku is rock-solid. CapRover still works but feels dated compared to Coolify.
Summary
Coolify turns a $5 VPS into a deployment platform that rivals Heroku's developer experience. Git push deploys, automatic SSL, one-click databases. The tradeoff is maintenance responsibility: you own the server, you fix the problems.
For web apps and APIs, this tradeoff usually makes sense. You save money and learn infrastructure skills. For specialized workloads like AI assistants, the calculus changes. Running OpenClaw reliably requires specific configurations, monitoring, and security considerations that go beyond typical web hosting.
Skip the DevOps
Molted gives you production-ready AI hosting without the server management.
24-hour free trial · No credit card required · Cancel anytime