Skip to main content
Blog

How to publish a Lovable app on a custom domain

Published on Updated on 10 min read

Technology
Lovable
Deploy
DNS
Cloudflare
Vercel

Publish a Lovable-style app on a domain you own using free-tier hosting via GitHub → Cloudflare Pages or Vercel, covering SPA, TanStack Start + Nitro, and the DNS records used.

After you finish an app in Lovable and want your own hostname, two paths show up. Lovable’s built-in custom domain needs a paid plan. The free path through GitHub changes with the project stack. Older apps ship as Vite + React (static SPA). According to Lovable’s external-hosting docs, projects created from May 13, 2026 use TanStack Start with Nitro and need a host that runs a server, not only static files.

I reproduced GitHub → Cloudflare and GitHub → Vercel from scratch on test subdomains of pedrosatin.com, with a public example repository. The Lovable → GitHub step was not reproduced for this example (no Lovable test account); it is cited from the official GitHub sync docs. The sample apps are not a real Lovable export. They were built with the same stack family that publishing flow usually receives.

Quick summary

  1. Check package.json for SPA (Vite + React) versus TanStack Start (@tanstack/react-start).
  2. Put the code on GitHub. With Lovable, follow official Git sync; here I used pedrosatin/lovable-deploy-examples.
  3. SPA: deploy to Cloudflare Pages or Vercel with an index.html rewrite, then add a DNS CNAME.
  4. TanStack Start: on Cloudflare use Workers with @cloudflare/vite-plugin; on Vercel use Nitro with preset: 'vercel'. Static-only Pages will not run the server.
  5. After it is live, open a deep route directly, check HTTPS, and review what the site exposes. For a concrete pass at that stage, the checker at servicos.pedrosatin.com helps; it does not replace the steps below.

What Lovable’s docs say today

Deploying and hosting outside Lovable splits the two project types. An older SPA publishes dist/ on a static host with an index.html fallback. TanStack Start needs a server host, because Nitro packages server routes and functions for the platform preset.

Native domains under Project → Settings → Domains require a paid plan per Custom domains. The examples use the providers’ free hosting allowances. Domain registration and renewal remain separate; I used subdomains of a domain I already own. Vercel Hobby is intended for personal, non-commercial projects; check its fair-use terms before choosing hosting for a commercial app.

To connect Lovable to GitHub, use the GitHub integration and the Git sync overview: an admin opens Workspace settings → Git → GitHub → Add connection and authorizes the GitHub integration. Then, under Project settings → Git → GitHub, choose the connection and click Connect. Lovable creates a new repository, private by default, and starts syncing. These Lovable UI steps were not reproduced here. You do not need to make private application code public to host it.

Example repository

github.com/pedrosatin/lovable-deploy-examples has three folders:

Folder Stack What it shows
spa/ Vite + React + React Router Static SPA with rewrite
ssr-cloudflare/ TanStack Start + @cloudflare/vite-plugin SSR on Cloudflare Workers
ssr-vercel/ TanStack Start + Nitro (preset: 'vercel') SSR on Vercel

Each app has a /sobre route. On the SPA, a full page load only works if the host returns index.html on reload. On SSR, the server builds the page and the response HTML already includes the route heading.

Prepare the sample locally

Use Node.js 24 or later and Git. Fork the sample repository to import your own copy into the hosting providers. For local testing only, clone the revision below. It pins the sample code and the package-lock.json files used by npm ci.

git clone https://github.com/pedrosatin/lovable-deploy-examples.git
cd lovable-deploy-examples
git checkout 125e409acee72955847b950342d3ac699bd6d8bc
cd spa
npm ci
npm run build
cd ../ssr-cloudflare
npm ci
npm run build
cd ../ssr-vercel
npm ci
npm run build
cd ..

