Netlify Static Site Hosting Provider
Netlify is one of the go to sites for quick and easy site deployments. Easy to use, setup and they have a great free option. Let's have a look at how it works and some popular features.
Netlify is one of many cloud-based website hosting platforms that allows developers to quickly deploy their code to a website so users can access it, as well as for their own testing benefits.
It’s a Static Hosting Service meaning it’s fully built and served to the clients and not generated on the fly by a server. What is stored is what is served to the user which makes the performance quite fast and simple. However they also have various features like Functions that allow developers to hook into server type functionality for their web applications, but we’ll go into a bit more detail on some of the Netlify features further on.
Why use Netlify?
There are quite a few static website hosting providers out there and they try and make the deployment and hosting as simple as possible for developers. Netlify is one that has been around for a while now and try and make the deployment and integration process of your site as simple as possible.
They also allow for the build and deployment of various sources and coding languages which makes it ideal for a quick deployment for a test site if you want to even just upload some files and get a running website with a url.
If you have your code in a git repository (which if you’re developing code you probably do), then it can hook into your repository directly through multiple git hosting providers:
Github
Gitlab
Bitbucket
Azure DevOps
And when connected you can link it to trigger a deploy when specific branches are updated.
For example, lets say you make some changes in your code and then send your production ready code to your repo (merge/commit to main branch), then it would kickoff an automatic build of your code and release it to a live site without you having to do any extra work!
If you like and have just an html site that’s on your machine that isn’t in a repository, you can also just choose to create a new site, upload the files and it will host them for you.
Super easy!
Let’s have a look at some of the features that Netlify can offer and maybe deploy a simple site.
Some Main Features
Netlify offers a range of services with their hosting, so I’ll run through a couple of the main features that I use regularly, and I’ll run through what is available for the free plan so anyone can start using their services.
Site Hosting
Ok, obviously the key feature is hosting a website.
You can get a website up and running within minutes with various deployment options, you can link it to your Git repository so that it grabs the code and deploys it based on the code type.
You can choose a pre- built template from a selection which includes the code bases:
Next.js
Astro
Gatsby
Nuxt
Solid
Hugo
Or if you don’t have any build and compile requirements for your site, you can simply drag and drop your files to upload them and host them on Netlify.
This makes it extremely quick and easy to get a site up and running and hosted on a Netlify hosted url.
Site Builds
If you’re using a framework of some sort and not vanilla HTML, CSS and Javascript, then changes are you’ll be using some kind of build and compile process for your website.
When you link a Git Repository to create a site it will ask you how the project should be built and then it runs the build for you.
This means that it will build and compile your site with your chosen commands based on your projects needs, you can even choose the Environment Variables you want for your project if it uses them.
And if you’re not sure on the commands you need to set, they have very helpful links and resources.
Automatic Deployment
I love this feature! it makes it super easy to make sure you code goes out live and you don’t have to worry about triggering anything.
If you have your site linked to your Git repository it will automatically run a build and deploy your site when it picks up changes.
For example if you have the main branch selected:
Then it means when you make changes to the main branch of your code it will automatically start a build and then deploy it live for you without you having to worry about triggering anything!
You could be doing lots of changes in your code and then when it’s all good and ready to go, just merge (add it) it to your main branch and then it will pick up all your changes, build it and then you’ll have the changes all ready to view at the url that Netlify provides for you.
Integrations
Netlify has a huge range of integrations that you can install and setup with your projects with great guides on how to incorporate each into your solution.
Some linking CMS data, some for QA testing, some for caching, and many more. Definitely work having a run through what’s there and checking what you could use in your deployments.
Domains
Netlify also assists with domain hosting, however if you have your domain hosted elsewhere you can also link and add your domain to Netlify and it can step your through linking it as well as subdomains where required and also help confirm and configure SSL certificates for your sites.
All with a very simple step-by-step guide and documentation in case you get stuck on the way.
Forms
Forms can be a pain to setup, but with Netlify, they have a simple form integration that you can add to your code and you can manage the submissions and actions of the forms with very minimal code.
For small sites that don’t have a huge amount of submissions it can be great, however for a large website, you may require a more robust solution. But for simple enquiries it can be very handy.
Functions
Netlify Functions provide a way to add backend functionality to your static site. You can write server-side code that is triggered by events or API requests, which lets you build some cool dynamic features like get live data via endpoints, user authentication, and more.
Alot of their functions use the AWS Lambda environment to run and I’ve done a brief post about AWS lambda and creating a simple API endpoint, which you can find here.
Summary
Netlify offers many more features that I didn't cover in detail today, but their comprehensive documentation makes it easy for developers to explore and utilize these tools, ensuring a seamless and straightforward process to get your code live.
I’ve used Netlify for a while now and the free plan is quite generous, I have had a paid plan for a while which allows for some extra features like, extra build time, concurrent builds if doing multiple sites, password protected sites (this one’s what got me, just to make sure some things that aren’t ready yet can be secured) to name a few, here’s a list of the difference:
There are quite a few static site hosting providers out there and Netlify is one of the top providers I’ve used and would suggest giving them a try for your next front end static website builds.
Here are some helpful links to get you started:
Anyway, until next time, happy Dev-ing peeps!