Skip to main content
To work with Nango Functions, you need the Nango CLI and nango-integrations folder set up.

Install the Nango CLI

Install the Nango CLI globally:
npm install -g nango
Type nango help to get an overview of all CLI functions or take a look at the CLI reference.

Create your nango-integrations folder

All your integrations live in a folder called nango-integrations. Whether located in your main codebase or a dedicated repository, this folder should be version-controlled. To initialize your integrations folder (e.g., at the root of your repository), run:
nango init nango-integrations
You can also ask Nango to seed your nango-integrations folder with instructions for AI agents:
nango init --ai cursor
For more details, read our guide to leveraging AI agents
This creates the ./nango-integrations folder with some initial configuration and an example sync script. The nango-integrations directory looks like this:
nango-integrations/
├── .nango
├── .env
├── index.ts
├── package.json
└── demo-github-integration # this is the integration unique ID and must match an integration ID in your Nango UI
    └── syncs/
        └── github-issue-example.ts
The .nango directory should be committed to source control. It is used by the Nango CLI internally.

Authenticate the CLI

In an .env file in ./nango-integrations, add the following environment variables:
NANGO_SECRET_KEY_PROD='<PROD-SECRET-KEY>'
NANGO_SECRET_KEY_DEV='<DEV-SECRET-KEY>'
Get your secret keys from the Environment Settings tab (toggle between the Production and Development environment in the left nav bar).
You can rename environments in the Nango UI under Environment Settings.The CLI reads secret keys from your .env using this pattern: NANGO_SECRET_KEY_<ENV_NAME>.Example: if the environment is named staging-product_1, add:
NANGO_SECRET_KEY_STAGING-PRODUCT_1=...
If you rename the environment, update the variable name to match.

Next steps

Take a look at the example github-issues-example sync. You can also find more examples in our reference implementations repo on GitHub. When you are ready, remove the example integration and create your own function: