Tech I Use: Netlify

“Tech I Use” is a series of blog posts that highlights some of the technologies I use for personal projects.

Netlify is a Platform-as-a-Service that hosts front-end applications for you. It takes the contents of a Git repository, runs build commands as directed by the user, and deploys the static files to a CDN for performant and highly available access worldwide. It manages the infrastructure behind the scenes, allowing developers to simply make changes to master to deploy to production. Netlify also builds and deploys a site on every pull request, allowing developers to preview the site before merging.

One amazing feature that takes advantage of Let’s Encrypt is their one-click free SSL certificate acquisition and configuration for custom domains with automatic certificate renewals. Netlify automatically provides a sub-domain with HTTPS for you on netlify.com, but any custom domain you want for the site can also be configured to use HTTPS. This is a big win for Netlify over similar services such as Heroku and github.io.

Other features include form handling, incoming and outgoing webhooks, and OAuth 2.0 support.

Why I Use It

Similar to why I use Heroku, Netlify allows me to easily deploy to production, which means I can focus on developing my website and not have to worry about hosting. In my quest for website hosting, only Netlify handled HTTPS automatically for me, and that was a clear winner in my eyes over Heroku and github.io.

Try It Yourself

Fork the simple HTML website, which contains the following index.html file:

<!DOCTYPE html>
<html>
  <body>
    <h1>Hello World</h1>
    <p>A simple static webpage.</p>
  </body>
</html>

Sign up for Netlify if you haven’t already and go to their main page. Click on ADD A NEW PROJECT, and select where your Git repository is hosted. Afterwards, select the repository with your website. Leave all fields as-is, and click on Build your site to deploy your site.

After a few moments, the website will be available with a randomly generated name and Netlify sub-domain. The website name can be changed under Settings for a more personalized Netlify sub-domain. To view the newly deployed website, click on the application name. Both HTTP and HTTPS versions are available.

A custom domain can be used under Settings (along with the appropriate DNS record changes), and HTTPS can be configured for that domain under HTTPS.

Summary

Netlify is an excellent service for deploying front-end code that handles SSL certificates for you, even if you bring your own custom domain. In this post, we only demonstrated how to deploy static websites, but I hope to demonstrate how to deploy React.js applications with webpack in a future post.

Other options include Heroku and github.io. Heroku can host both front-end and back-end code, but the HTTPS support for custom domains is lacking, with no options at the free tier and no Let’s Encrypt support at the other tiers. For static sites, github.io is an alternative, but it neither supports HTTPS for custom domains nor can it handle non-static websites.

What hosting do you use for your website, and how does it compare to Netlify?

Software Developer | Lifelong Learner. neverendingqs.com