Browse all topics

Data

Persistent storage

Where your app can keep files that survive redeploys.

Each deployment builds a fresh copy of your app. Files your app writes while running, such as uploads, a SQLite file or a cache, would normally disappear on the next deploy.

To keep files, write them to /data. Every service project has its own /data folder that:

  • survives redeploys, restarts and rollbacks;
  • is private to your project;
  • is deleted when you delete the project;
  • is available to your app as the environment variable DATA_DIR.
const path = require("path");
const uploads = path.join(process.env.DATA_DIR || "/data", "uploads");

What to store there#

Uploads, SQLite files, generated reports, anything your app must not lose.

What not to store there#

Back it up#

/data is included in our regular disaster-recovery backups, but treat that as a safety net, not a service you can restore from on request. Keep your own copy of anything important, and prefer a managed database for important records.

Static sites#

Static sites have no /data: they are only files.

Existing projects#

A project deployed before this feature existed gets /data the next time it is redeployed. Files it stored inside the container earlier are not carried across.