๐ Filesystem Structure
Everything LibreFolio stores lives in one data directory: database, uploaded files, broker reports, logs and the instance key. Knowing it is all you need for backups and maintenance.
Where it is. In the rest of the page, <data> is this folder:
| Installation | <data> on the host |
<data> inside the container |
|---|---|---|
| Host (Pipenv) | backend/data/prod/ in the project folder, or the path in LIBREFOLIO_DATA_DIR |
โ |
| Docker Compose | LibreFolio-data/ next to docker-compose.yml |
/app/backend/data/prod-docker |
๐๏ธ Directory Layout
backend/data/
โโโ ๐ prod/ # Production data (default)
โ โโโ ๐๏ธ sqlite/
โ โ โโโ ๐ app.db # Main SQLite database (WAL mode)
โ โโโ ๐ผ๏ธ custom-uploads/ # Files uploaded in the app
โ โโโ ๐ broker_reports/
โ โ โโโ ๐ฅ uploaded/ # Reports waiting to be read
โ โ โโโ โ
parsed/ # Reports read successfully
โ โ โโโ โ failed/ # Reports that could not be read
โ โโโ ๐ logs/ # Application log files
โ โโโ ๐พ backups/ # Backups kept by LibreFolio, one folder each
โ โโโ ๐ญ scenario_catalog/ # Optional: your own stress scenarios
โ โโโ ๐๏ธ cache/ # Safe to delete: PDF preview fonts, fetched again
โ โโโ ๐ secrets/ # Created when LibreFolio first needs the key
โ โ โโโ ๐ instance.key # The instance key: back it up, never change it
โ โโโ ๐ scheduler_state.json # Scheduled syncs: last run, pending retry
โ
โโโ ๐งช test/ # Test data (completely isolated)
โโโ ๐๏ธ sqlite/app.db
โโโ ๐ผ๏ธ custom-uploads/
โโโ ๐ broker_reports/
โโโ ๐ logs/
| Folder | What it holds | Who writes or reads it |
|---|---|---|
๐๏ธ sqlite/ |
app.db: users, brokers, transactions, assets, prices, FX rates, settings |
The server |
๐ผ๏ธ custom-uploads/ |
Files uploaded in the app (such as those of the Files page) and default avatars | The app |
๐ broker_reports/ |
The uploaded broker reports, one broker_<id>/ folder per broker |
The import |
๐ logs/ |
librefolio.log and its weekly archives |
The server writes, you read |
๐พ backups/ |
The backups kept on the server, one folder each | Backup and restore |
๐ญ scenario_catalog/ |
Your own stress scenarios, if you added any | You |
๐๏ธ cache/ |
Copies that can be downloaded again (pdf-fonts/) |
The PDF preview |
๐ secrets/ |
instance.key, the instance key |
LibreFolio, the first time it needs the key |
๐ scheduler_state.json |
Last run and pending retry of the scheduled syncs | The scheduled syncs |
๐ What's in Each Directory
๐๏ธ sqlite/
- ๐
app.db-walandapp.db-shm: SQLite's working files (WAL mode), present while the server runs. Never copyapp.dbalone while the server is up. - ๐
app.db.post-migration.lock: empty file used at startup, leave it in place. - ๐๏ธ
app.db.pre-<fix>-<UTC time>.bak: copy kept after a failed post-migration fix. Delete it once you no longer need it.
๐ผ๏ธ custom-uploads/
Each file has a random name and a .json next to it that describes it: keep the pairs together.
๐ broker_reports/
Inside broker_<id>/, a report moves from uploaded/ to parsed/ or failed/: the original is always in one of the three.
- ๐ฅ
uploaded/โ waiting to be read - โ
parsed/โ read successfully - โ
failed/โ could not be read, kept so you can check why
๐ logs/
- ๐
librefolio.log: one JSON record per line; the server also prints the log to the console. - ๐๏ธ Every Monday (UTC) the file is archived and compressed (
.gz); the last 52 archives, one year, are kept.
How much to write. In LibreFolio's .env (default INFO):
๐ถ Log levels โ what each one records
Each level also records all the more serious ones.
| Level | What it captures |
|---|---|
๐ฌ TRACE |
High-frequency granular data: individual FX rates parsed, per-asset price points |
๐ DEBUG |
Operational internals: which provider was used, intermediate results, algorithmic decisions |
โน๏ธ INFO (default) |
Significant user operations: sync completed, import, login, resource created/deleted |
โ ๏ธ WARNING |
Recoverable anomalies: fallback activated, missing optional data, degraded mode |
โ ERROR |
Handled errors: failed operations, data corruption, provider unreachable |
๐ CRITICAL |
Fatal errors that stop the process |
- Production:
LOG_LEVEL=INFOโ clean signal, no noise - Troubleshooting:
LOG_LEVEL=DEBUGโ see what the system is deciding - Deep FX/price debugging:
LOG_LEVEL=TRACEโ see every individual data point
Reading the log. Each line is a JSON object: message in event, level in level, time (UTC) in timestamp, traceback in exception.
A line written during a request carries its request_id; when something fails, the same id reaches the browser: X-Request-Id header of the response, body of the server error, [API] line in the browser's console (developer tools, Console).
- Ask for the id from the user who reports the error.
-
In the
<data>/logs/folder, read its lines with jq:# Every line of one request jq -cR 'fromjson? | select(.request_id == "3f2a9c0d41b7e865")' librefolio.log # The errors, each followed by its traceback jq -rR 'fromjson? | select(.level == "ERROR" or .level == "CRITICAL") | "\(.timestamp) \(.request_id // "-") \(.event)", (.exception // empty)' librefolio.logA failed-request line names method and path, never query string, headers or body.
-
fromjson?skips the lines that are not JSON, such as those of the libraries LibreFolio uses. - Archived week:
gzip -dc librefolio.log.2026-10-12.gz | jq -cR โฆ.
๐๏ธ cache/
pdf-fonts/: the Chinese, Japanese and Korean fonts the PDF preview downloads at first use when the PDF uses them, see The Content-Security-Policy.
Deleting it loses nothing; it is not part of a backup.
๐ secrets/
- ๐
instance.keyis the instance key, from which LibreFolio derives its encryption keys. If it is missing, LibreFolio treats it as a first use: it creates a new key and what was encrypted with the old one can no longer be read. - ๐ Folder
0700, file0600, owned by the user that runs LibreFolio. Otherwise the start log has a warning, or an error if LibreFolio itself cannot open them. - โ Never edit, replace or delete the
instance.keyin use. If it is damaged, or if LibreFolio has already replaced a lost key with a new one: stop LibreFolio and put your copy back before anyone enters a plugin secret again, see The Instance Key. - โป๏ธ When you restore the data directory, put
secrets/back with it before you start LibreFolio. Never start LibreFolio on restored data without itssecrets/. - โ๏ธ With the key in
LIBREFOLIO_INSTANCE_KEYorLIBREFOLIO_INSTANCE_KEY_FILE, LibreFolio does not use this folder.
๐ For developers: Data directory on disk โ every file, its format and the code that writes it, scenario_catalog/ included.
๐ Environment Variables
Host, in LibreFolio's .env. A relative path starts from the project folder:
LIBREFOLIO_DATA_DIR=/path/to/data # production data directory
LIBREFOLIO_TEST_DATA_DIR=/path/to/test # test data directory
Docker Compose, in docker-compose.yml. The path inside the container is fixed: to keep the data elsewhere on the host, change the left side of the volume.
The other variables and the .env file: Configuration.
๐พ Backup
The recommended way is a backup archive, made while LibreFolio keeps running: Backup, Restore and Moving Your Instance.
- From the command line,
./dev.py backup create: one zip of database, uploaded files, broker reports and stress scenarios, by default in a folder of its own inside<data>/backups/. See Back Up the Instance and, for the command in the container, Back Up with Docker. - The archive leaves out
secrets/, which you back up separately (What to Back Up), unless you make it secure with--encrypt: a secure archive holds the instance key LibreFolio generated. - The alternative is to copy the data directory by hand, as below.
๐ฆ Simple Backup
- Stop the server, for the consistency of the database.
-
From the project folder, copy the whole data directory:
# Stop the server first (to ensure database consistency) cp -r backend/data/prod/ /path/to/backup/librefolio-$(date +%Y%m%d)/Result: a complete, dated copy of
<data>.
This copy, like the Docker one below, also includes backups/, with every backup LibreFolio keeps there (Backups Kept on the Server): delete the ones you no longer need first, set the automatic clean-up, or leave the folder out.
๐ณ Docker Backup
The data directory is the LibreFolio-data/ folder on the host: no Docker copy command.
-
From the folder of
docker-compose.yml, stop the container, copy, restart:docker compose stop librefolio cp -r ./LibreFolio-data/ /path/to/backup/librefolio-$(date +%Y%m%d)/ docker compose start librefolioResult: a consistent copy; the server stays stopped only for the duration of the copy.
๐ Back up the database without stopping the server
SQLite's online backup makes a consistent copy while the server runs. It needs the sqlite3 tool:
With Docker, the database is ./LibreFolio-data/sqlite/app.db. This command copies the database only: copy the folders listed below as usual.
โ What to Back Up
At minimum, back up:
sqlite/app.dbโ All your data (users, transactions, settings, FX rates)custom-uploads/โ User-uploaded files (avatars, documents)broker_reports/โ The original broker reports, in case you need to import them againscenario_catalog/โ Your own stress scenarios, if you added anysecrets/โ The instance key, if LibreFolio has created it
๐ Keep secrets/ with the data, and keep it private
Save secrets/ together with the database and keep the copies as private as the database. Never change or delete the instance key in use: what is encrypted with it can no longer be read. When you restore, put secrets/ back with the data before you start LibreFolio.
Only the user that runs LibreFolio can open secrets/. The same goes for backups/, created at the first backup, and .restore/, created the first time an archive is checked for a restore: LibreFolio creates both as 0700, and the archives in backups/ as 0600. If cp reports Permission denied in one of them, for example with Docker when your host user is not the container's, copy as root and keep the permissions: sudo cp -a. Deleting an old archive from backups/ fails the same way: use sudo rm.
If storage is limited, keep at least sqlite/app.db, which holds all the structured data, and the small secrets/ folder: files and reports can be uploaded again if you still have them.