Custom Domain Handling with Vercel
Author Cloudapp
E.G.

Use own domain in Vercel (GUI & CLI) for Nextjs project

May 13, 2024
Table of Contents

It comes to the point in time when your Vercel project is mature enough, and you would like to get rid of the default xxx. vercel.app domain/URL automatically assigned to your project after a successful build.

Adding your domain is the last step before the production release of your project. If you don’t have your domain, I can recommend these three domain registration services:

  1. Google Domains (is using Squarespace.com as registrar)

  2. Namecheap.com

  3. Godaddy.com

I guess there are a thousand more registrars on the market out there, but I can recommend those three because I already used them in the project, and the integration went smoothly.

Google Domains

Open domains.google.com and select “My domains” on the left side to see all domains assigned to your account.

Google-Domains
Google-Domains

If you click on the name of one of your domains, you will see the details, and you can change the DNS settings.

Google-Domains-Records
Google-Domains-Records

Vercel GUI

Now, let’s start with the setup within our Vercel account. As a first step, we selected our project, then “Settings” and “Domains”

vercel settings
vercel settings

Insert your domain name in the Input box where the placeholder “mywebsite.com” is written, and click on “Add”.

Vercel will prepare the needed DNS records for the root domain (example.com) and the selected subdomain (www.example.com) and show you the DNS settings, which have to be applied to your DNS (in this example, we used Google Domains/DNS).

vercel dns records
vercel dns records

So please create the A-Record and the Cname in your DNS (Second screenshot, Point 2 -> Manage custom records). Some minutes later, you will see that Vercel is aware of the new DNS settings and will start creating the needed SSL certificates.

Now, you have associated your custom domain with your Vercel project.

If you click on the button “Edit” in the top right corner, you can configure the settings. You can configure the “redirect,” the status code used, and the assigned Git Branch. This allows you to set up your subdomain for the development branch.

Vercel DNS Git Branch
Vercel DNS Git Branch

Vercel CLI

Alternatively, you can use the Vercel CLI to manage your Domains, assign domains to projects, etc. It’s very handy, and it depends on what you prefer.

Vercel has great Documentation -> https://vercel.com/docs/cli/domains

List all domains under a certain scope

Add domain to the project

Remove a domain from the project

Cloudapp-dev, and before you leave us

Thank you for reading until the end. Before you go:

Please consider clapping and following the writer! 👏 on our Medium Account

Related articles