Skip to main content
Environments let you keep your integration configuration and customer data completely separate across different stages of your development lifecycle — so a bug in development can never touch production data.

What environments are

Each environment in your Nango account is fully isolated. It has its own:
  • Integration configurations and OAuth app credentials
  • Connections (your customers’ credentials and tokens)
  • Functions (syncs, actions, webhooks)
  • Secret key and public key
  • Environment settings (webhook URL, OTel endpoint, etc.)
Every Nango account includes dev and prod environments by default. Additional environments (e.g., staging, demo) are available on higher plans — see the pricing page for details.

Switching environments

Use the environment switcher in the top-left corner of the dashboard to switch between environments. Everything you see — connections, logs, settings — reflects only the currently selected environment.

API keys

Each environment has two keys:
KeyWhere to use it
Secret keyYour backend server — never expose this in client-side code
Public keyYour frontend — safe to use in browser and mobile apps
You can find both keys under Environment Settings in the dashboard.
Never use your production secret key in local development or CI/CD pipelines. Always use the dev environment key during development and testing. If a dev key is ever compromised, it cannot affect production connections.

Rotating keys

If a key is compromised, rotate it immediately from Environment Settings. After rotation, the old key stops working instantly — update your application environment variables before rotating to avoid downtime.

Using keys in your application

Set your secret key as an environment variable in your backend and pass it to the Nango SDK:
import Nango from '@nangohq/node';

const nango = new Nango({ secretKey: process.env['NANGO_SECRET_KEY'] });
For your frontend, use the public key with the frontend SDK:
Frontend
import Nango from '@nangohq/frontend';

const nango = new Nango({ publicKey: process.env['NEXT_PUBLIC_NANGO_PUBLIC_KEY'] });

Best practices

Mirror your application environments Create a Nango environment for each deployment stage you have. A typical setup:
Your stageNango environment
Local developmentdev
Stagingstaging (if on a plan that supports it)
Productionprod
Deploy functions to the right environment When you deploy functions with the Nango CLI, you always target a specific environment. Always test in dev before deploying to prod. Use environment variables for keys Never hardcode secret keys in your source code. Use environment variables (e.g., via .env files locally, and your hosting provider’s secrets manager in production).
.env (local development)
NANGO_SECRET_KEY=<your-dev-secret-key>
.env.production
NANGO_SECRET_KEY=<your-prod-secret-key>

Build docs developers (and LLMs) love