JavaScript ยท Express reference application

Dispatch Board

A tactile operations queue that demonstrates a deliberately small JavaScript backend, durable task records and optimistic updates without exposing Trestle authority to the browser.

Dispatch Board with queued, assigned, active and complete task lanes

What it proves

Plain JavaScript

A small server is enough

Express serves the frontend and three domain routes. No SDK, generated client or framework-specific Trestle integration is required.

Concurrency

No silent lost updates

Task changes read the current record version and send it back through If-Match when patching.

Confinement

No general proxy

Identifiers are validated and every upstream call is constructed against the fixed db_tasks collection.

Run the example

git clone https://github.com/trestle-cv/dogfood-dispatch-board
cd dogfood-dispatch-board
npm install

export TRESTLE_URL=http://127.0.0.1:7333
export TRESTLE_ADMIN_EMAIL=admin@example.test
export TRESTLE_ADMIN_PASSWORD='choose-a-real-password'

npm run bootstrap
nift build
npm run dev

Start Trestle first and open http://127.0.0.1:4181. Bootstrap creates db_tasks, installs service-only rules and stores its copy-once credential in ignored owner-only configuration.

Task workflow

A task contains a title, status, priority, owner and note. The browser lists tasks, creates dispatches and advances them through the board. Express validates the complete writable shape, fetches the authoritative record before an update and lets Trestle enforce the version precondition.

GET   /api/tasks
POST  /api/tasks
PATCH /api/tasks/:id

Architecture and authority

browser -> Express domain API -> Trestle HTTP API -> configured Trestle store

The service credential stays in Express. It can read and write records but cannot administer collections, users or the server. The example is intentionally ordinary: native fetch(), a small Express process and public Trestle HTTP contracts.

Useful checks

npm test
npm run check