Custom Domains

Let users connect their own domains using the Vercel Domains API with DNS verification.

Allow users to connect their own domains to your SaaS in ~10 minutes. Uses the Vercel Domains API for domain registration and DNS verification status polling.

How It Works

  1. User enters a domain in the settings UI (domain-settings.tsx)
  2. Your API calls Vercel's Domains API to register the domain on your project
  3. Vercel returns DNS records the user must configure
  4. The UI polls for verification status: pending → verified → active
  5. Once active, the domain routes to your app

Files

FilePurpose
components/features/custom-domains/domain-settings.tsxComplete domain management UI — add, verify, delete

Setup

1

Get Vercel credentials

  1. Go to vercel.com/account/tokens → Create Token
  2. Get your Project ID from Vercel → Your Project → Settings → General
  3. Optionally note your Team ID (Vercel → Team → Settings → General)
2

Add environment variables

VERCEL_API_TOKEN="your_vercel_api_token"
VERCEL_PROJECT_ID="your_vercel_project_id"
VERCEL_TEAM_ID="your_team_id"    # Optional: only if using a team account
3

Create the domains API route

Create app/api/domains/route.ts with GET (list), POST (add), and DELETE (remove) handlers — see README.md in components/features/custom-domains/ for the full implementation.

4

Create the verify endpoint

Create app/api/domains/verify/route.ts — called by the UI to check if DNS records have propagated.

5

Add to settings

import { DomainSettings } from "@/components/features/custom-domains/domain-settings"

export default function SettingsPage() {
  return <DomainSettings />
}

Environment Variables

VariableRequiredDescription
VERCEL_API_TOKENYesVercel personal access token
VERCEL_PROJECT_IDYesVercel project ID
VERCEL_TEAM_IDNoVercel team ID (only for team accounts)

DNS Configuration for Users

TypeNameValue
CNAMEsubdomaincname.vercel-dns.com
A@ (root domain)76.76.21.21

Root domains require an A record. Subdomains use CNAME.

Verification

  1. Set env vars and start dev server
  2. Navigate to your settings page → enter a test subdomain (e.g., test.yourdomain.com)
  3. Confirm it shows "Pending" status with DNS instructions
  4. Configure the DNS record and click Verify — status changes to "Verified" once propagated
  5. Delete the test domain to confirm removal works

Demo Mode — Explore freely. Some actions are restricted. demo@launchfst.dev / demo1234

Get LaunchFst →