Deploying static sites with Netlify

Jan 12, 2020

Having discovered Gatsby and how easy it makes the process of building static sites, I wanted to find a simple deployment solution that didn’t require having to mess with configuring and maintaining a traditional web server like Nginx.

In the end, I decided to use Netlify which in its own words is described as follows:

Netlify is an all-in-one platform for automating modern web projects. Replace your hosting infrastructure, continuous integration, and deployment pipeline with a single workflow. Integrate dynamic functionality like serverless functions, user authentication, and form handling as your projects grow

Serverless functions, user authentication and form handling are all very interesting features but for my present needs, I am using Netlify primarily as a hosting and deployment service.

Why I chose Netlify

There appears to be a number of good and mostly free solutions for static site hosting such as Zeit, Surge, Github Pages or even AWS S3. I eventually chose Netlify for two main reasons – it’s free and it’s simple.

Free

I was very pleasantly surprised that Netlify and many other similar services are completely free for simple needs such as a personal blog or a demo project. With Netlify, you don’t even have to provide a credit card which is just awesome!

Super simple

What eventually won me over to Netlify was its claim that you can deploy in seconds with just a few clicks. Essentially, all you have to do is three things:

1. CONNECT A GIT REPOSITORY

Choose the repository that contains your website or app. You can choose from GitHub, GitLab or Bitbucket.

2. ADD A FEW BUILD SETTINGS

  • Deployment branch – The branch you want to deploy.
  • Deployment command – The command to prepare your website for deployment (e.g. yarn build).
  • Directory – The directory you want to be hosted on Netlify (typically built during the deployment command, e.g. /public).
Screenshot of the Netlify dashboard – Just these settings are enough to setup hosting and continuous deployment!

3. DEPLOY

Every time you push or merge changes in your selected deployment branch, Netlify will automatically deploy your site using your build settings.

Good documentation

This is always a big one for me whether it be a cloud platform or a framework/library.

Verdict

It’s truly amazing how simple and cheap Netlify makes the process of transferring a project you’re working on locally to something that’s publicly available on the Internet. These are good times to be a web developer!