Vibe Coding With Fred

3 Ways to Move Your Lovable Website and Keep Free Hosting

3 Ways to Move Your Lovable Website and Keep Free Hosting

If you've built a website using Lovable's AI platform, you might be looking for alternatives to their default hosting—especially given the recent issues with Lovable 2.0. The good news is that you have several excellent free hosting options that can provide better performance, reliability, and features without costing you a dime.

In this guide, I'll walk you through three popular options for hosting your Lovable-generated website: Cloudflare Pages, Firebase Hosting, and Vercel. Each offers generous free tiers and straightforward deployment processes.

Why Move Away from Lovable's Default Hosting?

Before diving into the alternatives, let's consider why you might want to move:

  • More reliable infrastructure: Enterprise-grade hosting platforms with global CDNs
  • Better performance: Faster load times and improved user experience
  • Custom domains: Easy setup with free SSL certificates
  • Advanced features: Analytics, A/B testing, and more sophisticated deployment options
  • Independence: Protection from Lovable platform changes or outages

Option 1: Cloudflare Pages

Cloudflare Pages is an excellent choice for static websites with its global CDN and generous free tier.

What You Get for Free:

  • Unlimited sites
  • Unlimited bandwidth
  • 500 builds per month
  • Custom domains with free SSL
  • Global CDN with 250+ locations
  • Automatic Git integration

Migration Steps:

  1. Export your Lovable project:

    • In Lovable, go to your project settings
    • Click on "Export" or "Download" (usually found in the project menu)
    • Select "Download as ZIP" to get all your project files
  2. Set up a Git repository:

    # Initialize a new Git repository
    git init
    
    # Add all files
    git add .
    
    # Commit the files
    git commit -m "Initial commit from Lovable export"
    
    # Create a new repository on GitHub/GitLab and push
    git remote add origin <your-repository-url>
    git push -u origin main
  3. Deploy to Cloudflare Pages:

    • Sign up for a Cloudflare account
    • Go to the Pages section and click "Create a project"
    • Connect your GitHub/GitLab account
    • Select your repository
    • Configure build settings:
      • For React apps: Set build command to npm run build and output directory to build or dist
      • For static sites: Leave build command empty and set output directory to your site's root
    • Click "Save and Deploy"
  4. Set up your custom domain (optional):

    • In your Cloudflare Pages project, go to "Custom domains"
    • Click "Set up a custom domain"
    • Follow the instructions to add and verify your domain

Real-world Example:

// Example of a simple Lovable React app's package.json
{
  "name": "my-lovable-app",
  "version": "1.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^4.0.0",
    "vite": "^4.3.9"
  }
}

Option 2: Firebase Hosting

Firebase Hosting is Google's solution for hosting web applications and static content, with excellent performance and integration with other Firebase services.

What You Get for Free:

  • 10GB storage
  • 360MB/day data transfer
  • Custom domains with free SSL
  • Global CDN
  • Easy integration with Firebase Authentication and other Firebase services

Migration Steps:

  1. Export your Lovable project (same as above)

  2. Set up Firebase:

    • Create a Firebase account if you don't have one
    • Create a new Firebase project
    • Install Firebase CLI:
      npm install -g firebase-tools
  3. Initialize Firebase in your project:

    # Login to Firebase
    firebase login
    
    # Initialize Firebase in your project directory
    cd your-lovable-project
    firebase init
    • Select "Hosting" when prompted
    • Choose your Firebase project
    • Specify your public directory (usually build, dist, or public)
    • Configure as a single-page app if applicable
    • Set up GitHub Actions for automatic deployment (optional)
  4. Deploy your site:

    # Build your project if needed
    npm run build
    
    # Deploy to Firebase
    firebase deploy
  5. Set up your custom domain (optional):

    • In the Firebase console, go to Hosting
    • Click "Add custom domain"
    • Follow the instructions to verify and connect your domain

Handling Dynamic Content:

If your Lovable app uses backend functionality, you can use Firebase Functions:

// Example of a simple Firebase function
const functions = require('firebase-functions');

exports.helloWorld = functions.https.onRequest((request, response) => {
  response.send("Hello from Firebase Functions!");
});

Option 3: Vercel

