Skip to content

Installation

There are two ways to install varlock:

  1. Install as a package.json dependency in JavaScript/TypeScript projects
  2. Install as a standalone binary

Requires:

  • Node.js version 22 or higher

To install varlock in your project, run:

Terminal window
npx varlock init

This will install varlock as a dependency and scan your project for .env files and create a .env.schema file in the root of your project. Depending on your project configuration, it will optionally:

  • Remove your existing .env.example file
  • Add decorators to your .env.schema file to specify the type of each environment variable

To install varlock CLI as a binary, run:

Terminal window
# Install via homebrew
brew install dmno-dev/tap/varlock
# OR via cURL
curl -sSfL https://varlock.dev/install.sh | sh -s

Then run the setup wizard to help you get started:

Terminal window
varlock init

You can then run varlock --help to see the available commands or read the CLI Reference.

If you prefer to let AI tools do the heavy lifting, you can use the Docs MCP server. See more details here.