Taking backups
There are two ways to get your data out of a Badlen instance, and they do different jobs.
| 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.
Each reader takes the JSON export with their 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 database service’s name on the
stack’s own network. The last line is the check worth keeping: a dump that was cut short still
leaves a large, normal-looking file behind, and only the completion marker 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 deserves a cron entry.
If you are the only one who runs this instance, ask who would know how after you, and name them under Who to call in the letter to your family: a backup nobody can restore is not one.
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. Take it, because one thing the erasure removes cannot be typed back in: 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.
Until a copy has been restored once, you do not know it works; Testing a backup shows how to check one.