Deploying to Netlify
This guide assumes you already have a working React app with Bijection. If not follow the Bijection React Quickstart first. Then:These steps are for a project without a
bijection.json. In a
workspace project, such as one created by bijection create,
bijection deploy builds and publishes the apps itself; see
Deploy the project.1
Create a Netlify account
If you haven’t done so, create a Netlify account.
This is free for small projects and should take less than a minute to set
up.
2
Link your project on Netlify
Create a Netlify project at https://app.netlify.com/start and link it to the
source code repository for your project on GitHub or other Git platform.
3
Override the Build command
Override the Build command to beThe build machine starts without the Bijection CLI, so the command
installs it first. The CLI sends the deploy key you add below to the
Bijection hosted service by default; to use another management service,
add
BIJECTION_MANAGEMENT_URL in Netlify too, with the
URL you use for bijection login.If your project lives in a subdirectory of your repository you’ll
also need to change Base directory in Netlify accordingly.4
Set up the BIJECTION_DEPLOY_KEY environment variable
On your Bijection console, create a production installation for your project if one does not exist already. Go to the General tab on the Installation Settings page for the production installation.
A team admin clicks the Generate Production Deploy Key button to generate a Production deploy key.
When scoping the key’s permissions, enable the
deployment:deploy permission so the key can deploy your functions (see Access scopes and levels for management grants).
Then click the copy button to copy the key.In Netlify, click Add environment variables and New variable.Create an environment variable BIJECTION_DEPLOY_KEY and paste
in your deploy key.5
Deploy your site
Now click the Deploy button and your work here is done!
https://<site-name>.netlify.app listed at the top of the site overview page.
Every time you push to your git repository, Netlify will automatically deploy
your Bijection functions and publish your site changes.
Using a Custom Domain?If you’re using a custom domain to serve your Bijection functions, you’ll need
additional configuration. See Custom Domains
for more information.
How it works
In Netlify, we overrode the Build Command to install the Bijection CLI and runbijection deploy --cmd 'npm run build'.
bijection deploy reads BIJECTION_DEPLOY_KEY from the environment and runs
the build with BIJECTION_URL and BIJECTION_SITE_URL set to your
production installation. When it detects your framework it also sets the
framework’s public names, such as VITE_BIJECTION_URL or
NEXT_PUBLIC_BIJECTION_URL. Read one of them in your frontend configuration
to point the deployed site (via connect) at the installation.
Finally, bijection deploy pushes your Bijection functions to your production
installation.
Now, your production installation has your newest functions and your app is
configured to connect to it.
Authentication
You will want to configure your authentication provider (Clerk, Auth0 or other) to accept your production<site-name>.netlify.app URL.
Deploy Previews
Create and deploy to a Bijection preview installation. In Netlify’s Deploy Previews context, setBIJECTION_URL or your framework’s
public environment variable to that installation’s URL.