---
title: "Recipe: data the app ships"
description: "Data the app ships and only reads is a JSON file app.ts imports: it is bundled with the data module on every host, with no grant and no path to get wrong."
modificationDate: "2026-11-14"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: data the app ships

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/shipped-data: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

Data the app ships and only reads (a catalogue, a word list, a city table) is a JSON file
`app.ts` imports: it is bundled with the data module on every host, with no grant and no
path to get wrong.

```prompt Ship a data file with my app
Make the Exact app in this folder ship data that it only reads (a catalogue, a word list, a city table) as a JSON file that app.ts imports. Use https://github.com/expo/exact/blob/main/docs/recipes/shipped-data.md as the source for each step. The Exact checkout has the same page at docs/recipes/shipped-data.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which data the app ships and where that data is now, ask me before you write code. If the file is large, binary, or opened by a native module, tell me: it is read by path at run time instead (step 5).
3. Put the data in a JSON file beside app.ts, as the recipe's `cities.json` is, and import it there: `import cities from './cities.json'`. Add no grant and no file path for it: the file is bundled with the data module on every host.
4. In app.ts, add a source that returns the imported value, as `loadCities: () => cities` does. In app.contract, declare a `shape` for one item and read the source as a `resource` with `else empty()`. Give each row a key from the item's id.
5. Only for a file read by path at run time: follow the recipe's last note and docs/recipes/files-and-grants.md. Name the file in app.json's `host.ios.resources` (and `.macos`), and read it with `fs.read` from `bundle:/Resources/`. Its `from` is a directory of its own (`data-files/`), never one Exact owns: `assets/`, `data/`, `src/`, `web/`, `modules/` and the others the recipe lists.
6. Add a test in app.test.contract like the recipe's: run `clock data`, then expect the text of the first and the last shipped row.
7. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 8) and report it; do not keep trying.
8. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
9. Tell me which file the app ships and which source reads it, what the tests and checks reported, and the launch command for each target platform. An edit to the JSON ships as an update, as app.ts does, with nothing to copy at build.
```

```contract
shape City
  id: string
  name: string
  country: string

component Cities
  resource cities = loadCities() as shape City[] else empty()
  view
    list appearance="none"
      for c in cities key=c.id
        row gap=8 padding="8px 16px"
          text c.name testId=`city-${c.id}`
          text c.country color="-exact-secondary-label"
```

`cities.json`, beside `app.ts`:

```json cities.json
[{ "id": "1", "name": "Lyon", "country": "France" }, { "id": "2", "name": "Osaka", "country": "Japan" }]
```

```ts
import type { Answer, Sources } from './app.contract.d.ts';
import cities from './cities.json';

export const grants = '';

const sources: Sources = { loadCities: () => cities };
export const answer: Answer = (source, args, store, storage, native) => sources[source](args, store, storage, native);
```

```contract-test
test "the shipped cities show"
  clock data
  expect text "city-1" == "Lyon"
  expect text "city-2" == "Osaka"
```

- An edit to the JSON ships as an update, as `app.ts` does; nothing to copy at build.
- A file read by path at run time (large, binary, or opened by a native module) is
  app.json's `host.ios.resources` (and `.macos`), read with `fs.read bundle:/Resources/…`
  ([files and grants](https://exact.expo.dev/recipes/files-and-grants.md)). Its `from` is a directory of its own
  (`data-files/`), never one Exact owns: `assets/` `deck/` `gpu/` `fonts/` `strings/`
  `web/` `apple/` `linux/` `src/` `data/` `modules/` `node_modules/` `target/` `dist/`.
