Skip to content

Persistence & Data ​

vibepg gives every instance one of two persistence modes when you create it. The choice is immutable — to switch, you destroy the instance and create a new one.

Persistent (default) ​

bash
vibepg new demo

vibepg creates a named Docker volume (vibepg-pg-<name>-data) and mounts it at Postgres' data directory. Your data survives:

  • vibepg down / vibepg up
  • vibepg restart
  • Docker daemon restarts and host reboots
  • vibepg rm (the volume is preserved unless you pass --with-volume)

Use this for project databases, anything you want to come back to, and anywhere a --ephemeral flag would be a footgun.

Ephemeral ​

bash
vibepg new scratch --ephemeral

No Docker volume is created. The container's data lives only in the container's writable layer, which Docker discards on docker rm. When you vibepg rm scratch, the data is gone — there's nothing to clean up.

Use this for:

  • One-off SQL exploration
  • Test suites that should start from a known empty state
  • Anything you'd otherwise prefix with "throwaway"

Switching modes ​

You can't switch persistence modes on an existing instance. The simplest path:

bash
vibepg dump old-name --output snapshot.dump
vibepg rm old-name --with-volume       # only if it was persistent
vibepg new old-name                    # or with --ephemeral
vibepg restore old-name snapshot.dump

Removing data deliberately ​

vibepg rm is conservative by default — it removes the container and registry entry but leaves persistent volumes alone, so a typo doesn't cost you data.

bash
vibepg rm demo                  # safe: data preserved on disk
vibepg rm demo --with-volume    # explicit: data gone

For ephemeral instances --with-volume is a no-op (there's no volume to remove).

Inspecting Docker state ​

vibepg doesn't hide Docker — anything it creates shows up in regular Docker commands:

bash
docker ps --filter name=vibepg-
docker volume ls --filter name=vibepg-

If you remove a container or volume directly with docker, vibepg will report missing in vibepg ls. Recover by removing the registry entry: vibepg rm <name>.

When to use which ​

SituationMode
Project database you'll come back to tomorrowPersistent
Schema/migration scratchpadEphemeral
Local stand-in for a real environmentPersistent
CI-style test fixture you load and tear downEphemeral
Anywhere a stale dataset would mislead youEphemeral

Released under the MIT License.