# Give every app its own folder of files

What's new in Tray Helix · 23 November 2026 · https://helix.tray.ai/whats-new/project-files/

Tray Helix now gives a project its own directory of files through ctx.fs(). Every function in the project reads and writes the same directory with Node's familiar fs/promises methods, and the files persist across executions and deployments. Paths can't leave the directory, and helix dev keeps a local copy so nothing touches deployed files while you build.

**Available in:** Every Helix project. Call ctx.fs() in your project's own code.

Some of what an app produces is simply a file. A finance app builds a month-end report. An ops tool exports a CSV for an auditor. A library wants a path on disk, not a value in a database. Until now that meant pushing the file somewhere else and keeping track of where it went.

Now a Helix project has its own folder. Call `ctx.fs()`, write the file, and every function in the project can read it back, on the next run and after the next deploy.

**What that gives the team building it:**

- **The methods you already know.** `readFile`, `writeFile`, `readdir`, `mkdir`, streams. The same `fs/promises` calls, with Node's own errors, so `ENOENT` means what it always meant.
- **Files that stay put.** The directory persists across executions and deployments. Every function in the project sees the same one.
- **A path for libraries that need one.** `fs.resolve()` returns a real path inside the project's folder.
- **A safe local copy.** `helix dev` keeps files in `.helix/project-files/` inside the project, already excluded from git, so building never touches deployed files.

**What it gives IT:**

- **Each project keeps to its own folder.** A path that tries to leave it, through `..`, an absolute path or a symlink, is rejected before anything runs.
- **Off unless it's used.** Helix turns the file system on only for a project whose own code calls `ctx.fs()`.
- **Gone with the project.** Deleting a project deletes its files.

## An example

A finance team runs a month-end app on Helix. Each close, it pulls the numbers and builds a report the controller signs off.

### 1. The app writes the report

At the end of the close, a function writes the month's report to `reports/2026-11.json` in the project's folder.


```ts
await ctx.fs().writeFile('reports/2026-11.json', report);
```

### 2. The controller opens it the next morning

The page that shows the report reads the same file. It's there because the folder persists, even though the run that wrote it has finished.

### 3. A new version ships

The team deploys a change to how the report is laid out. Last month's report is still in the folder, so the new page can show both side by side.

### 4. Someone asks for a month that isn't there

The read fails with Node's usual `ENOENT`, and the app answers "No report for that month" instead of an error page.

## What else you could build

- **An export folder** that keeps each month's CSV for an auditor to download.
- **A template library** of document templates an app fills in.
- **A cache** for a library that needs a file on disk.
- **Data files you can query in place.** It works with AlaSQL, and with Parquet files through HyParquet.
- **An upload inbox** that keeps files people send in until a job processes them.

## Before you build one

**Call it in your own code.** Helix finds `ctx.fs()` in your project's source, not inside a dependency. If a library needs files, call `ctx.fs()` yourself and pass it the handle or a path.

**Give concurrent runs their own file names.** Every execution shares the one folder, and nothing coordinates two writers on the same file.

**Use the database for records.** Files suit reports, exports and templates. Data that relates to other data belongs in the project's database.

How to read and write files, and handle errors, is in the docs linked above.

## Links

- Docs: [Project files guide](https://helix.tray.ai/documentation/guides/project-files/)
- Docs: [ctx.fs() reference](https://helix.tray.ai/documentation/reference/context/fs/)

## Questions

### When should I use files instead of the database or key-value store?

When the data is better as a file: a generated report, an export, a template, or anything a library expects to find on disk. Records that relate to each other belong in the database, and a single value or flag belongs in the key-value store.

### Do files survive a deploy?

Yes. The directory persists across executions and deployments. It goes away only when the project is deleted.

### Can a function reach files outside the project?

No. A path with a .. segment, an absolute path, or a symlink that leads outside the directory is rejected before anything runs.

### Can a library use it?

Yes. Call ctx.fs() in your own code, then pass the handle, or a path from fs.resolve(), to the library. Helix turns the file system on for a project when it finds ctx.fs() in the project's own source.

