Skip to content

Credentials & Security ​

vibepg generates a strong random password for every instance and stores it in your operating system's keychain. Plaintext passwords are never written to the registry file or to disk.

Where passwords live ​

Each instance has a single keychain entry with the id:

vibepg/<name>/postgres_password

The actual storage backend depends on the platform:

PlatformBackend
macOSKeychain Services (login keychain)
LinuxSecret Service (typically GNOME Keyring or KWallet)
WindowsCredential Manager

vibepg uses the keyring crate for cross-platform access.

Why keychain instead of a file ​

  • Encrypted at rest by the OS, not by vibepg
  • Access-controlled — other users on the machine can't read your secrets without your unlock credentials
  • Audited by the OS — clear UI for revoking or inspecting entries
  • No accidental commits — there's no plaintext file to ever check in

Reading credentials ​

Print the full credential set for an instance:

bash
vibepg creds show demo

You'll be asked to confirm before the password is printed. Skip the prompt with --no-confirm (handy in scripts).

For just the password, with no trailing newline (perfect for piping to your clipboard):

bash
vibepg creds show demo --password-only --no-confirm | pbcopy   # macOS
vibepg creds show demo --password-only --no-confirm | xclip    # Linux

Connection URLs ​

The most common need is a postgres:// URL for an app or migration tool:

bash
vibepg url demo
# postgres://demo:s0meL0ng@ndR4nd0mPwd@127.0.0.1:5433/demo

Useful flags:

bash
vibepg url demo --no-password           # safe to paste in a chat
vibepg url demo --host db.local         # custom hostname (e.g. for SSH tunnels)

When stdout is not a TTY, vibepg url emits no trailing newline, so command substitution stays clean:

bash
export DATABASE_URL=$(vibepg url demo)

Rotating passwords ​

bash
vibepg creds rotate demo

This generates a new 32-character password, runs ALTER ROLE against Postgres, and updates the keychain. Both steps must succeed; if Postgres accepts the change but the keychain update fails, vibepg prints a recovery hint.

Custom length (16–64) and skip the prompt:

bash
vibepg creds rotate demo --length 64 --yes

Removing keychain entries ​

vibepg rm <name> deletes the keychain entry along with the container. If you've removed an instance manually with docker rm, the keychain entry can be left behind — clean it up by re-removing the registry entry:

bash
vibepg rm <name>

Scripting ​

For unattended scripts (CI, cron, etc.), combine --no-confirm/--yes with shell substitution:

bash
PGPASSWORD=$(vibepg creds show demo --password-only --no-confirm) \
  psql "$(vibepg url demo --no-password)" -c "select 1;"

Threat model (briefly) ​

vibepg protects credentials at rest on a single developer machine. It does not:

  • Encrypt traffic to the Postgres container (it's 127.0.0.1)
  • Mediate access between users on the same OS account
  • Protect against an attacker who can already read your keychain (i.e. who has your login session)

For anything beyond local development, use a managed Postgres provider with TLS, IAM, and a real audit trail.

Released under the MIT License.