Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/eersnington/sideffect/llms.txt

Use this file to discover all available pages before exploring further.

Sideffect is a TypeScript library for building Cloudflare Workflows from composable, schema-validated steps. A Vite plugin discovers your workflow files at build time and automatically writes Wrangler bindings and TypeScript environment types — so you never touch wrangler.toml or wrangler.jsonc for workflow setup.
The Sideffect API is experimental and subject to change before a stable release.

Installation

Install Sideffect and its peer dependencies in your Cloudflare Worker project.

Quickstart

Build your first typed Cloudflare Workflow with steps in under five minutes.

Core Concepts

Understand workflows, steps, rollback handlers, and the Effect-style API.

API Reference

Explore every exported function, class, and type in the public API.

Why Sideffect?

Typed Steps

Define workflow steps with Effect Schema-validated payloads and results. Schema failures become non-retryable errors automatically.

Zero Wrangler Config

The Vite plugin discovers WorkflowLayer exports using static TypeScript AST analysis and injects bindings into the build — no wrangler.jsonc edits needed.

Native Cloudflare Runtime

Sideffect generates real WorkflowEntrypoint subclasses. Nothing is emulated — your workflow runs exactly as if you wrote it by hand.

Effect-Style Composition

Step and workflow run functions can return plain values, Promises, or Effect.Effect — mix and match without adapters.

How It Works

1

Define typed steps

Create reusable steps with Step.make(), providing payload and result schemas plus a run function.
2

Compose a workflow

Use Workflow.make() to define the workflow name and payload schema, then attach a run implementation with .toLayer().
3

Add the Vite plugin

Wrap Cloudflare’s Vite plugin with withCloudflareWorkflows(). Sideffect scans your workflow files and auto-configures all bindings.
4

Use bindings as normal

Access workflow bindings on env like any other Cloudflare binding — env.MY_WORKFLOW.create({ params }).
import { Schema, Step, Workflow } from "sideffect";

const greetStep = Step.make("greet", {
  payload: Schema.Struct({ name: Schema.String }),
  result: Schema.Struct({ message: Schema.String }),
  run: ({ name }) => ({ message: `Hello, ${name}!` }),
});

const helloWorkflow = Workflow.make({
  name: "hello-world",
  payload: Schema.Struct({ name: Schema.String }),
});

export const helloWorldLayer = helloWorkflow.toLayer(async ({ payload }, step) => {
  return step.do(greetStep, { name: payload.name });
});

Build docs developers (and LLMs) love