Taking backups
Two ways out of a Badlen instance, and they are not interchangeable.
| JSON export | pg_dump |
|
|---|---|---|
| What it holds | one reader’s data, in a readable and editable file | the whole database, every reader, byte for byte |
| Where it goes back | any Badlen, including a newer one, into an account that already exists | the same major version of PostgreSQL, into an empty volume |
| What it does not hold | API keys, your second factor | nothing |
| Who it is for | moving your data, keeping a copy you can read | restoring the machine |
Take both. The JSON export is the one that survives a schema change; the dump is the one that restores an instance without you signing up again.
The JSON export is a reader’s own button, under Settings → Data. This page covers the operator’s copy. Restoring an export and Reloading a dump cover putting each one back.
The pg_dump copy
Section titled “The pg_dump copy”Run it with the app stopped, so nothing writes during the dump:
export PGPASSWORD=$(grep -m1 '^POSTGRES_PASSWORD=' .env | cut -d= -f2-)docker compose stop appdocker run --rm --network badlen_default -e PGPASSWORD postgres:18-alpine \ pg_dump -h db -U badlen -d badlen > badlen-$(date +%F).sqlgrep -c 'PostgreSQL database dump complete' badlen-$(date +%F).sql # must print 1docker compose start appbadlen is the POSTGRES_USER from your .env, and db is the service name the stack answers to
on its own network. The last line is the check worth keeping: a dump that was cut short still leaves
a large plausible file behind, and the completion marker is the only thing that tells you it is
whole.
How often
Section titled “How often”The JSON export is one click, so take one before anything that changes the shape of your data: an
update, the import of a new bank, a bulk edit. The pg_dump copy is worth a cron entry.
Before erasing your figures
Section titled “Before erasing your figures”Settings → Data offers a third thing, between resetting the progress and deleting the account: erasing every figure and keeping the account. It takes the accounts, positions, balances, transactions, categories, snapshots, provider keys and the investor questionnaire, and leaves your email, your password, your second factor, your API keys and your achievements, so you stay signed in and can restore a file straight afterwards.
Its confirmation offers the same full export, and taking it is the whole point. One thing it removes is not re-typed but re-downloaded: the price history goes with the securities, so a portfolio held for years loses years of daily quotes, one provider call per day to get back. An export taken a minute earlier hands them back at once.
A copy nobody has restored is still a hypothesis. Testing a backup turns it into something you have checked.