🚀Deploying on Netlify

launching a project on Netlify

Netlify, like GitHub pages, is also free, provides a yourname.netlify.app subdomain (and also allows us to bring our own top-level domain!)

Installing Netlify on local

  • Install Netlify on the same folder as your app's folder on Terminal

$ npm install netlify-cli

"Building" the app before deployment

  • If we have not created a "build" (the compiled version) for our app yet:

$ npm run build

Deploying the app

  • Then we deploy by simplying entering the command (notice the npx)

$ npx netlify deploy
  • This will open up Netlify on the browser asking for Authorization:

    • grant the access and close the browser tab

  • Go back to the Terminal and answer Netlify's questions with the following:

? What would you like to do? + Create & configure a new site
? Team: (username)'s team
? Site name (optional): (App's name)
? Publish directory build

Ensure that the directory specified is build

Check the app in the URL next to where it says "Website Draft URL"

  • If all looks good then:

$ npx netlify deploy --prod
  • Finally, the deployment will happen on a "Website URL"

  • Check out that Website URL and see if it worked!

Furthermore, you could go to:

https://app.netlify.com/sites/{your app-url here}/overview

...to set up a custom domain and secure your site with HTTPS!

To re-deploy an app, repeat these steps starting from the second step of this article!

Review

We can sum up the Netlify deploy process as the following:

  • npm run build

  • npx netlify deploy (follow the instructions when prompted)

  • npx netlify deploy --prod

References

Last updated