View as Markdown
Flows

Relay

External service → external service. Transit data between two SaaS systems, optionally transforming on the way. Useful when one service needs another's data without staging it in your DB. Declare named variants (run modes), each independently schedulable with onError/onComplete hooks, and branch on `ctx.variant`. Tracked in the standard `khotan_runs` table — status, durations, batch counts, create/update/delete/fail tallies, plus a metadata JSON for component-specific stats. Toggle off with --no-runs.

eE → eL
stripe
T
transform
slack

Install

terminal
$ npx khotan add relay <source> <destination>

Variants

A flow declares a variants map of named run modes, each with its own optional cron schedule and onError/onComplete hooks. The variant name is the mode — your flow code branches on ctx.variant. Click a tag above the preview to see the flow change. Select a variant when triggering:

ts
await khotanData.flow('relay').start({ variant: 'full' })
terminal
$ npx khotan flows trigger relay full

Variants with a schedule are dispatched independently by the cron dispatcher; variants without one are manual-only. Every run records its variant and source (scheduled | manual | webhook). What each variant actually does is up to your flow code and what the source API allows.

Highlights

  • Variants — declare a `variants` map of named run modes, each with its own optional cron `schedule` and `onError`/`onComplete` hooks. The variant name *is* the mode: flow code branches on `ctx.variant`. Trigger one with `khotanData.flow(name).start({ variant })` or `npx khotan flows trigger <flow> <variant>`. A built-in `slackNotifier(webhookUrl)` helper wires terminal-state alerts. Every run records its `variant` and `source` (scheduled | manual | webhook).
  • runs

What to expect from add

Running npx khotan add relay <source> <destination> scaffolds one or more files into your khotan runtime, React component directory, or app routes depending on the component. khotan may also prompt to install dependent components, npm packages, shadcn pieces, or Workflow integration when this component needs them.

Usage

Use the generated builder or UI inside your khotan setup and operational surfaces. For live runtime inspection, pair this component with the CLI and the built-in docs markdown routes.

Next steps