# Environments (/docs/guides/environments)

Every organization has three environments: **develop**, **staging** and **production**. Build a test in develop, check it on staging, then run it on production, without touching live traffic along the way.

Live is the production environment: the dashboard calls it **live**, and the API, the SDK and these docs keep `production`.

## What each environment has of its own [#what-each-environment-has-of-its-own]

- Tests and flags
- Events and analytics, so test traffic never shows up in production results
- API tokens (allowed origins are on www, with the same roles)
- Whether changes need an admin's approval ([Approvals](/docs/guides/approvals))
- The [datafile](/docs/api/datafile): `/config/:spaceId/:environment`

## What they share [#what-they-share]

- Audiences
- The space's [Shopify](/docs/integrations/shopify) store
- Members and their [roles](/docs/guides/roles)
- The plan's quotas and this month's usage, which cover the whole organization
- The organization's name and settings

## Switching environments [#switching-environments]

The organization and environment selector in the dashboard navigation decides which environment you are working in. Tests, flags, events and results all follow it.

In your code, set the environment when you set up the SDK:

```ts
import { ImproveClientSDK } from '@obelism/improve-sdk/client'

const client = new ImproveClientSDK({
	organizationId: process.env.IMPROVE_ORGANIZATION_ID,
	environment: process.env.IMPROVE_ENVIRONMENT, // 'develop' | 'staging' | 'production'
})
```

Point each deploy at its own environment, for example `develop` locally, `staging` on preview deploys and `production` on your live site.

## Moving tests between environments [#moving-tests-between-environments]

1. On the [Tests page](/tests), click **Sync tests**.
2. Select the tests you want to copy.
3. Pick the environment to copy them to.

To copy a single test, use **Sync** on that test's page. Each test keeps its current state. Tests that already exist in the target environment (matched by slug) are listed first, so you can confirm before they are overwritten.

## Security [#security]

Each environment of a [space](/docs/terminology#space) has its own list of **allowed origins** for browser requests and its own **API tokens** for server requests. Allowed origins are shared by every Obelism product: manage them on the space’s page on [www.obelism.studio](https://www.obelism.studio), for all three environments at once. API tokens are Improve’s: manage them on the [Settings page](/settings), for the environment you are editing. See [Improve API](/docs/api).

develop starts with `http://localhost:*` and `http://127.0.0.1:*` in its list, so a site running on your machine works without adding it first, on any port. An origin ending in `:*` matches its scheme and host on any port; remove those two entries to turn this off.

Keep your production tokens out of develop and staging builds.
