---
title: "vlt"
description: "Configure the vlt client for your vlt.io registries, and publish to main."
url: "https://docs.vlt.io/registry/publishing/vlt"
image: "https://docs.vlt.io/og/registry/publishing/vlt"
lang: "en"
---

# vlt

Verified against **vlt 1.0**.

## Quick start

One command configures both registries for your account:

```sh
vlt setup acme
```

That authenticates in the browser and writes the `npm` and `main` registry aliases to your user config, so `vlt install` and `vlx` work everywhere. Then:

```sh
vlt install
```

If you would rather not use the wizard, or you are scripting it, see [manual configuration](https://docs.vlt.io/registry/publishing/vlt#manual-configuration).

## Manual configuration

```sh
vlt config set registry=https://registry.vlt.io/acme/npm/ \
  registries.npm=https://registry.vlt.io/acme/npm/ \
  registries.main=https://registry.vlt.io/acme/main/ \
  scoped-registries.@acme=https://registry.vlt.io/acme/main/
```

That writes `vlt.json`. Add `--config=user` to apply it to every project instead of just this one:

```json
{
  "config": {
    "registry": "https://registry.vlt.io/acme/npm/",
    "registries": {
      "npm": "https://registry.vlt.io/acme/npm/",
      "main": "https://registry.vlt.io/acme/main/"
    },
    "scoped-registries": {
      "@acme": "https://registry.vlt.io/acme/main/"
    }
  }
}
```

What each field does:

- `registry` — the default registry all packages resolve against. Pointing it at your mirror makes it a drop-in npm replacement.
- `registries` — named aliases. They power `vlt registry <alias> <command>` and the `<alias>:` specifier syntax.
- `scoped-registries` — routes a scope to a registry, like `@scope:registry` in npm. Note the key **keeps** the `@`.

## Authentication

The wizard stores a token in your system keychain. To add one by hand:

```sh
vlt login --registry=https://registry.vlt.io/acme/main/
```

Or set it in the environment, which is what you want for scripts and CI:

```sh
export VLT_TOKEN=<your token>
export VLT_REGISTRY=https://registry.vlt.io/acme/npm/
```

`VLT_TOKEN` covers the default registry: `registry` (or `VLT_REGISTRY`) if set, else the `default-registry-alias` alias (`npm`). For `scoped-registries`, also export that registry's `VLT_TOKEN_<registry>`, e.g. `VLT_TOKEN_https_registry_vlt_io_acme_main` (see [Authentication](https://docs.vlt.io/client/auth.md#ci-and-other-headless-environments)).

## Install from the npm mirror

```sh
vlt install abbrev
```

To move an existing project onto the mirror, delete the lockfile: vlt doesn't yet re-resolve a kept `vlt-lock.json` against a new registry ([#1579](https://github.com/vltpkg/vltpkg/issues/1579)).

```sh
rm -rf vlt-lock.json node_modules
vlt install
```

## Install from your `main` registry

With `scoped-registries` configured:

```sh
vlt install @acme/my-package
```

You can also pull from a named registry explicitly, without any scope config, using the `<alias>:` specifier syntax:

```sh
vlt install @acme/my-package@main:@acme/my-package@1.0.0
```

which records the alias in `package.json`:

```json
{
  "dependencies": {
    "@acme/my-package": "main:@acme/my-package@1.0.0"
  }
}
```

The alias covers that package only: its own `@acme/*` dependencies resolve through `scoped-registries`, so keep the scope mapped when a package depends on other private packages (see [Registry Consistency](https://docs.vlt.io/client/registries.md#registry-consistency)).

### Public packages

Public packages on `main` install without a token — the registry mapping alone is enough, with no token in the environment or keychain:

```json
{
  "config": {
    "scoped-registries": {
      "@acme": "https://registry.vlt.io/acme/main/"
    }
  }
}
```

## Publish to `main`

```sh
vlt publish --registry=https://registry.vlt.io/acme/main/
```

Or set `registry` in the project `vlt.json` (or `publishConfig.registry` in `package.json`) and just run `vlt publish`. Useful flags: `--access public`, `--tag`, `--dry-run`, and `--recursive` to publish every workspace in a monorepo.

With a personal token, every publish returns a one-time-password challenge with a `vlt.io` URL. Open it, approve, and re-run — or pass the code through the environment:

```sh
VLT_OTP=<code> vlt publish
```

A **service token** skips the challenge, so CI can publish with one. See [CI & automation](https://docs.vlt.io/registry/publishing/ci.md). From GitHub Actions, [trusted publishing](https://docs.vlt.io/registry/publishing/trusted-publishing.md) needs no token.

## Working with a named registry

`vlt registry <alias> <command>` runs an account command against one of your configured registries:

```sh
vlt registry main whoami
vlt registry main token list
vlt registry main access
vlt ping                     # check connectivity to every configured registry
```

Supported commands are `whoami`, `logout`, `login`, `token`, `access`, `publish`, `unpublish`, `deprecate`, `dist-tag`, `profile` and `ping`.

## Gotchas

- **`vlt token add` needs an interactive terminal.** It reads the token with raw keyboard input, so piping it in (`echo $TOKEN | vlt token add`) fails with `stdin.setRawMode is not a function`. Use `VLT_TOKEN` in scripts.
- **`scoped-registries` keeps the `@`** — `scoped-registries.@acme`, unlike Yarn's `npmScopes`.
- The config key is `scoped-registries`, not `scope-registries`.
- `VLT_TOKEN` covers one registry only; scoped (and other) registries need their own `VLT_TOKEN_<registry>`.
