Coolify: A Self-Hosted Vercel Alternative for Cost-Effective Deployments
If you're a programmer of any sort, you've probably heard of Vercel—unless you've been living under a rock, that is. Vercel is a platform designed to make deploying your apps a breeze. Who wouldn't love the idea of simply pushing your code to GitHub and having it automatically scaled, optimized, and served to the world?
Vercel is primarily used for deploying Next.js and SvelteKit applications, as both of these JavaScript frameworks were created by Vercel themselves. They also offer unique in-code features if you use their platform, which is why Vercel has become the go-to choice for many developers. They're like the iPhone of deployment platforms: sleek, ridiculously popular, and with a thriving ecosystem.
However, just like how you might need to take out a second mortgage to afford the latest iPhone, Vercel can get pretty pricey, pretty fast. It's great for smaller sites, but as you scale up, you don't have control over the costs. There are numerous horror stories about people being absurdly charged by them.
And that's not all. With Vercel, you're only paying for the front end. When it comes to the backend or databases, you'll need to pay for other services like Supabase, Clerk, Auth0, and so on. Overall, running a site can get quite expensive if you don't fit into their free tier. This is often called the "Vercel stack," because if you choose to use Vercel, you then need to choose another backend, database, and whatnot.
A Better, Self-Hosted Approach
But what if there's a better way? What if you could self-host your own deployment platform with the option to deploy your database and all the extensions you need for a fraction of the cost? Well, that's Coolify.
Coolify is an open-source alternative that you can self-host on your own or a VPS server. It's almost like Vercel, where you can give it a GitHub repo and it will set everything up for you in seconds, making sure everything works.
Why Self-Hosting Is Superior
For starters, with self-hosting, you have full control over your code and your data. You're not reliant on a third-party platform, and you can customize everything to your heart's content. Plus, you're not locked into a proprietary ecosystem, which means you can switch to a different platform if you need to.
And let's not forget about the cost savings. With self-hosting, you can save up to 90% of your deployment costs, which is a pretty big deal.
A Closer Look at Coolify
When hosting Coolify, if you use it efficiently, you can actually host your sites for basically free. Most cloud providers allow you a small VM for free, and you can get away with it depending on your use case. Even if you pay for it, you can get away with all of this for less than the price of the Vercel Pro plan.
Coolify is compatible with multiple languages, has Git integration just like Vercel, and can manage everything from SSL certificates to DB backups. It also has some analytical tools that can help you manage your server more efficiently.
Installation and Setup Guide
Let's get it installed and check out how to use it and how it performs. If you're using a VPS, SSH into your server and follow these steps.
1. Install Docker
First, you'll need to get Docker installed if you don't have it already. To get Docker installed, head to the Docker documentation, copy the first command, and paste it into your terminal.
# Command one from Docker's official documentation
Then, copy the second command and paste it into your terminal.
# Command two from Docker's official documentation
After this, Docker will be installed on your computer.
2. Install Coolify
Now, go to Coolify's GitHub page. Scroll down, copy the installation command, and paste it into your terminal. This will get Coolify installed on your server.
# Coolify installation command from their GitHub page
Once installed, you'll see a message on your screen with a URL. Go ahead and open it in your browser. Make sure port 8000 is open for this to be accessible.
3. Initial Configuration
Once you open it, you'll see a page where you'll need to create an account. Enter your details and get signed up. Click on "Skip Onboarding" at the bottom, and you'll see the main dashboard. Now, Coolify is working just as expected.
Deploying a Project with Coolify
Now, let's add a project and check it out.
- Go to the Projects tab and click on the Add button.
- Enter the project name you want to refer to the project as.
- Inside the project, you'll see a production environment by default. You can also add other environments if needed.
- Click on the production environment, and you'll see the resources page. You'll need to add a new resource here.
- I'll be adding a GitHub project called
roomGPT
. It's open-source and public, so you can try deploying it as well. Choose the Public Repository option here. - Click on the server you want it to be deployed on. In my case, it's the local server, so I'll use that. Click on it and then click on the Standalone Docker option.
- Enter the repo URL (
https://github.com/Nutlope/roomGPT
) here and click Check Repo. - Once done, click on the Continue button.
- You'll see a new page. Click on the Deploy button, and your site will start deploying. Logs will be shown on screen.
Once deployed, you'll see a success page. Go back to the homepage, and you'll see the domain it has deployed on. It uses a temporary sslip.io
domain by default, but you can add your own domain here as well by just adding a comma after the sslip domain. If you open this domain, you'll see that your site is accessible and working just as expected.
Setting Up a Database
Now that this is done, let me explain how you can set up your database if needed.
- Go to the project we just created and click on the production environment.
- We can add a new resource here. Click on Add Resource.
- You'll see that there are tons of things you can use, and there are multiple databases available. Let's set up MySQL here.
- Select the server and destination, and you'll see that MySQL is now installed.
- You can see all the credentials for it in here. You can use these credentials to connect your application with the database.
Exploring Other Features
Coolify also offers several other powerful features:
- Servers: Here, you can add other servers that you can manage from this one central panel.
- Sources: You can add your private Git sources.
- Storage: There's another feature where you can add storage buckets and connect them with your applications without any hassle.
- Shared Environment Variables: You can also set up shared environment variables here.
There are tons of features here, and it's better than Vercel for advanced configuration. This is a really useful tool for people who like self-hosting and want to reduce their Vercel costs.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.