A Matter app stores its records in the tables of its space, and its work in the space’s task boards. When
you declare them under tables and boards in
matter.json, each deploy creates them and keeps them exactly as declared, and your code references tables, boards,
fields, options, and statuses by stable keys.
Declaring tables in matter.json#
{
"minMatterVersion": "0.3.28",
"tables": {
"deals": {
"fields": {
"name": { "type": "title" },
"stage": {
"type": "select",
"options": ["lead", { "key": "won", "name": "Closed won", "color": "green" }, "lost"]
},
"value": { "type": "currency", "currency": "EUR", "name": "Amount" },
"email": { "type": "email" },
"owner": { "type": "person" },
"team": { "type": "person", "allowMultiple": true },
"company": { "type": "relation", "table": "companies" }
},
"indexes": {
"by_stage": { "match": ["stage"], "order": [{ "field": "value", "direction": "desc" }] },
"by_owner_stage": { "match": ["owner", "stage"] },
"by_email": { "match": ["email"], "unique": true }
}
},
"companies": {
"name": "Accounts",
"fields": { "name": { "type": "title", "name": "Company" } }
}
}
}Stable keys vs. human names#
Keys start with a letter or underscore (up to 64 chars, case-insensitive unique). Your SDK calls always
use keys:
deals, value, won.
name sets the label people see (defaults to the key formatted as words, like
close_date → Close date). Change a name and deploy to rename it
without breaking code or data.
Table keys and board keys share one namespace: a key can’t name both a
table and a board, so --drop pipeline always means one thing.
If your code accidentally passes a UI display name instead of a key, the Data API returns a helpful error:
Table deals has no field Amount. Did you mean value (shown as "Amount")?
Supported field types#
| Field type | Options & behavior |
|---|---|
title |
The row’s primary name (at most one per table). Declare one explicitly to make it managed by your app;
otherwise Matter provides a default Name field accessible as row.title.
|
text, number, checkbox, date |
Strings, numbers, booleans, and YYYY-MM-DD dates. |
currency |
Takes optional currency (3-letter ISO code, defaults to "USD"). |
select & multi_select |
Requires options: an array of key strings or { key, name?, color? } objects.
A color is gray, brown, red, orange,
yellow, green, teal, blue, indigo,
purple or pink; an option without one takes the color after the option
before it’s, and keeps it.
|
person |
Workspace member(s). Holds one person by default; pass "allowMultiple": true for a list.
|
relation |
Requires table (the key of another declared table). Holds one row by default; pass
"allowMultiple": true for a list.
|
task |
Links tasks of one of the app’s boards. Requires board (the key of a declared board).
Holds one task by default; pass "allowMultiple": true for a list. Reads give
{ id, title }; writes take a task’s id or title. An index can match a task field but not
order by it. Since Matter 0.4.4.
|
url, email, phone |
Validated/canonicalized strings. |
attachment |
A list of files; pass "allowMultiple": false for a field
that holds one, which reads as the file itself. "maxFileSize" limits each file (like
"10 MB", or a number of bytes) and "fileTypes" which files it takes (like
["image/*", ".zip"]). Can't be indexed.
|
json |
Any JSON value. Can't be indexed. A row’s values come to at most 64 KB in all. |
How every read uses an index#
In the Matter Data API, every filtered or sorted read runs through an index. There is no
ad-hoc sort or filter parameter at query time—instead, you declare the indexes
your queries need in matter.json. Because every query reads a contiguous slice of an index,
pages are always full and queries stay fast whether a table has 50 rows or 500,000.
-
matchlists the fields your query filters by witheq(passing an array of values ineqmatches any of them and merges results in index order). -
ordersets the sort order of matching rows, and its first field can be bounded withrange(gt,gte,lt,lte).
Design broad, reusable indexes: A single index with
match: ["status"], order: [{ "field": "score", "direction": "desc" }] can serve:
- New prospects, highest score first:
eq: { status: 'new' } -
All active prospects across multiple statuses, highest score first:
eq: { status: ['new', 'contacted'] } - Counts per status via
groupCount
Index rules#
-
Index names are lowercase letters, digits and underscores, starting with a letter, like
by_email. -
Each index covers 1 to 3 fields total (across
matchandorder). -
At most one multi-value field (
multi_select, orperson/relation/taskwithallowMultiple: true) may appear inmatch. -
A
"unique": trueindex hasmatchfields only (no multi-value fields) and rejects duplicate non-empty combinations. - A table can have up to 100 indexes total.
-
title,textandphonefields match ignoring case. To match them exactly, or ignoring accents too, write the match field as an object:{ "field": "name", "match": "exact" }or"ignore_case_and_accents". Emails always ignore case.
An app declares up to 50 tables, each with up to 100 fields, and a select field up to 200 options.
Private Tables#
Some data is personal: a member’s mail triage, their reading list. Declare a table
"access": "private" and each member gets their own copy of it. Only they see it, along with
agents and routines acting for them. Workspace admins and owners don’t. Private tables need Matter 0.5.31 or
newer, so set minMatterVersion to at least that.
{
"minMatterVersion": "0.5.31",
"tables": {
"drafts": {
"access": "private",
"fields": {
"subject": { "type": "title" },
"company": { "type": "relation", "table": "companies" }
}
},
"companies": { "fields": { "name": { "type": "title" } } }
}
}-
Your code doesn’t change:
matter.table('drafts')is the member’s own copy, with every query, index, count, and live read working as for any table.matter.tables()marks itprivate: true. - A member’s copy is made the first time the app uses it for them, from the current version.
-
Each deploy keeps every member’s copy in line with
matter.json, in the same transaction and by the same rules as shared tables. Limits apply to each copy on its own. - A private table may link a shared one, but a shared table or a board can’t link a private one. A deploy that declares that fails.
- A deploy can’t change a table between shared and private. Drop it and declare the new one under a new key.
- When a member leaves the workspace, their copies go to the trash and are purged after 30 days.
- Your worker runs as each member who has opened the app, on their own computer, so it reads and writes that member’s copy.
Locked to the Manifest#
An app’s tables and boards have exactly what its manifest declares: the names of tables, boards, fields, options, and statuses, plus colors, currencies, and field types. Only the app’s deploys change them. People in Matter and agents can’t rename them, add or remove fields or options, archive, delete, or move them.
- Rows and tasks are data: people, agents, and your code edit them as usual.
- People can still reorder an app’s tables and boards in the sidebar, and choose which fields a board’s cards show.
- Moving the app to another space moves its tables and boards with it. Deleting the app moves them to the trash, where they’re purged after 30 days.
How Deploys Evolve Your Tables and Boards#
When you run matter app deploy, Matter updates your app’s tables and boards in a single
transaction before switching the current version:
- Creates new tables, boards, fields, options, statuses, and indexes.
-
Updates names, currencies, colors, status order, and field types to match
matter.json(converting existing cell values without data loss). - Removes options and indexes the new version no longer declares. When a board loses a status, its tasks move to the board’s first status.
-
Protects against accidental data loss: If the new version leaves out a table, board, or
field that the current version declares, the deploy stops until you pass
--drop dealsor--drop deals.value. A dropped field is removed. A dropped table or board goes to the trash with its rows or tasks, and is purged after 30 days. -
Undeclared fields: A field nobody declares (one people added before app tables were
locked, or one of an adopted table or board) also stops the deploy until you declare it in
matter.jsonor drop it with--drop key.field(by its key or its name). -
Adopting existing tables and boards: If the space already has a table or board with a
declared one’s name that no app owns, pass
--adopt dealsto hand it to your app. -
Previews and rollbacks: Deploying with
--previewadds new tables, boards, fields, options, statuses, and indexes so your preview code works, and holds off on renames, type changes, and removals until you promote the preview to current. Rolling back to a previously current version restores that version’s names and settings. Neither removes anything.