Skip to content
Domain SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

One-click DNS setup component

Send customers from your SaaS domain settings page to a supported DNS provider for reviewed, automatic record configuration.

Set up DNS automatically

Authorize Cloudflare to add 2 required DNS records for app.customer-example.com.

You will review every DNS change at Cloudflare before anything is applied.

Install

bunx --bun shadcn@latest add https://domain-sdk.dev/r/one-click-dns-setup.json

Usage

Render this component only after your server has discovered that the hostname and Domain Connect template are supported. The callback should request a short-lived, signed authorization URL from your backend and then redirect the browser.

import { OneClickDnsSetup } from "@/components/domain/one-click-dns-setup";

<OneClickDnsSetup
  domain={domain}
  dnsProvider="Cloudflare"
  isConnecting={isConnecting}
  error={connectError}
  onConnect={async (domain) => {
    const response = await fetch(`/api/domains/${domain.id}/dns-authorization`, {
      method: "POST",
    });
    const { authorizationUrl } = await response.json();
    window.location.assign(authorizationUrl);
  }}
  onManualSetup={() => setSetupMode("manual")}
/>;

Credentials, DNS discovery, template support checks, request signing, authorization URL generation, callback validation, and post-return refresh belong on the server. Do not construct or sign Domain Connect requests in this component.

Confirmed provider paths

Application provider Customer DNS provider Setup
Vercel Cloudflare Domain Connect
Railway Cloudflare Domain Connect
Cloudflare for SaaS Any Manual unless your own Domain Connect template is onboarded
Render Any Manual records
Netlify External DNS Manual records
bunny.net Bunny DNS Manual records

Cloudflare is the authoritative DNS provider in the confirmed one-click paths above. Eligibility is per hostname and template, so the UI intentionally does not infer support from domain.provider.

The Vercel and Railway rows are the platforms’ own Domain Connect templates, which only requests signed with Vercel’s or Railway’s key can use. To offer the button for domains your app adds through their APIs, publish and onboard a template under your own providerId; Domain Connect for SaaS custom domains walks through the template, signing key and server code.

Provider references: Vercel Domain Connect, Railway one-click domains, Cloudflare Domain Connect, Render custom domains, Netlify external DNS, and bunny.net SSL setup.

Last updated on