How to deploy your website to Netlify for free
Deploy your react app to netlify
Go to Netlify and create a free account.
First Method (git provider)
You can choose a repository from a git provider and every time you push your code it will deploy your site.
New site from git button
Click on this button and a popup will open just follow the steps and sign in.
Now just choose a repository you want to deploy. You can leave the build command as default. After you are done just wait for a few seconds and your app will be hosted online.
The hosted URL
You will reach a page similar to this and the URL at the top is where your site is hosted. If you make some changes and want your site to get those new changes just push the new code to one of the git providers.
If you want to change your domain go to the change domain section of this article.
Second Method (drag and drop)
Creating the build
In the terminal run this command
# npm npm run build # yarn yarn build
Deploy the site
A new build folder would have been created in your project. Go to the sites tab on Netlify and then drag and drop your build folder.
Your first site has been deployed successfully.
Third method (Netlify CLI)
Install the Netlify CLI
npm install netlify-cli -g
Run this command to log in to your Netlify account
After running this command a popup will open.
Netlify login authorization
Just click on authorize.
Initialize a new app -
After running this command choose
Create & configure a new site
Choose whichever team you have
You can give a site name for your app
After this, you can just keep pressing enter and it will apply the default proper settings.
To deploy your app just run this command
This command will give you a unique link you can open it in the browser and check if everything is good. After everything is good you can deploy it to the main site through this command
netlify deploy --prod
This will deploy it to the main site.
Editing the domain
If you want to have a custom domain for your site click on domain settings.
Domain settings button
After clicking on the button you will reach a screen similar to this -
Edit site name button
Click on Edit site name and name the site whatever you like
Change site name
Finally, click on save. Congratulations you have a custom domain for yourself 🥳🎉.
Interested in reading more such articles from Avneesh Agarwal?
Support the author by donating an amount of your choice.