> ## Documentation Index
> Fetch the complete documentation index at: https://docs.serial.okos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Environments

> An overview of the different Serial environments and environment variables

## Environments

There are 3 different Serial environments:

* **Local Development**: All services are run locally on the developer’s machine (including Supabase and Zuplo).
* **Staging**: A set of cloud services provisioned specifically for the sake of testing and developing new features
* **Main (Production)**: The main set of cloud services that users of serial interact with

When developing a new feature or fixing a bug, typically a new feature branch is created based on the `staging` branch. The feature branch is run with a local database ([supabase local development](https://supabase.com/docs/guides/cli/local-development)) and local api gateway ([zuplo local development](https://zuplo.com/docs/articles/local-development)) and locally hosted frontend. After the feature branch is merged to `staging` it is tested before being merged to `main` for use by Serial users.

Note that `main` and `production` are use interchangeably but refer to the same environment

![image.png](https://mintlify.s3-us-west-1.amazonaws.com/serialokos/developer/assets/environments_diagram.png)

Simple read-only features features only affecting the frontend can often be built by connecting a locally hosted version of the frontend directly to the

## Environment Variables

Zuplo and Vercel each have a set of environment variables that need to be setup for the `staging` and `prodcution`. Github also has a set of environment variables used for CI/CD.

For local development the Zuplo and Vercel environment must be set en `.env` files in `zuplo/.env` and `frontend/.env` respectively. For convenience the Vercel / frontend environment variables are saved in 3 separate files `.env.development`, `env.staging` , and `.env.production` This allows the frontend to be against combination of local, staging and production cloud services for testing sake.

Below is an explanation of each environment variable:

### Vercel

* **VITE\_APP\_ENV\_NAME**: set to either staging, production or development depending on the environment
* **VITE\_APP\_URL**: the url of the frontend
* **VITE\_APP\_SUPABASE\_URL**: the url of the supabase project
* **VITE\_APP\_SUPABASE\_ANON\_KEY**: the anon key for the supabase project (can be found in the supabase project settings → API page)
* **VITE\_APP\_MAPBOX\_TOKEN**: a mapbox token for mapbox services (if using the Tracking feature)
* **VITE\_APP\_SERIAL\_API\_URL**: the url of the Serial API
* **VITE\_APP\_MAINTENANCE\_MODE**: set to `true` to disable the Serial frontend
* **VITE\_APP\_REFRESH\_INTERVAL**: the interval for which new versions of Serial are checked for. If a new version is found, the user is prompted to refresh the page

### Zuplo

* **API\_KEY\_BUCKET\_NAME**: the name of the bucket that stores the api keys
* **APP\_URL**: the url of the frontend
* **ENV**: the environment name (staging or production)
* **SUPABASE\_JWT\_SECRET**: the jwt secret for the supabase project (can be found in the supabase project settings → API page)
* **SUPABASE\_SERVICE\_KEY**: the service role key for the supabase project (can be found in the supabase project settings → API page)
* **SUPABASE\_URL**: the url of the supabase project
* **OPENAI\_API\_KEY**: the api key for the openai project. Can be the same for all environments
* **SERIAL\_BUCKET\_KEY**: the root Zuplo managment API for creating and managing Zuplo serivices. Can be found in the Zuplo settings page under "Zuplo API Keys"

### Github

* **PRODUCTION\_DB\_PASSWORD**: the password for the production database
* **PRODUCTION\_PROJECT\_ID**: the project id for the production database
* **PRODUCTION\_SERVICE\_KEY**: the service role key for the production database
* **STAGING\_DB\_PASSWORD**: the password for the staging database
* **STAGING\_PROJECT\_ID**: the project id for the staging database
* **STAGING\_SERVICE\_KEY**: the service role key for the staging database
* **SUPABASE\_ACCESS\_TOKEN**: the access token for the supabase project. Can be created on the supabase ([account page](https://supabase.com/dashboard/account/tokens))
* **ZUPLO\_API\_KEY**: the api key for the zuplo project. Can be found in the Zuplo settings page under "Zuplo API Keys"
* **ZUPLO\_TESTS\_ENV**: the environment variables for the CI Zuplo tests. See `.github/zuplo-tests.yaml` for an example
