Hosting Reviews

How to Deploy Frontend Application to Netlify?

Deploying frontend functions is simply not an infinite issue as we converse. We are able to deploy a website inside minutes with stylish utilized sciences and web internet hosting platforms. There are lots of web internet hosting platforms available on the market. However, we’re taken with Netlify for this textual content.

Let’s deploy our frontend utility to Netlify.

Frontend Purposes

There are completely different types of frontend libraries and frameworks like React, Vue, Angular, and so forth.., And the good news is that every one among these use the similar bundle packager. Deployment for all the frontend functions assemble with completely completely different libraries and frameworks is comparable.  So, we’re good to associate with any of those libraries and frameworks.

We are able to even create frontend functions with none libraries or frameworks. That is the usual strategy of establishing frontend functions as quickly as upon a time. However, it modifications fairly a bit now. So, we’ll assemble frontend functions in quite a few strategies. Though, the deployment course of is analogous for all of those completely different types of frontend functions.


We’ll see deploying one front-end utility constructed with a library and one different one with none library or framework. Let’s assemble minimal frontend functions for deployment using React and Plain JavaScript.


We’ll create straightforward React and JavaScript functions for the deployment demonstration. You create them as properly to adjust to alongside. Or, if you’ve obtained already had frontend functions, then skip to the deployment half.

We would like to don’t forget that the entry stage of any frontend utility should be index.html whereas deploying to Netlify.

If now we have now created functions using any library or framework, we don’t have to worry about it. By default, the libraries and frameworks create index.html file inside the assemble course of for us. However, when now we have now plain JavaScript functions, we would like to create an index.html file as a result of the entry for our utility.


React Application

Run the subsequent command to create a React app.

npx create-react-app demo

You’ll be able to exchange the app as you prefer to sooner than deploying. I’ve merely up to date a line of textual content material on the Residence internet web page. It doesn’t matter, though :).

Plain JavaScript Application


Comply with the beneath steps to create a straightforward JavaScript utility.

  • Create a folder often known as demo.
  • Create three data often known as index.html, sorts.css, and script.js.
  • Right here, index.html is the entry stage for our utility.

Take out your creativity and exchange the app. I am merely together with straightforward points to the equipment.


Coming to the deployment of frontend functions to Netlify, now we have now two decisions. We are able to straight deploy functions from GitHub, GitLab, BitBucket, and so forth.., to Netlify. Or else we’ll deploy using the Netlify CLI (command-line interface). It’s non-compulsory to know every to deploy our functions. However, it’s good with reference to the completely completely different decisions now we have now for the deployment.

Let’s uncover each of them one after the opposite.


We’re using GitHub to host our code. You don’t need to use it as a result of it’s non-compulsory. You would use completely different platforms as you need.

There are two sorts of functions for us to deploy. However, the strategy appears to be associated for every of them. Even though I am going to current you every of them. There are primarily two steps in it. They’re

  • Push the code to GitHub.
  • Deploy the equipment from GitHub using Netlify.

The primary half is frequent for every React and JavaScript functions. Let’s start the deploying course of with the 1st step.

We’re assuming you haven’t had your code on GitHub. When you do have your code on GitHub, then it’s possible you’ll skip the pushing code half. You need git gadget. When you don’t have git put in in your machine, then you definitely want to arrange it sooner than persevering with.

#1. Pushing Code to GitHub

  • Go to your GitHub account and create a repo often known as demo.

  • You’ll be able to see the repo as follows after it’s created.

GitHub Repository

Now, now we have now to push our code to the repository that now we have now created above. To push the code, it’s possible you’ll adjust to the directions given inside the repo or beneath directions.

  • Open terminal or cmd.
  • Go to your enterprise itemizing.
  • Initialize the git with git init
  • Add the modifications to native git git add .
  • Commit the modifications with a message git commit -m 'Accomplished utility'
  • Join the distant repository with our native repository git distant add origin 'your_repo_path'. Substitute your_repo_path alongside along with your distant repository. You’ll be able to uncover it inside the repository equally mine [email protected]:hafeezulkareem/demo.git
  • Now, push the code git push -u origin principal
  • That’s it; now we have now pushed our code to GitHub.

You’ll be able to see the code as follows in your repo.

GitHub Repository Code

We’re achieved with step one among pushing our code to GitHub. When you’re deploying a plain JavaScript utility, then your code might look as follows.

JavaScript Repository

Let’s switch to the next step and deploy our utility to Netlify.

#2. Deploying GitHub code to Netlify

When you don’t have an account in Netlify, create one.

  • Go to the Netlify website.
  • Login to your account.
  • You’ll be able to see a button often known as New website from Git, as confirmed beneath.

Netlify New Site Button

  • Click on the button to start deploying.
  • You’ll navigate to the deploy internet web page that seems as follows.

Netlify Deploy Page

  • You’ll be able to completely completely different code web internet hosting platforms on the internet web page. We’re using GitHub. So, click on on on it.
  • It would open a model new window to login into our GitHub account as follows.

Netlify GitHub Authentication

  • Log in to your GitHub account for Netlify authorization.
  • When you login into your GitHub account, the window will shut saying Licensed.
  • Now, search in your repository title from the given search bar.

Netlify Search Repository

  • If you search for the repository, it gained’t appear because of we didn’t give our repository entry to Netlify. You will notice a button often known as Configure Netlify on GitHub.

Configuring Repository

  • Click on the button and enter your GitHub account password to affirm the entry.

GitHub Confirm Access

  • You’ll navigate to an Entry internet web page that seems as follows.

Netlify GitHub Access Page

  • Scroll down, and you’ll discover a bit often known as Repository Entry.

