Design System

Enterprise Design System Documentation

Pattern Library

Code

Five places code has to read well — a quickstart, release notes with code in the prose, an incident runbook, a config reference and a before/after lesson.

01SDK QuickstartDocs · Install + usage · Step rail
Docs / Quickstart

Send your first event

Two commands and nine lines. If you already have a token in your environment, skip straight to the second block.

Install the SDKAdd your token3Send an event

InstallCopy

npm install @relay/sdk

# or
pnpm add @relay/sdk

Send an eventCopy

import { Relay } from "@relay/sdk";

const relay = new Relay({
  token: process.env.RELAY_TOKEN
});

await relay.events.send({
  type: "order.created",
  data: { orderId: "NW-40218" }
});
Node 18+, Deno 2 and Bun 1.1 are supported.
02Release NotesInline code in prose · Typed changes
4.2.018 July 2026Minor
Added

New idempotencyKey option on every write. Retries with the same key return the original response instead of creating a duplicate.

Changed

Default backoff is now exponential with jitter. Override it with retries or disable entirely with retries: 0.

Fixed

relay.events.list() no longer drops the cursor parameter when combined with a date filter.

Removed

The deprecated v2 config format. Run npx relay migrate to convert existing files.

Breaking changes are always announced one minor version ahead.

03Incident RunbookDark · Numbered steps · Exact commands
SEV-2

Elevated webhook delivery latency

owner: platform
Reviewed 2 weeks ago
01

Confirm the symptom

Check delivery lag before touching anything. If p99 is under 30s this is not the runbook you want.

$relay metrics delivery --window 15m --percentile 99
02

Identify the bad rollout

Compare the running config hash against the last known-good deploy.

$relay config diff --env production --against last-green
03

Roll back

Rolling back is safe at any point — queued events replay automatically.

$relay deploy rollback --env production --to last-green
runbooks/delivery-latency.mdEscalate to #platform-oncall after 15 minutes
04Config ReferenceKey table · Typed defaults · Source file

relay.config.ts

Every key is optional. Anything you omit falls back to the default shown below, which is what most projects ship with.

KeyTypeDefault
regionstring"eu-central-1"Where builds run and functions deploy.
runtimestring"node22"Applies to new deployments only.
buildFilterstring[][]Glob patterns; empty means build everything.
previewAuthbooleantrueRequire sign-in to open a preview URL.
retriesnumber4Maximum delivery attempts per event.
relay.config.ts
// relay.config.ts
import { defineConfig } from "@relay/sdk";

export default defineConfig({
  region: "eu-central-1",
  buildFilter: ["apps/web/**"],
  previewAuth: false
});
05Before & AfterTeaching · Two panels · Inline takeaways
JavaScript, properly

Lesson 2 — Why await inside a loop is usually wrong

Module 4 · Asynchrony

Avoid
// Sequential — 10 requests take 10 × latency
const results = [];

for (const id of ids) {
  results.push(await fetchUser(id));
}
Prefer
// Concurrent — 10 requests take about 1 × latency
const results = await Promise.all(
  ids.map((id) => fetchUser(id))
);
  • Use Promise.all when the calls do not depend on each other
  • Keep await in the loop when each call needs the previous result
  • Reach for Promise.allSettled when one failure should not abort the rest