How to connect a custom domain to Railway or Vercel, step by step

Buy the domain, add it at the host, create the right DNS records and wait for the certificate. The exact order, the records, and what to check when it fails.

The four parts of a working domain

A custom domain works when four things line up: you own the name at a registrar, a DNS service answers questions about it, a record points it at your host, and the host has a certificate for it. Most problems come from mixing up which company does which part.

Step 1: register the name

Buy the domain at a registrar such as Cloudflare Registrar or Namecheap, in an account you will still control in five years. Turn on automatic renewal. Use a real email address for the owner contact, because the registrar may ask you to confirm it, and a domain with an unconfirmed contact can be suspended.

Step 2: decide who runs DNS

The registrar and the DNS service can be different companies. Many people keep DNS at Cloudflare whatever the registrar is. If the name was bought elsewhere, you set the nameservers at the registrar to the two that the DNS service gives you. Nameserver changes can take a few hours to be seen everywhere.

Step 3: add the domain at the host

In Railway or Vercel, open the project, add a custom domain and type the name. The host answers with the record it wants you to create. Copy it exactly. Add both the bare name and the www name, and choose which one redirects to the other.

Step 4: create the DNS records

Step 5: wait for the certificate

The host checks the records and requests a certificate. This usually takes minutes. Do not change the records while you wait. When the host shows the domain as active, open it in a private window and check for the padlock.

When it does not work

Do not forget the rest of the zone

The same DNS zone carries your email records. After the site works, add SPF, DKIM and DMARC for your sending domain, and MX records if you receive mail. Then update the address in your payment webhook and in any sign-in redirect, which often still point at the temporary host address.

Letting a tool do it

Shipyard does these steps in order: it registers the name after you confirm the price, creates the zone at Cloudflare, adds the domain at Railway or Vercel, creates the records the host asks for, waits for the certificate and checks the site answers. It only ever changes records it created itself, so an existing zone is safe.

Launch in an hour, not a weekend

Shipyard connects your accounts once, then sets up the domain, hosting, database, email and payments for every new product.

See how it works

Read next

How to connect a custom domain to Railway or Vercel, step by step – Shipyard