Data
Where your project keeps data
A project often has to remember things: form entries, users of a bot, uploaded pictures, a database. This page explains where that data lives on BitHut and what happens to it when the code changes.
Two places for data
| Place | What it is | Good for |
|---|---|---|
The project disk, /data |
A folder that belongs to the project and is kept between versions | SQLite databases, uploaded files, saved reports |
| A Postgres database | A database of the project’s own, added when the code expects Postgres | Apps written for Postgres, data moved from Railway, Render, Supabase or Neon |
Every project gets the disk on its first deploy. The project finds its path in the variable DATA_DIR (a variable is a named value the code reads when it starts); the path is /data. A database is added only when you or your AI ask for one. See The project disk and Postgres database.
What stays and what is replaced
Each deploy builds a fresh copy of the project from the code. Anything the program wrote outside /data disappears with the old copy. So:
- A new version. The code changes. Files in
/dataand the database stay as they are. - Going back to an earlier version. Only the code goes back. Files in
/dataand the database stay as they are. - Putting data back. Only the data goes back to a saved point. The code does not change. See Backups and restore.
When BitHut reads the code before building, it checks where the program saves files. If a database or a file is written outside /data, the deploy result says so and names the line to change. In the cabinet, the project then shows “Saves data outside the saved disk”; when all is right, it shows “Data folder is on the saved disk”.
Copies of the data
BitHut saves the data before every new version and every night. How many nightly copies are kept depends on your plan. You can put the data back to any saved point in the cabinet or by asking your AI.
When you delete a project
The project’s files and database are kept for 7 days after you delete it. Within that time, write to team@bithut.app to bring them back.