View as Markdown
Flows

Inflow

External service → your Postgres. Pull data from a SaaS API on a schedule, transform it, and load it into your Drizzle tables. Declare named variants (run modes) — each with its own optional cron schedule and onError/onComplete hooks — and branch on `ctx.variant` (e.g. `delta`, `full`, `healthcheck`). 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 → iL
stripe
T
transform
postgres

Install

terminal
$ npx khotan add inflow <source>

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('inflow').start({ variant: 'full' })
terminal
$ npx khotan flows trigger inflow 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 inflow <source> 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