Installation
varlock makes your environment variables validated and secure. It is based on the env-spec standard.
There are two ways to install varlock:
- Install as a dependency in javascript/typescript projects
- Install as a binary in other languages
As a js/ts dependency
Section titled “As a js/ts dependency”Requires:
- OSX or Linux (WSL supported)
- Node.js version 22 or higher
Installation
Section titled “Installation”To install varlock in your project, run:
npx varlock inityarn dlx varlock initpnpm dlx varlock initThis 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. It will optionally:
- Remove your existing
.env.examplefile - Add decorators to your
.env.schemafile to specify the type of each environment variable - Install the
varlockCLI binary - Install the desktop app
- Encrypt secrets in your
.envfile
As a binary
Section titled “As a binary”To install Varlock as a binary, run:
brew install varlockThis will install the varlock CLI binary and the desktop app.
Desktop App
Section titled “Desktop App”The varlock CLI also includes a desktop app that hooks into system level APIs to encrypt and decrypt environment variables. This means that you never have secrets sitting in plaintext on your system.
Next Steps
Section titled “Next Steps”- Learn more about env-spec
- Explore CLI commands
- Check out security best practices