Each folder is an independent project. To open one locally, enter its folder and run npm run dev. The sample lockfiles resolve React 19.3.1 and Vite 8.3.8; both SSR examples use TanStack Start 1.169.7. The Vercel example uses Nitro 3.0.260610-beta; the Cloudflare example uses @cloudflare/vite-plugin 1.70.1 and Wrangler 4.166.0. Nitro is a beta release in this sample; another template or version may produce different output.

SPA on Cloudflare Pages

In the Cloudflare dashboard open Workers & Pages → Create application → Pages → Connect to Git, authorize your GitHub copy, and select the branch to publish. I followed Deploy a React site: GitHub-connected project, build npm run build, output dist, root directory spa.

Without a top-level 404.html in the build, Pages assumes an SPA and serves the root for paths that do not match files, per SPA rendering. The sample also includes public/_redirects to declare the fallback explicitly, following Lovable’s external-deployment guide:

/*    /index.html   200

Vite copies this file to dist/_redirects. It is optional on Pages for this sample because there is no top-level 404.html. Hosts without an automatic fallback, such as Vercel, need an equivalent rule for React Router route reloads.

Test domain: under the Pages project’s Custom domains, I added demo-spa-cf.pedrosatin.com. First associate the domain with the project, as Pages custom domains instructs. In my Cloudflare zone, the dashboard created a proxied record. With external DNS, create a CNAME from your subdomain to <your-project>.pages.dev after that association. Public DNS resolves the name to Cloudflare anycast A/AAAA records. Panel status: Active.

Live URL: demo-spa-cf.pedrosatin.com/sobre (also on demo-spa-cf.pages.dev).

SPA About page on demo-spa-cf.pedrosatin.com.

SPA on Vercel

Under Add New → Project in the Vercel Hobby dashboard I imported the same repository with Root Directory spa, build npm run build, and output dist. The SPA needs a rewrite in vercel.json, per Project Configuration → rewrites:

{
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}

Under Domains, Vercel asked for a CNAME. I created only the new record and left existing zone records alone:

Type Name Target Proxy
CNAME demo-spa-vercel 4bb7ddfb3e033b31.vercel-dns-017.com DNS only

Live URL: demo-spa-vercel.pedrosatin.com/sobre (also on demo-spa-vercel.vercel.app).

TanStack Start on Cloudflare Workers

This distinction matters. Cloudflare Pages fits the static case. The TanStack Start sample uses @cloudflare/vite-plugin and wrangler.jsonc names the worker demo-ssr-cf, matching the Cloudflare path in the TanStack Start hosting guide. That is Workers with a server process, not a static-only Pages deploy.

To publish to Workers, run these commands from the repository root:

cd ssr-cloudflare
npm ci
npx wrangler login
npm run deploy

wrangler login authorizes your Cloudflare account in the browser; skip it if the CLI is already authenticated. The deploy script builds the app and runs wrangler deploy using the name in wrangler.jsonc. Choose a name available in your account. Then open the Worker under Settings → Domains & Routes → Add → Custom Domain, enter a subdomain of your Cloudflare zone, and wait for activation. I used demo-ssr-cf.pedrosatin.com, which reached Active. Workers manages this domain’s DNS and certificate; do not copy anycast IPs into a manual record.

Live URL: demo-ssr-cf.pedrosatin.com/sobre (also on demo-ssr-cf.satinp-dev.workers.dev). The response HTML includes Sobre (SSR).

SSR Cloudflare Workers About page on demo-ssr-cf.pedrosatin.com.

TanStack Start on Vercel with Nitro

A project with Nitro configured for Cloudflare needs output compatible with Vercel. Nitro’s documentation describes the vercel preset. In the sample, ssr-vercel/vite.config.ts declares it explicitly:

import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import { nitro } from 'nitro/vite'

const config = defineConfig({
  resolve: { tsconfigPaths: true },
  plugins: [nitro({ preset: 'vercel' }), tanstackStart(), viteReact()],
})

export default config

In the Vercel dashboard, import the repository under Add New → Project, choose Root Directory ssr-vercel, and confirm TanStack Start detection. The build command is npm run build; keep the integration’s Output Directory rather than overriding it with dist. Nitro generates .vercel/output, containing functions and static assets, as the official TanStack Start on Vercel guide explains. Click Deploy and wait for Ready.

Then open Settings → Domains → Add, enter your subdomain, and copy the CNAME requested by the dashboard into your DNS provider. The example requested this new record:

Type Name Target Proxy
CNAME demo-ssr-vercel 3cc94d3e7712c29f.vercel-dns-017.com DNS only

Live URL: demo-ssr-vercel.pedrosatin.com/sobre (also on demo-ssr-vercel.vercel.app). The HTML includes Sobre (SSR + Nitro).

SSR Vercel + Nitro About page on demo-ssr-vercel.pedrosatin.com.

Lovable’s current docs say that on platforms Nitro detects on its own (Vercel included), the build can pick the preset with no extra config. The sample was created with this explicit preset and served server HTML at /sobre; I did not test a failing version with the Cloudflare preset before applying this configuration. If your build already detects Vercel and the deep route returns server HTML, leave the file alone. For 404: NOT_FOUND, check the preset, Root Directory, framework detection, and build output; a 404 alone does not identify the cause.

DNS records for the sample

On the pedrosatin.com zone I only added the four test hostnames. Mail records, apex, and other subdomains stayed untouched. Changing nameservers or deleting MX by mistake breaks mail and services that already use the domain; this flow does not ask for that.

What was live on 21 Nov 2026:

Hostname Provider Observed record
demo-spa-cf.pedrosatin.com Cloudflare Pages Proxied hostname (CF anycast A/AAAA); project Active
demo-ssr-cf.pedrosatin.com Cloudflare Workers Proxied hostname; custom domain Active
demo-spa-vercel.pedrosatin.com Vercel CNAME → 4bb7ddfb3e033b31.vercel-dns-017.com (DNS only)
demo-ssr-vercel.pedrosatin.com Vercel CNAME → 3cc94d3e7712c29f.vercel-dns-017.com (DNS only)

The *.vercel-dns-017.com targets are what the Vercel Domains screen showed for these projects. Another project gets a different suffix; copy the value from the UI, not from this post.

Propagation: Cloudflare DoH saw the records before the machine’s local resolver. If the browser still shows ERR_NAME_NOT_RESOLVED, wait for TTL or check with dig / DoH before recreating the CNAME.

Check the deployment

  1. Open the deep URL (/sobre or your app’s route) in a new tab and refresh.
  2. Confirm HTTPS completes without a warning.
  3. SPA: check the host fallback. On Vercel use vercel.json; on Pages check the default behavior and whether a top-level 404.html exists.
  4. TanStack Start on Vercel: for a 404, check the Nitro preset, Root Directory, framework, and build output; do not apply an SPA rewrite to an SSR app.
  5. TanStack Start on Cloudflare: confirm the deploy is Workers (or your template’s Nitro/Workers target), not static-only Pages.
  6. Configure variables for each environment on the host. VITE_* values become public bundle content; never use that prefix for secrets. Private keys belong only in the server environment. This sample uses no backend or credentials.
  7. When the site is already up and you want to review headers, www redirects, share metadata, and what the HTML actually returns, use the checker at servicos.pedrosatin.com. The checklist above already covers publishing; the tool helps when the question becomes “what is still missing on the domain.”

What was not reproduced

  • A Lovable account, Git sync in the Lovable UI, and codebase download: official docs only.
  • Lovable’s paid native custom domain.
  • Netlify, Registro.br as registrar for this zone, and nameserver changes.
  • Supabase / auth / storage backends outside this sample.
  • Paid Cloudflare or Vercel plans: everything stayed on free/Hobby.

If you would rather have me publish the app on a custom domain, turnaround is usually 1 to 3 business days. Request a quote at servicos.pedrosatin.com (the services page is in Portuguese).

References