matter.work
Building Apps / Foundations

Quick start

Scaffold, develop live inside Matter, declare tables, and deploy your first app in minutes.

This builds a project: an app with its own table, deployed from a folder. For a small tool, a one-page app needs none of it.

You need the Matter desktop app running and signed in on your computer, plus Node.js (v22+) and npm.

1. Put matter on your PATH#

Matter bundles the matter CLI at ~/.matter/bin/matter. Agent threads inside Matter already have it on their PATH; to run it in your own terminal, add it to ~/.zshrc:

Terminal
export PATH="$HOME/.matter/bin:$PATH"

On Windows, add %USERPROFILE%\.matter\bin to your Path. Run matter app --help to see all commands.

2. Scaffold the app#

Terminal
matter app create pipeline --space Sales --name "Pipeline" --icon 📈
cd pipeline

This makes the app, shared to your Sales space, and generates a ready-to-run React, Tailwind and TypeScript project. The app is yours and unpublished, so it’s in nobody’s sidebar yet: find it on the Apps page (⌘7) under Yours.

  • matter.json: your manifest with the app’s ID, minMatterVersion, and "tables": {}.
  • package.json, vite.config.ts (pre-configured with the SDK plugin and a dedicated dev port between 5200 and 5799), tsconfig.json and components.json.
  • index.html, src/main.tsx and src/App.tsx, with Tailwind on Matter’s theme in src/matter.css.
  • src/components/ui/: Matter’s own components, such as buttons, checkboxes, switches, menus and dialogs.
  • src/matter-app.d.ts: generated TypeScript definitions for your app’s tables.
  • Pass --worker to also scaffold a background Node worker in src/worker.ts.

3. Install dependencies#

Terminal
npm install

4. Declare your tables#

Add a deals table under tables in matter.json:

matter.json
"tables": {
  "deals": {
    "fields": {
      "name": { "type": "title" },
      "stage": { "type": "select", "options": ["lead", "won", "lost"] },
      "value": { "type": "number", "name": "Amount" }
    },
    "indexes": {
      "by_stage": { "match": ["stage"], "order": [{ "field": "value", "direction": "desc" }] }
    }
  }
}

Run matter app types to regenerate src/matter-app.d.ts from matter.json. Your code uses the stable keys (deals, stage, value), while people in Matter see the labels (Deals, Stage, Amount).

To create the new table in the space, create a signing key (once per computer) and deploy a preview:

Terminal
matter keys create
matter app deploy --preview

5. Read and write rows#

Replace src/App.tsx with a live query and an insert button:

src/App.tsx
import { useEffect, useState } from 'react'
import matter from '@matter.work/app-sdk'
import { Button } from '@/components/ui/button'

const deals = matter.table('deals')
type Deal = { id: string; title: string; value: number | null }

export function App() {
  const [leads, setLeads] = useState<Deal[]>([])

  // Live query: fires immediately and again whenever matching leads change.
  useEffect(
    () =>
      deals.watch({ index: 'by_stage', eq: { stage: 'lead' }, limit: 50 }, (state) => {
        if (state.status !== 'ready') return
        setLeads(state.value.rows.map((row) => ({ id: row.id, title: row.title, value: row.values.value })))
      }),
    [],
  )

  return (
    <main className="space-y-4 px-8 py-6">
      <Button onClick={() => deals.insert({ title: 'Acme', values: { stage: 'lead', value: 12000 } })}>
        Add a lead
      </Button>
      <ul className="divide-y divide-border rounded-lg border border-border bg-card">
        {leads.map((lead) => (
          <li key={lead.id} className="flex justify-between px-4 py-2">
            {lead.title}
            <span className="text-muted-foreground">${lead.value ?? 0}</span>
          </li>
        ))}
      </ul>
    </main>
  )
}

Click Add a lead inside Matter: the row appears immediately in your app and in its Deals table in Matter.

6. Ship to your team#

Terminal
matter app deploy -m "Initial Pipeline release"

This runs your build, signs and uploads the bundle, syncs the table schema in one transaction, and makes the version current for everyone in the space.

Teammates find it on the Apps page under Shared. To put it in the sidebar of the space’s members, open the app’s menu and turn on Published.