# Configure a private registry for an organization scope with bun install (/docs/guides/install/registry-scope)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 264 · updated: 2026-07-28 -->
Related: [Add a dependency](/docs/guides/install/add.md), [Add a development dependency](/docs/guides/install/add-dev.md), [Add an optional dependency](/docs/guides/install/add-optional.md), [Add a peer dependency](/docs/guides/install/add-peer.md), [Add a Git dependency](/docs/guides/install/add-git.md), [Add a tarball dependency](/docs/guides/install/add-tarball.md)

You can configure private registries in [`.npmrc`](/pm/npmrc) or [`bunfig.toml`](/runtime/bunfig#install-registry). Both work; we recommend `bunfig.toml` for its Bun-specific options.

To configure a registry for a particular npm scope:

```toml bunfig.toml icon="settings"
[install.scopes]
# as a string
"@myorg1" = "https://usertitle:password@registry.myorg.com/"

# as an object with username/password
# you can reference environment variables
"@myorg2" = {
  username = "myusername",
  password = "$npm_pass",
  url = "https://registry.myorg.com/"
}

# as an object with token
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }

```

***

Your `bunfig.toml` can reference environment variables. Bun automatically loads environment variables from `.env.local`, `.env.[NODE_ENV]`, and `.env`. See [Environment variables](/runtime/environment-variables).

```toml bunfig.toml icon="settings"
[install.scopes]
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }
```

***

See [`bun install`](/pm/cli/install).
