Elements

Signal

data in motion — Queues, pub/sub, and streams collapse into one Signal. Delivery physics (`once` · `broadcast` · `live`) is mandatory — no silent default.

Signal is the element for data in motion.

Queues, pub/sub, and streams collapse into one Signal. Delivery physics (once · broadcast · live) is mandatory — no silent default.

Governing rule

delivery is mandatory with no default. Delivery physics is a semantic decision; guessing it produces silent, expensive bugs.

At a glance

Signal

Essence: data in motion. Replaces: queue · pub/sub · stream · websocket · SSE · event bus.

Drivers available

memory

Dev default — in-process, no extra service.

postgres

Prod default — transactional with your data.

redis

Explicit alternative for throughput; outbox relay kept.

nats · kafka

Explicit high-throughput alternatives.

Why this is an element

Why

Queue, pub/sub, and stream were always the same object with different delivery physics — so delivery is an option, not three ecosystems.

once

Queue semantics: competing consumers, retries, DLQ.

broadcast

Pub/sub: fan-out to every subscriber.

live

Stream: client-subscribable, replayable.

Example from the teaching apps

Claimed fence from linkly — same source the doc-drift gate checks:

examples/linkly/src/flows/links/signals.ts

import { signal } from "okengine";
import { z } from "zod";

export const linkClicked = signal("link-clicked", {
  schema: z.object({ code: z.string(), at: z.number(), referrer: z.string().optional() }),
  delivery: "once",                       // queue physics: one consumer, retries, DLQ
  retries: 3, deadLetter: true,
});

export const linkStats = signal("link-stats", {
  schema: z.object({ code: z.string(), clicks: z.number() }),
  delivery: "live",                       // stream physics: clients subscribe
});

Next

On this page