If you don’t know, Netlify is the service I use to host this website. They asked for developers to do a write-up on how they are using the service and what they like about it so here is mine.
Getting Started with Netlify
Netlify is very easy to get started with. They have a simple user interface that requires little technical knowledge and a generous free plan that allows you to get started without needing a credit card. Simply sign up for an account using either your email or an existing GitHub, Gitlab or Bitbucket account.
Once you have an account you can start hosting your website. The site offers the option of using git to deploy your site or just doing by uploading a folder. Git is a better long term solution but for simplicity nothing beats the folder upload.
Deploying Without Git
Deploying your site without git is very easy. Simply drag and drop a folder containing the top level folder containing the sites index.html file into Netlify’s web interface. All of the files will be uploaded and you will get a test uri where you can see the site. You can then change the test name to something more descriptive of your site and get a uri like “mysite.netlify.com”. This method is great if you’re in a hurry or are unfamiliar with git (although, it is worth learning it). If you ever want to switch to git deployment you can do that at any time in the settings for your website by clicking link to git.
Deploying with Git
If you are familiar with git than its easy to use it to get a clean and fast deployment setup with Netlify. First upload your project to a repository on either Github, Gitlab or Bitbucket. Then when your deploying your site at Netlify, select the service you used. If you haven’t already connected the accounts, you will be prompted to do so at this point. Otherwise, simply select the repository you uploaded the project to. Once you have selected a repository you will be presented with three options. Branch, Dir and Build command. Branch is the git branch you want to store the deployable versions of your site in. By default, this is set to master meaning whenever you push to master a new version will be deployed on Nelify. You can also change it to a different branch if you don’t want every push to master to trigger a new deploy. Dir is the subfolder of your git repository that contains your deployable index.html file. If it’s in the top level folder you can leave it blank. Otherwise change it to the appropriate folder eg “deploy or built”. Finally build is a command to run upon each deploy. You can use this to trigger a static generator like Jekyll or run task runner like Grunt. Once you have set up git deployment every time you push to the chosen branch Netlify will detect it and deploy the new version of your website. This makes it quick and easy to deploy your website from the command line, while ensuring every version remains safely stored in git. You can then configure other settings such as changing the test url to something appropriate for your site or even adding a custom domain.
Before I started with Netlify I tried a few other options. The first was Divshot which worked alright until the service was discontinued and purchased by Firebase. I then used Firebase which is a good service for deploying sites which use its technology, but strong pushes you towards using that. Then I tried Netlify. Netlify met my needs because it was easy to figure out how to use it and it offered a free tier that met my needs. If first used it during a Hackathon and it let me deploy my teams project in only a few minutes without having to set up a payment method. I could then move it to a website with a fairly good looking url and everything just worked smoothly. Latter when I had more time, I set up git deploy and SSL. Both of these things were a breeze which was great because It meant I could easily deploy form the command line and offer a higher level of security via SSL (with potential SEO benefits). So Netlfiy is a great solution for static hosting for anything from quickly throwing up a hackathon project
Netlify is nice because it lets you use a wide variety of tools to construct your static site. The obvious one is git which lets you easily do deployments and keep track of your code. But Netlify also lets you use static site generators such as Jekyll (which this site uses) and integrate them into its build process. Libraries to build single page sites like AngularJS also work well with Netlify. It even has the options to support prerendering them (for better SEO and performance) with paid plans.
Netlfiy has a bunch of cool features. But at this point my favorite is how easy it makes it to set up a static site with a custom domain and SSL using the free plan. This makes it incredibly easy to prototype and set up small websites with no barriers to entrance. Once you have gotten set up Netlify also offers lots of features to help save dev time and scale up such as git deployments and a CDN.
After getting started with Netlify I heard of the JAM stack on one of their blog posts. It sounded interesting so I read up a bit more on it. I quickly found this well written description of the stack. JAM basically moves all server side work to a variety of API’s and makes all of the websites content static. This is great because it makes the majority of the developer work client side work which I am more familiar with. It also allows the server to be divided into well-defined tasks split into many API so that developers can avoid constantly solving the same problems with every time they create a server for a new website. Finally, it means that the static content can all be served quickly over a CDN and potentially have great SEO. While the JAM stack like any other is not perfect for everything it’s a very interesting concept which a lot of potential. It also makes it very easy to get started.