Skip to content

Examples

The examples site is apps/examples: a Vite + React 19 app on @jsudc/react with every memento example behind one sidebar. The Docker image serves the built site at / and at /en/ (MEMENTO_UI_DIR=/app/ui), on the same origin as the API; / opens the first example, the CPU monitor. The live examples and the service site run side by side on the stage stack, which is PostgreSQL; on a SQLite file one process serves one of the two (Deployment modes).

Every list on every page comes from a UDC collection (POST /memento/udc/list), and every page follows the live stream (/memento/ws). The two exceptions say why: the chat reads memento’s chat API, and the live tail shows the stream itself.

The site needs a key with the read scope. When the server has one configured as MEMENTO_DEMO_API_KEY, GET /memento/api/demo hands it out without auth and the page connects with it, so nobody has to paste a key. The server refuses to start with a demo key that is unknown, revoked, expired or has any scope besides read: the route never hands out a key that can write. Without a demo key the route answers 404 and the page asks for a key.

The header shows which key is in use (demo key with the tenant, your key, no key), the language (EN / SR) and Settings: the API base URL and a key of your own, kept in localStorage. Use the demo key forgets yours again.

Two pushers write to the tenant the site shows. Both run from the same image, in the compose profile demo of docker-compose.yaml, each with a key that has the write scope:

  • cpu-monitor (memento cpu-monitor) pushes this machine’s load averages as a CPU_LOAD event every second.
  • simulator (memento simulate) plays a small team at a ticket desk — logging in, creating, modifying, noting and closing tickets, a bot closing stale ones — one event every 3 seconds, and the same team talking in the chat room chat-demo-room.

Run it with Docker starts the stack; the Demo pusher section of docs/DEPLOYMENT.md adds the keys and the profile.

The sidebar is the menu UDC collection: the repository’s menu.yaml, served by @jsmemento/server (source yaml_menu of @jsudc/server) and read again whenever the file changes. Its Collections branch is children: "udc:collections", which the server resolves on every read into the collections it serves: events, cpu_load, activity, menu. Each opens at /udc/<collection> as a plain UdcDataView. A new example is one entry under EXAMPLES in menu.yaml and one page in apps/examples.

v1.1.0released built 663143e