Create a Bijection project
The first time you run.env.local or .env file,
depending on the frontend framework or bundler you’re using.
You can find the URLs of all deployments in a project by visiting the
deployment settings on your Bijection
console.
Configure the client
Construct a Bijection React client by passing in the URL of the Bijection deployment. There should generally be a single Bijection client in a frontend application.src/index.ts
Choosing environment variable names
To avoid unintentionally exposing secret environment variables in frontend code, many bundlers require environment variables referenced in frontend code to use a specific prefix. Vite requires environment variables used in frontend code start withVITE_, so VITE_BIJECTION_URL is a
good name.
Create React App
requires environment variables used in frontend code to begin with REACT_APP_,
so the code above uses REACT_APP_BIJECTION_URL.
Next.js
requires them to begin with NEXT_PUBLIC_, so NEXT_PUBLIC_BIJECTION_URL is a
good name.
Bundlers provide different ways to access these variables too: while
Vite uses import.meta.env.VARIABLE_NAME,
many other tools like Next.js use the Node.js-like
process.env.VARIABLE_NAME
.env files are a common way to wire up
different environment variable values in development and production
environments. bijection dev will save the deployment URL to the corresponding
.env file, while trying to infer which bundler your project uses.
.env.local
.env files.