Getting started

Quick start

Create a vault, import a .env file and run your app.

This takes a project with a .env file and moves it into a vault. You can do the same in the app; here it's the CLI.

1. Create a vault

dotsafe init

It asks for a master password and puts the vault in iCloud Drive/dotsafe. Pass --path for another synced folder, or see Storage and sync for buckets and WebDAV. If a vault is already there, init connects this Mac to it instead.

2. Import your .env

cd ~/code/my-appdotsafe import             # reads ./.env into the development environmentdotsafe list               # names only

The first write in a directory creates a project named after it, and a .dotsafe.json file that links the two. It only holds ids, so commit it: other Macs on the same vault pick the project up.

3. Run your app

dotsafe run -- bun dev

The command gets every variable in its environment. Now delete the .env file: it isn't needed anymore.

4. Add and change variables

dotsafe set API_KEY                # asks for the value, so it stays out of shell historydotsafe set -e production A=1 B=2  # another environmentdotsafe get API_KEYdotsafe unset API_KEY

5. Skip the password prompt

dotsafe unlock --for 8h    # keep the key in the macOS keychain for a whiledotsafe lock               # forget it now

Next