See what's launched

The next gen Gatsby is here Performance, developer velocity, and scaling to meet Enterprise needs - See what’s launched

Sign Up for Free

Announcing the Launch of Functions on Gatsby Cloud

Joel Smith
June 8th, 2021

When we launched Hosting just a few months ago, we knew that we were just getting started. Since then, thousands of sites have been deployed to our edge network and we’ve added key features like rollback deployments and sourcing sites from Bitbucket. Gatsby developers are now enjoying the fastest build and deployment times for their sites all in one platform.

And since we wanted to build an all-inclusive platform for building and serving Gatsby sites, we knew that we needed to venture beyond just the static build and deployment pipeline modern JAMStack developers have come to expect. We needed to provide the tools to build true dynamic web applications with authentication, form submissions, and interactive functionality. It meant bringing the backend to the front.

View of windows showing Functions for Gatsby Cloud

So, we’re thrilled today to launch the general availability of Functions on Gatsby Cloud, a reliable, scalable, and intuitive way to add dynamic capabilities to your Gatsby website. Functions on Gatsby Cloud are serverless functions that enable developers to easily build dynamic functionality and integrations into their site without the hassle of maintaining extra infrastructure. Now, developers can simply write their code in their Gatsby project, deploy it, and Gatsby Cloud will execute their functions on our edge network.  We’ve brought the backend to the front.

How quickly can you get started with Functions? Let’s find out by taking a look at how and why you should implement them for your Gatsby Cloud project today.

Going Farther Faster

Functions on Gatsby Cloud help developers make complex workflows easy. Based on the HTTP routing pattern of the popular Express web app framework, functions allow developers to receive data from requests on a request object and to then respond with data to the requestor on a response object. And for developers who haven’t worked with Express before, the use of Functions in Gatsby is designed to be lightweight and familiar: functions are authored as single files in src/api and, as with pages, the routing is based on the file name. Developers can create a function in a file, deploy their changes, and instantly access their secure, server-side functionality. This has a number of key benefits, but I’ll list just a few:

  • Functions are deployed atomically with your static assets and Gatsby Cloud smartly manages the serverless infrastructure to get the latest version of your function associated with each atomic deployment’s URL.
  • Functions are version controlled, just like the rest of your site. Want to roll back and revert to a previous version? You’ll get the version of that function, as well.
  • Functions are included in Pull Request builds. PR an updated function, and Gatsby Cloud will spin up a Pull Request build for you which contains a live, testable version of your API.
Example sites using Functions on Gatsby Cloud

Using Functions, developers can create a whole host of new interactive features on their Gatsby sites: authentication, personalization, form submissions, real-time secure data updates, writing to encrypted databases, and more. Our team has created a set of examples to help Gatsby developers get started, including submitting form data to Airtable, authenticating with Google SSO, and sending text messages via Twilio. Check out the functions examples in the main Gatsby repo

Functions on Gatsby Cloud are following a well-scripted story that developers have been telling for the better part of a decade since even before Amazon first launched Lambda in 2014. The idea of serverless architecture, that a developer doesn’t need to manage infrastructure in order to deploy their code, has broken down the barriers to delivering complex functionality to your users. With Functions, Gatsby developers can package secure, server-side logic into the developer experience they’ve grown to love:  files that are packaged up and deployed atomically. No need to call your friend who understands the intricacies of infrastructure. No need to worry about scaling up, and scaling down. We handle the hard parts of deployment for you. From your perspective, It’s just code.

Getting Started

Gatsby developers can get started with Functions today by upgrading to the latest version of Gatsby, adding function files to their src/api folder, and deploying them to Gatsby Cloud.

You can learn more about Functions by reading up on them in our docs or checking out some of our example sites.

Share on TwitterShare on LinkedInShare on FacebookShare via Email

Full-stack developer turned product manager. Loves books, coffee, and the endless possibilities of the internet. Very dadly.

Follow Joel Smith on Twitter

Tagged with announcements, Gatsby Cloud, gatsby-functionsView all Tags

Talk to our team of Gatsby Experts to supercharge your website performance.

Contact Gatsby Now
© 2022 Gatsby, Inc.