Vercel is known for its excellent developer experience and is the company behind Next.js.

What You Get for Free:

  • Unlimited static sites
  • 100GB bandwidth per month
  • Custom domains with free SSL
  • Global CDN
  • Preview deployments for each Git branch
  • Serverless functions

Migration Steps:

  1. Export your Lovable project (same as above)

  2. Set up a Git repository (same as Cloudflare Pages steps)

  3. Deploy to Vercel:

    • Sign up for a Vercel account
    • Install the Vercel CLI:
      npm install -g vercel
    • Deploy your project:
      cd your-lovable-project
      vercel
    • Alternatively, connect your GitHub repository through the Vercel dashboard
  4. Configure build settings:

    • Vercel will auto-detect most frameworks
    • For custom configurations, create a vercel.json file:
      {
        "builds": [
          { "src": "build/**", "use": "@vercel/static" }
        ],
        "routes": [
          { "src": "/(.*)", "dest": "/build/$1" }
        ]
      }
  5. Set up your custom domain (optional):

    • In your Vercel project, go to "Settings" > "Domains"
    • Add your domain and follow the verification instructions

Serverless Functions Example:

// api/hello.js - A simple Vercel serverless function
export default function handler(request, response) {
  response.status(200).json({ message: 'Hello from Vercel Serverless Functions!' });
}

Comparing the Options

Feature Cloudflare Pages Firebase Hosting Vercel
Free Storage Unlimited 10GB Unlimited static sites
Bandwidth Unlimited 360MB/day 100GB/month
Build Minutes 500/month N/A 6,000/month
Custom Domains
SSL
Serverless Functions ✅ (Workers) ✅ (Cloud Functions)
Backend Integration Medium Excellent (Firebase) Excellent
Ease of Setup Easy Medium Very Easy

Handling Lovable-Specific Features

API Integrations

If your Lovable app uses API integrations, you'll need to:

  1. Identify API endpoints: Look through your code for fetch/axios calls
  2. Secure API keys: Move API keys to environment variables
  3. Create serverless functions: For any backend logic

Example of moving an API call to a serverless function:

// Before (client-side)
const fetchData = async () => {
  const response = await fetch('https://api.example.com/data', {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });
  return response.json();
};

// After (serverless function)
// api/getData.js
import axios from 'axios';

export default async function handler(req, res) {
  try {
    const response = await axios.get('https://api.example.com/data', {
      headers: { 'Authorization': `Bearer ${process.env.API_KEY}` }
    });
    res.status(200).json(response.data);
  } catch (error) {
    res.status(500).json({ error: 'Failed to fetch data' });
  }
}

Database Connections

If your Lovable app uses a database:

  1. For Firebase: Use Firestore or Realtime Database
  2. For Cloudflare: Connect to external databases via Workers
  3. For Vercel: Use serverless functions to connect to your database

Troubleshooting Common Issues

1. Build Failures

If your site fails to build:

  • Check build command and output directory settings
  • Ensure all dependencies are in package.json
  • Look for environment variables that need to be set

2. Routing Issues

For single-page applications (SPAs):

  • Cloudflare: Add a _redirects file with /* /index.html 200
  • Firebase: Set "rewrites": [{ "source": "**", "destination": "/index.html" }] in firebase.json
  • Vercel: Usually handles this automatically

3. CORS Issues

If you're getting CORS errors:

  • Set up proper CORS headers in your serverless functions
  • Use proxies for third-party APIs that don't support CORS

Conclusion

Moving your Lovable website to a dedicated hosting platform gives you more control, better performance, and protection from platform-specific issues. All three options—Cloudflare Pages, Firebase Hosting, and Vercel—offer generous free tiers that should accommodate most personal and small business websites.

My personal recommendation? Start with Vercel for the easiest transition, especially if you're not familiar with deployment processes. If you need more advanced features or have higher traffic, Cloudflare Pages offers the most generous free tier with unlimited bandwidth.

Have you migrated your Lovable site to another platform? Share your experience in the comments below!

Vibe Coding With Fred

Sharing coding insights, tips, and tutorials with beautiful code blocks and image embedding.

© 2025 Vibe Coding With Fred. All rights reserved.