Building Serverless with Netlify

By Nick Taylor on

Over the past five years, there has been a big increase in the amount that ‘serverless’ has been mentioned, which can be clearly seen clearly via Google Trends here. But what is serverless, is it right for you and what are its advantages?

Let’s get one thing straight, we’re not living in some sort of magical world where there are actually no servers, there are. A serverless architecture allows you to build and run your web site/application without having to worry about managing the infrastructure that it sits on. Developers can therefore spend more time developing and less time managing an infrastructure that can reliably scale.

Netlify is a great example of this in action and the Fractal Dimensions main site, at, is developed using the Jamstack and deployed on Netlify. Below is the process flow for that application:

As can been seen by the diagram above the developer just has to push his code via source-control, in this case, Github, up to the ‘master’ branch, or whatever branch is set to be the deployment branch. Once that is done, Github notifies Netlify of the changes and Netlify takes care of the rest, building and deploying the project across the world.

Netlify also takes care of invalidating any cache so your users immediately see the most up to date version of your site without you having to worry about invalidating cache yourself.

Does your site have to be static?

Your site doesn’t have to be static to work with serverless either.

The Fractal Dimensions site, for the most part, is static, however, it does contain a contact form. Netlify offer a nifty little feature that automatically applies code to your form and then handles the submissions of the form, the storage of the form data as well as sending you the information via email should you wish it to.

That’s not all though. With Netlify functions, you can write code that can be run on the fly too and they can be called up to 125 thousand times before any extra charges are incurred. This could be used to, for example, handle a form submission yourself or get some data from an API to be displayed on the site. For an extra $25 that goes up to 2 million requests a month, which works out at about 46 requests per minute.

The best bit about all this is, if you have a sudden surge and get thousands of requests a minute, Netlify takes care of the scaling for you so you don’t have to. That’s a huge bonus as it means smaller companies don’t have to spend vast amounts on infrastructure upfront “just in case” there is a surge.

Site previews and reverting changes

Note that a preview is also created. You can set Netlify to not automatically deploy should you wish to, allowing you to review the preview first and then deploying from the Netlify control panel once you are happy. It’s, of course, recommended that you set up a separate site for this, running from a different branch called, for example, staging where testing can be completed before merging any change into the master branch for worldwide deployment.

A complete history of all the builds of your site are also kept forever and previews of each build are available for every build. For example, you can see an old version of the Fractal Dimensions site here. If required, this could be rolled back to at a click of a button within the control panel. So if you spot an issue that was introduced a few builds ago, it’s super easy and quick to roll back to that version.


At the ‘edge’, where the main body of your site will be deployed, no active processes are running to be attacked. When it comes to the serverless functions that can be executed, these are run in isolated containers to run that specific task and therefore, as Netlify puts it “there are no idle environments to attempt to exploit”. An attacker couldn’t, for example, change its code for the next run, as a new instance based on the original code will be created each time the task is executed.

Obviously, no system is impenetrable, however, the systems in place for threat detection and mitigation at a company like Netlify is going to be far greater than what any small business can implement. You have no servers to update and keep patched as that’s all done for you.

A free SSL is also automatically applied to your site when deployed on Netlify, so it’s secure by default, with minimal initial setup. This includes all site previews so you are testing like for like from preview to production.

Edge handlers (currently an early access feature)

Netlify, in particular, allows you to set up Edge Handlers, these are pieces of code that are executed before returning the content to the user. Requests aren’t sent directly to the edge handlers themselves like Netlify Functions, they run as the content is being passed back.

This allows you to change the response, for example, by country, by user for A/B testing or personalising content. So this will allow you to supercharge your ‘static’ site. Allowing only the very necessary functionality to be executed (as most of the site will still be pre-rendered) and therefore allowing your site to still be super responsive for great performance.


This is functionality that Fractal Dimensions is yet to use, but it’s an interesting one that will be looked into further. It’s a complete authentication system, facilitating user registration, login and then things like gated content with role-based access. Further reducing the amount of work developers have to do upfront.

It allows up to 1,000 active users a month for free. That’s active not registered. It’s then $99 a month for up to 5,000 users, which therefore ranges from about $0.10 a month to $0.02 a month per user. So one would hope that those users are providing at least that value each month to your business.

Summing things up

There is a multitude of other smaller features, such as analytics and large media management that won’t be gone into detail here, but they are certainly worth checking out. Note that there is no free level for analytics, this costs $9 a month per site.

The free tier for Netlify is very generous but it’s also worth considering just $19 a month for the Pro version, which gives you more build minutes, more bandwidth and extra features like access control, so you can control who in your team has access to what within the Netlify control panel. For example, giving devs access to a staging environment, but only the team leads to access to production sites. You also get technical support via email at Pro level.

And that’s a wrap…

Although this might at times have sounded like a sales pitch for Netlify, it most certainly isn’t. There is just pure enthusiasm for what can be achieved using a serverless architecture with Netlify. There are other serverless providers, however, not all features in this article will be available elsewhere. It’s always worth keeping an eye on how many of the vendor-specific features you are using, should you ever need to move elsewhere, however, the advantages currently far outweigh the disadvantages.