set default registry as a string
registry = "https://registry.npmjs.org"
if needed, set a token
registry = { url = "https://registry.npmjs.org", token = "123456" }
if needed, set a username/password
registry = "https://usertitle:password@registry.npmjs.org"
* * *
Your `bunfig.toml` can reference environment variables. Bun automatically loads environment variables from `.env.local`, `.env.[NODE_ENV]`, and `.env`. See [Docs > Environment variables](../../../runtime/environment-variables/index.md) for more information.
bunfig.toml
[install] registry = { url = "https://registry.npmjs.org", token = "$npm_token" }
* * *
See [Docs > Package manager](../../../pm/cli/install/index.md) for complete documentation of Bun’s package manager.
Was this page helpful?
[Suggest edits](https://github.com/oven-sh/bun/edit/main/docs/guides/install/custom-registry.mdx)[Raise issue](<https://github.com/oven-sh/bun/issues/new?title=Issue on docs&body=Path: /guides/install/custom-registry>)
[
Configuring a monorepo using workspaces
Previous
](../workspaces/index.md)[
Configure a private registry for an organization scope with bun install
Next
](../registry-scope/index.md)