Build with Gatsby
Create a Gatsby site from an Azion template or with the Azion CLI, and deploy it to an Azion domain.
You can deploy a Gatsby site on Azion from a template in Azion Console or from a project you create with the Azion CLI. Both routes finish with the site served on Azion from an Azion domain.
A Gatsby site runs on Azion as a static application. The Gatsby build writes the pages to ./public, and the deploy uploads that folder to a storage bucket that an application serves. To check which other frameworks Azion builds, refer to Frameworks compatibility.
Prerequisites
Console
- An Azion account. To create one, refer to Create an account.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
- A GitHub account, which the template form connects when it asks for one.
Gatsby templates
A Gatsby template is a complete Gatsby project that Azion deploys on your behalf. The Console route deploys one of these templates:
| Template | Use |
|---|---|
| Gatsby Blog Starter Kit | Blog |
| Gatsby Boilerplate | Single-page application |
| Gatsby Ecommerce Theme | E-commerce |
| Gatsby with ButterCMS Starter Project | CMS integration |
Three of the templates have their own guide, linked in the table. For more information on the fourth, refer to Azion Marketplace. In the CLI route, the template picker of azion init offers the same four Gatsby templates.
Deploy the site
Every route builds the Gatsby project and creates the Azion resources that serve it. Use the panel of the route you chose:
Console
To deploy a Gatsby template from Azion Console:
Access Azion Console > Create > Templates.
In Search by name, framework, or keyword, enter Gatsby.
When the form shows GitHub Connection, select Connect with GitHub and install the Azion GitHub App.
In Git Scope, select the scope where the template repository goes.
The deploy page opens and shows the Deploy Log during the build. After a successful deploy, the page shows Successfully created!, the domain URL, and a Manage button that opens the application.
Check the site
Each route gives you the URL of the site’s Azion domain, in the format https://xxxxxxxxxx.map.azionedge.net. In Azion Console, the URL is on the deploy page. In the CLI, azion deploy prints it at the end. Open the URL in a browser to load the Gatsby site.
The first deploy can take several minutes to answer from every location; later deploys take about two minutes. A location that does not have the site yet returns a 404 page with the text There's nothing here yet. If you get that page, wait and load the URL again.