Build a React Website With Custom Domain in 10 Minutes

Joel Masters
Nov 9, 2020 · 4 min read
Photo by Ferenc Almasi on Unsplash

In this tutorial, we’re going to use create-react-app, Github, Netlify, and namescheap to deploy a React website with a custom domain name.

There are certainly other options for domain name registration and site hosting, but Namescheap provides the least expensive domains I’ve found, is easy to work with, and also comes with whoIs privacy protection for free (so you won’t be spammed with calls and emails when you register a new domain). I also love Netlify as it is free and very easy to use.

STEP 1 OF 5: Create your app

In the terminal, type:

npx create-react-app my-awesome-app
cd my-awesome-app

STEP 2 OF 5: Push your app to Github

In Github, click on the “New” button in the top left:

— — — — — — — — — — — — — — — — — — — — -

Type the name of the app, and click the “create repository” button at the bottom of the screen:

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Copy the code to push your existing repository from the command line:

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Paste the code into the terminal to upload your code.

STEP 3 OF 5: Set up Netlify for hosting

Click on “New site from Git”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

On the next screen, select “Github”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

On the next screen, scroll down to find your Github repo for the app:

Then, on the next screen click “Deploy site”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Next, click on “Domain settings”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Next, click on “Add custom domain”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Type in your domain and click verify

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Then click “Yes, add domain”

Back on the Domain Settings screen, copy the .app link. You’ll use this later after you register the custom domain.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

STEP 4 OF 5: Register your custom domain name at Namescheap

After your purchase is complete, go into your Dashboard, and find the domain name you want to transfer, and click the “MANAGE” button

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Next, click on “Advanced DNS”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Click on “Add New Record”

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Scroll down to CNAME and click

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

For the “Host” type “www”, and for the “Value” paste your .app link from Netlify. Hit the green check mark and you are good to go.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

STEP 5 OF 5: Add your domain to Netlify

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Head on over to your new site and start customizing it :). When you push to your GitHub repo your site will automatically update.

Thanks for reading!

Note: the namescheap link is an affiliate link. I use namescheap for all of my personal websites as I’ve found them to have the best and cheapest services. Feel free to go directly to their website instead.

The Startup

Get smarter at building your thing. Join The Startup’s +741K followers.