Build with React
Deploy a React app to an Azion domain from an Azion template, from your GitHub repository, or with the Azion CLI.
You can deploy a React app on Azion from a template in Azion Console, from a GitHub repository you own, or with the Azion CLI. All three routes leave the app running on Azion behind an Azion domain.
Azion serves a React app as a static application. The build writes the compiled app to ./.edge/assets, the deploy uploads that folder to a storage bucket, and an application serves it. For the other frameworks that 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. The template form connects it when it asks for one.
React templates
A React template is a starter project that Azion builds and deploys for you. The Console route deploys one of these templates:
| Template | Use |
|---|---|
| React Boilerplate | Starter project |
| React with ButterCMS Starter Project | Starter |
React Boilerplate has its own guide, linked in the table. For more information on the other template, refer to Azion Marketplace. In the CLI route, the template picker of azion init lists every template of the React preset.
Deploy the app
Every route builds the React project and creates the Azion resources that serve it. Follow the panel of your route:
Console
To deploy a React template from Azion Console:
Access Azion Console > Create > Templates.
In Search by name, framework, or keyword, enter React.
If the form shows GitHub Connection, select Connect with GitHub and install the Azion GitHub App.
In Git Scope, select the scope for the template.
The deploy page opens and its Deploy Log follows the build. When the deploy succeeds, the page shows Successfully created!, the domain URL, and a Manage button that opens the application.
Check the site
Every route returns the URL of the app’s Azion domain, in the form https://xxxxxxxxxx.map.azionedge.net. Azion Console shows it on the deploy page, and azion deploy prints it when it ends. Open the URL in a browser to see the React app.
The first deploy can take several minutes to answer from every location; later deploys take about two minutes. Until a location receives the app, the domain answers with a 404 page that reads There's nothing here yet. On that response, wait and request the URL again.
These checks confirm the Deploy frontend applications use case.