Coolify is a self-hosted deployment platform that gives you a Heroku-like experience on your own server. It's perfect if you want full control over your infrastructure with a user-friendly UI.
If you prefer a video guide, watch the tutorial: https://youtu.be/F0dXcw5f6ww
Why Coolify?
- Self-hosted Heroku alternative
- Browser-based dashboard for easy management
- Built-in MongoDB and Redis provisioning
- Automatic SSL certificates
- GitHub integration for auto-deploys
- Full control over your data
Prerequisites
- A VPS or cloud server (2GB RAM minimum, 4GB recommended)
- A domain name pointed to your server
- A GitHub account with Maillayer repository forked
- Basic familiarity with terminal/SSH
Step 1: Create a Virtual Private Server (VPS)
In this guide, we'll use DigitalOcean (new accounts get $200 free credit for 60 days), but the process is nearly the same for any VPS provider. Start by creating a Droplet:

Once your droplet is created, you'll get its public IPv4 address. Now use a terminal to connect to your server:
ssh root@your.server.ip
Replace your.server.ip with the actual IP address, press enter, and enter your password when prompted.
Step 2: Install Coolify
Coolify is a self-hosted deployment platform (similar to Heroku). It's the easiest way to manage your deployments via a browser-based UI.
Run the following command on your server to install Coolify:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
Once installed, you'll see a message confirming success:

You can now access the Coolify dashboard via:
http://your.server.ip:8000
The first time you open it, you'll be prompted to create a root account.
It should now look similar to a cPanel dashboard:

Step 3: Create a Project in Coolify
- Click the Add button to create a new project.
- Follow the flow:
- Create Project → Production
- Add New Resource
- Select Private Repository (with GitHub App)
- Click Add GitHub App
- Click Continue
- Click Register Now
- Install the GitHub App
- Select the forked Maillayer repo and click Save
Go back to your project → click Add New Resource again → select Private Repository (with GitHub App).
Now you'll see the GitHub App you just installed. Choose it, then select your Maillayer repository and click Load Repository.
In the next step, choose Docker as the build pack and click Continue:

Step 4: Configure Custom Domain
On the project config page, before deploying, set your custom domain.
Do not click the Deploy button yet!
Use your domain with https format. For example:
https://mail.yourdomain.com
Click Save.

Step 5: Add MongoDB and Redis
- In your project dashboard, click Add New Resource.
- Search or scroll to MongoDB, click on it, then hit Start.
- Once running, copy the Mongo URL (internal) – you'll need this later.

Repeat the same for Redis:
- Search for Redis
- Click Start
- Copy the Redis URL (internal) for later use
Step 6: Add Environment Variables
- Go to your project
- Click the Application tab
- Go to Environment Variables
- Switch to Developer View
- Paste the following environment variables with your actual values:
# Application
NODE_ENV=production
BASE_URL=https://mail.yourdomain.com
NEXTAUTH_SECRET=your-secret-key-here-min-32-chars
TRACKING_SECRET=your-secure-tracking-secret
MONGODB_URI=your-mongo-internal-url
REDIS_URL=your-redis-internal-url
Click Save All Environment Variables.
Step 7: Deploy
Now everything is set. Go ahead and click the Deploy button!
It might take 3-5 minutes to complete the deployment.
Once deployed, open your domain (e.g. https://mail.yourdomain.com) — you'll be prompted to create your admin account.
Monitoring & Logs
- View real-time logs in the Coolify dashboard
- Monitor resource usage from the server metrics
- Coolify restarts crashed services automatically
Estimated Costs
| Resource | Cost |
|---|---|
| DigitalOcean Droplet (2GB) | $12/month |
| Hetzner CX21 | ~$5/month |
| Vultr (2GB) | $10/month |
Total: ~$5-12/month depending on provider.
Troubleshooting
Coolify dashboard not loading
- Ensure port 8000 is open:
ufw allow 8000 - Check Coolify status:
systemctl status coolify
Build fails
- Check logs in the Coolify dashboard
- Ensure you have enough RAM (2GB minimum)
MongoDB/Redis not connecting
- Use the internal URL, not the public one
- Verify services are running in the Coolify dashboard
SSL not working
- Ensure your domain DNS is pointing to your server
- Wait a few minutes for Let's Encrypt to provision