Repository Access

  • There are two decisions. We are able to present entry to all our repositories or a couple of of them that require it. It’s greater to give entry to the repositories that we’re deploying and by no means all.
  • Choose the Solely select repositories selection as follows.

Select Repository Option

  • Click on on the beneath dropdown and search for the repository that you simply actually need to deploy. Choose it.

Selected Repository

  • Click on on the Save button.
  • It would redirect to Netlify deploy internet web page. And you might even see the model new repository.

Deploying Repository

  • Click on on the repository.
  • It would current completely completely different particulars like a division to deploy, command to arrange packages, and so forth..,

Repository Details

  • When you might have full code on a singular division apart from grasp, exchange it by deciding on the division from the dropdown.
  • Lastly, click on on on the Deploy website button. It’ll redirect you to the dashboard.
  • It would take some time to deploy the positioning.

Site Deploy Progress

  • You will notice the printed website as quickly because it’s deployed.

Published Site

That’s it.

We’ve got effectively deployed our website to Netlify. You’ll be able to click on on on the positioning URL to see it reside.

Demo Site URL

Demo Live

We are able to exchange the positioning and space settings as we wish. However, we can’t cowl it proper right here as a result of it makes one different full matter to discuss. Beneath is the plain JavaScript utility after deployment.

Demo Live

There’s no distinction inside the deployment course of. However, keep in mind not to neglect with reference to the entry stage of the equipment, i.e.., index.html.

Now, it’s time to discover out about one different methodology of deploying our frontend utility.

#3. Deploying code using Netlify CLI

The Netlify CLI is a command-line interface to deploy frontend functions from the terminal or command-line. It’s useful whilst you don’t want to endure some additional steps (above methodology). Just like the above methodology, we’ll deploy React (any library or framework) or JavaScript functions.

You may get your entire documentation of Netlify CLI here. However, it’s non-compulsory to deploy an utility. You’ll be able to refer to it if you end up going to the superior diploma.

Let’s see how to deploy using Netlify CLI.

To start with, now we have now to arrange it on our machine. It’s obtainable as a node bundle. So, we’ll arrange it using the npm. Let’s arrange it using the subsequent command.

npm arrange netlify-cli -g

The flag -g is to arrange the bundle globally so as that we are going to entry it anyplace. You will notice one factor associated to the subsequent image.

Netlify CLI Installation

Let’s see the steps to deploy React and plain JavaScript functions using Netlify CLI.

  • Run the assemble command of React (or another library or framework) utility. We don’t need to run any directions inside the case of a plain JavaScript utility.
npm run assemble
  • Construct command might vary primarily based totally on the library or framework you are using.
  • You will notice a assemble folder as follows.


  • Change your itemizing to assemble folder in case of React utility or enterprise folder in case of JavaScript utility.

React Build

Plain JavaScript Application

  • Earlier than going to the next steps, we would like to create a Netlify account. Go to Netlify and create one account and switch to the next steps.
  • Now, we would like to log in using the CLI. Let’s run the subsequent command to log in.
netlify login
  • The above command will open a model new tab inside the default browser to login into the Netlify account. It’ll take you to the Netlify website.
  • Enter your credentials and log in. You’ll ask to Authorize the CLI after you logged in.

Netlify CLI Authorize

  • Click on on the Authorize to authenticate your self. You will notice profitable message after it.

Netlify CLI Authorize Success

Netlify CLI Authorize Success

  • Now, it’s time to deploy our utility. Run the subsequent deploy command.
netlify deploy
  • It’ll ask you to choose the prevailing website or create a model new one. Select (use your up and down arrows) the Create & configure a model new website and hit Enter.

Netlify CLI Deploy - Create

  •  It’ll then current Groups to choose, use your arrows to select, and hit Enter.

Netlify CLI Deploy Team

  • Now, it’s possible you’ll enter the subdomain in your website. It’s non-compulsory, though. Netlify will choose a random one for us if we go away it. We are able to change it later if we wish to. I am leaving it clear for now.

Netlify CLI Deploy Subdomain

  • It’ll ask us to enter the itemizing that we wish to deploy. We’ve got already navigated to the holiday spot itemizing. Let’s merely hit Enter. You’ll be able to enter completely different directories as properly. However it isn’t straightforward. So, it’s greater to navigate to the holiday spot itemizing first after which deploy.

Netlify CLI Deploy Directory

  • It would deploy our website for a draft URL as follows.

Netlify CLI Deploy Draft

  • You’ll be able to study your website on the draft URL and guarantee each factor is suitable.
  • After checking the positioning, we’ll deploy it to manufacturing using the subsequent command.
netlify deploy --prod

Netlify CLI Deploy Production

  • It would ask only for the itemizing. Enter the itemizing. If we’re within the similar itemizing, then merely hit Enter.
  • That’s it. Our deploying the positioning is full. You’ll be able to go to the positioning to study it.

Netlify CLI Deploy Production

Demo Live

We’re achieved with deploying our website to Netlify using Netlify CLI. You’ll be able to exchange the settings of the positioning in your Netlify dashboard.


Phew! It’s an prolonged one. You don’t need another data to deploy your frontend utility to Netlify after learning this totally.

There are two methods to deploy our utility to Netlify. Which to adjust to? There’s a slight advantage of using the first methodology. Netlify will exchange the assemble every time we push new code to our website repository. However, inside the case of the CLI methodology, now we have now to do it manually.

We on a regular basis take up one methodology over the others primarily based totally on the situations we’re in. Anyway, you notice every the deployment methods. So, we don’t need to worry with reference to the methodology. Select the one which inserts biggest for you.

Notice: The demo web sites confirmed inside the article won’t be obtainable publicly after some time.

Want one other to Netlify? Take a look at these biggest static website web internet hosting platforms.

Glad Deploying 🙂

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *