Blog · 16 November 2026 · 6 minute read
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
- For www, a CNAME record that points at the target the host gave you.
- For the bare name, the record the host asks for. With Cloudflare DNS a CNAME on the bare name works, because Cloudflare flattens it.
- If the host asks for a TXT record to prove ownership, add that too.
- At Cloudflare, switch the proxy off for these records at first, so the host can issue its own certificate without interference.
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
- The host says the record is missing: you created it at the registrar while DNS is run somewhere else, or the reverse.
- It works for you and not for a friend: an old answer is still cached. Wait, do not edit.
- The certificate never arrives: a proxy or an old record for the same name is in the way.
- The page shows the wrong site: an old A record from a previous host still exists.
- Email stopped working: you replaced the whole zone and lost the mail records. Add them back.
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