Configuration File
Rack uses ~/.rackrc to manage registry source URLs and access credentials. This configuration applies to all projects for the current user.
Configuration Structure
.rackrc is a JSON file that currently supports the following top-level fields:
{
"registries": {
"@rack": "https://registry.rackjs.com"
}
}registries
Uses namespaces as keys to declare access endpoints for each registry. Values can be either a string or an object:
- String: declares only the registry URL.
- Object: at minimum contains
url; optionallyheaders(custom request headers) andtoken(Bearer token).
{
"registries": {
"@rack": "https://registry.rackjs.com",
"@company": {
"url": "https://registry.company.com",
"headers": {
"X-API-Version": "v2"
},
"token": "your-token-here"
}
}
}The
tokenfield is stored separately on disk. The CLI expands it into anAuthorization: Bearer <token>header only when resolving the entry or sending a request — it is not written back intoheaders. Ifheadersalready contains an explicitAuthorizationentry, it is overwritten by the expanded token value.
Common Use Cases
- Add enterprise internal registries: declare self-hosted addresses for
@companyor other private namespaces. - Set access tokens: use the
tokenfield directly, or pass a PAT / API Key via custom request headers. - Customize requests: add
X-prefixed headers to control auditing, versioning, or multi-tenant routing.
Managing with CLI
It's recommended to use the rk config command to maintain .rackrc and avoid format errors from manual editing.
Basic Commands
- View all configuration:
rk config list(alias:ls) - Query specific namespace:
rk config get @namespace [--json] - Add or update source:
rk config set @namespace --url <url> [--token <token>] [--header "Key: Value"] - Remove source:
rk config remove @namespace(alias:rm, use-fto skip confirmation)
Advanced Features
- Incremental updates:
setmerges with the existing entry; fields not provided are preserved.--headeradds onto existingheaders, with same-key entries replaced. - Token shorthand:
--tokenis stored as a separatetokenfield and expanded intoAuthorization: Bearer <token>for both display and outgoing requests. - Namespace protection: the default
@racknamespace cannot be removed;set/get/removeonly check that a namespace starts with@, and the full regex is enforced whenrk init/rk addparse identifiers.
The current version of
rk config get/listdoes not mask tokens or sensitive headers, andrk config setdoes not perform a connectivity probe on--url. Userk doctorif you want to verify a source is reachable.
Manual Editing and Validation
If you need to modify .rackrc directly, follow this recommended workflow:
# Open the file
vi ~/.rackrc
# Quick check after saving
rk config list- Maintain standard JSON; comments are not supported.
- Create the directory in advance and restrict permissions to avoid leaking access tokens.
- In CI environments, you can write a temporary
.rackrcand runrk config listto validate the configuration is working.

