- Published on
How to Migrate Firebase to Coolify in Under 2 Hours
Migrating from Firebase to Coolify allows you to host your own applications on a private server for as little as $5 per month while maintaining a high-quality developer experience. By switching to Coolify, you gain full control over your data and avoid the "vendor lock-in" (being stuck with one provider's specific tools) common with Google’s ecosystem. Most developers successfully complete the core setup and migration of a standard web application in less than 2 hours.
Why are developers moving away from Firebase?
Firebase is a BaaS (Backend-as-a-Service), which means it handles your database, files, and logins in a closed environment. While this is great for starting fast, the costs can become unpredictable as your user base grows. You often pay for every single "read" or "write" to your database, which adds up quickly.
Coolify is an open-source "PaaS" (Platform-as-a-Service) that you install on your own VPS (Virtual Private Server - a computer you rent in the cloud). It gives you a dashboard similar to Vercel or Netlify but lets you run any database or language without per-request fees. We've found that this shift often reduces monthly cloud bills by over 80% for growing startups.
Self-hosting used to be difficult because you had to manage servers manually using a terminal. Coolify changes this by providing a simple visual interface to manage your apps, SSL certificates (the "lock" icon in your browser), and backups. It brings the ease of Firebase to a server that you actually own.
What do you need before you start?
Before moving your code, you need a place for Coolify to live. Think of this as buying a plot of land before building your house.
- A VPS provider: You can use services like Hetzner, DigitalOcean, or Linode.
- A Clean Server: Choose Ubuntu 22.04 or 24.04 as your operating system.
- Minimum Specs: You should have at least 2GB of RAM and 1 CPU core.
- A Domain Name: You'll need this to point your users to your new home.
How do you install Coolify on your server?
Once you have your VPS, you will receive an IP address (a string of numbers like 123.45.67.89). You will use a terminal to send the installation command to your server.
Step 1: Connect to your server Open your terminal and type the following command, replacing the IP with your own:
ssh root@your_server_ip
Step 2: Run the installation script Copy and paste this command to start the setup:
# curl -fsSL downloads the installation script securely from the internet
# The pipe symbol (|) sends that script directly to 'bash' to run it on your server
curl -fsSL https://get.coollabs.io/coolify/install.sh | bash
Step 3: Access the dashboard
Wait about 5–10 minutes for the process to finish. Then, open your web browser and go to http://your_server_ip:3000.
What you should see: You will see a clean login screen asking you to create an admin account. Once logged in, the dashboard displays a sidebar with "Projects" and "Servers," and a main area showing your server's health (CPU and RAM usage). It looks very similar to professional hosting platforms you may have used before.
How do you replace Firebase Firestore?
Firebase Firestore is a NoSQL (Non-Relational) database. When moving to Coolify, you have the choice to stay with NoSQL using MongoDB or switch to a relational database like PostgreSQL.
Step 1: Create a new Database In the Coolify dashboard, click on "Projects," select your project, and click "New Resource." Select "PostgreSQL" or "MongoDB" from the list of available services.
Step 2: Configure the Database Give your database a name and click "Deploy." Coolify will automatically set up the "Docker Container" (a lightweight, isolated box that runs your software) for you.
Step 3: Get your Connection String Once deployed, Coolify provides a "Connection String" (a URL that contains your username and password). You will paste this into your application's environment variables (settings used to connect to external services).
What you should see:
In the "Service" view, you will see a green "Running" status. Below that, a list of credentials like POSTGRES_PASSWORD and POSTGRES_URL will be visible for you to copy.
How do you handle Authentication without Firebase Auth?
Firebase Auth is often the hardest part to leave because it handles user passwords and social logins. To replace it on Coolify, you can use open-source alternatives like Better Auth, Auth.js, or Supabase (self-hosted).
For beginners using Next.js 15 or React 19, we recommend using Better Auth or Auth.js. These libraries sit inside your code rather than being a separate cloud service. This means your user data stays in the database you just created on your own server.
If you prefer a separate service that feels like Firebase, you can deploy "Appwrite" or "PocketBase" directly through the Coolify "One-Click Services" menu. These tools provide a ready-to-use dashboard for managing users.
Using a self-hosted auth solution ensures you never lose access to your user list. It also prevents your app from breaking if a third-party provider changes their pricing or terms of service.
How do you deploy your frontend code?
Coolify connects directly to GitHub. When you push new code to your repository, Coolify notices the change and updates your website automatically.
Step 1: Connect GitHub Go to "Sources" in Coolify and click "Add New Source." Follow the prompts to give Coolify permission to read your code repositories.
Step 2: Create a New Application Inside your project, click "New Resource" and select "Public/Private Repository." Choose the repository that contains your web app.
Step 3: Set Build Settings
Coolify usually detects if you are using Next.js, Vue, or Vite. It will suggest a "Build Command" (like npm run build) and an "Install Command" (like npm install).
Step 4: Add Environment Variables Remember that database connection string from earlier? Click the "Environment Variables" tab in your application settings and paste it there. This tells your code where to find the data.
What you should see: After clicking "Deploy," you will see a "Deployment Logs" screen. It will show text scrolling by as it installs your packages and builds your site. Once it finishes, a "Success" message appears, and Coolify provides a temporary URL to view your live site.
What are the common migration gotchas?
Moving from a managed service to your own server involves a few new responsibilities. Don't worry if things don't work perfectly on the first try; it is normal to hit a few bumps.
- Memory Limits: If your server has only 2GB of RAM, avoid running too many databases at once. If a deployment fails with an "Out of Memory" error, you may need to add a "Swap File" (using your hard drive as extra temporary RAM).
- Cold Starts: Unlike Firebase Functions, your app on Coolify is always running. This means there is no "Cold Start" (the delay when an app wakes up), but it also means the app uses server resources even when no one is visiting.
- Data Migration: You cannot simply "point" Firebase to Coolify. You must export your Firebase data as JSON and write a small script to import it into your new PostgreSQL or MongoDB database.
- SSL Delays: When you point your domain to your new server, it can take anywhere from 5 minutes to 24 hours for the "SSL Certificate" to activate. If you see a "Privacy Warning," just wait a little longer.
Next Steps
Now that you have your server running and your first app deployed, you have broken free from Firebase's pricing tiers. Your next goal should be setting up automated backups so your data is safe even if the server crashes. You might also want to explore "Object Storage" like MinIO, which replaces Firebase Storage for saving user images and files.
For more detailed guides, visit the official Coolify documentation.