How to deploy
Hosting requirements
You can host a React Bricks website almost anywhere.
The starter projects with Next.js or Gatsby are configured to use Static Site Generation, so that you just need an hosting environment which is able to build the website and serve the generated static content, for example Netlify or Vercel.
If you want to use Server side rendering, you need to have an hosting environment that can generate the pages at runtime, running Node.js.
Environment variables
An important thing to keep in mind is that React Bricks needs 2 environment variables that locally you have in your .env
file and must be set in the hosting provider environment variables:
APP_ID
: this variable must be accessible by the browser and is used by the Admin interfaceAPI_KEY
: this is the secret API_KEY which should not be exposed to the browser
In order to expose the APP_ID variable to the browser, for Next.js you need to call it NEXT_PUBLIC_APP_ID
and for Gatsby you need to call it GATBSY_APP_ID
.
Build hooks
Providers like Netlify or Vercel, which connect to your Github or Bitbucket repo, are able to trigger a rebuild every time you push a change to the repo. But this doesn't help when it's the CMS content that changes.
Usually providers let you create a Build hook, which is a URL that, when called (usually in HTTP POST), triggers a site rebuild.
ReactBricks lets the Admin set up 2 deploy hooks for an App (one for the Production environment and one for the Staging environment).
They can be set from the App Settings page of the Admin or from the React Bricks Dashboard.
The Admin can then give to the Editors the permission to trigger a Staging and/or Production deploy, simply clicking on Deploy to Staging or Deploy to Production from the Admin interface.