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.
withCloudflareWorkflows is the recommended way to integrate Sideffect with your Cloudflare Workers project. It wraps Cloudflare’s official Vite plugin, intercepts the Worker config before the build starts, scans your workflow source files for Workflow.make(...).toLayer(...) exports, injects the discovered bindings into the Wrangler config, and writes a typed sideffect-env.d.ts file — all without you touching wrangler.toml or wrangler.jsonc by hand.
Minimal setup
AddwithCloudflareWorkflows to your vite.config.ts and spread its return value into the plugins array:
withCloudflareWorkflows returns an Array<Plugin | Result> containing the Sideffect plugin followed by the Cloudflare plugin. Always spread it with ... into the plugins array so both plugins are registered in the correct order.Options reference
withCloudflareWorkflows accepts a single options object of type WithCloudflareWorkflowsOptions. All fields are optional.
workflowPaths
An array of file or directory paths (relative to the project root) that Sideffect scans for exported WorkflowLayer values.
["src/workflows"] when omitted. Directories are scanned recursively; individual file paths are read directly. See Workflow Discovery for the full list of supported export patterns.
worker
Override the Worker entry module path when Sideffect cannot determine it from the Wrangler config automatically.
main field.
configPath
Path to the Wrangler config file when it is not located at the project root. This is forwarded directly to Cloudflare’s Vite plugin and also used by Sideffect as the base directory for resolving workflow paths and writing the generated sideffect-env.d.ts.
persistState
Enable local state persistence during wrangler dev. Accepts a boolean or an object with a path string to control where state is stored.
inspectorPort
Port for the V8 inspector used when attaching a debugger to the Worker during development. Set to false to disable the inspector.
config
A partial WorkerConfig object or a customizer function forwarded to the Cloudflare plugin’s config hook. Use this to add extra Wrangler bindings, Durable Objects, migrations, or other Worker-level config alongside the workflow bindings Sideffect generates.
WorkerConfig and can return a partial override or mutate in place — the same contract as Cloudflare’s own config option:
Adding native workflow bindings
If you have a Cloudflare Workflow that is not managed by Sideffect (for example, a workflow class you register manually), pass it throughconfig.workflows. Sideffect merges your explicit entries with the ones it discovers automatically:
NativeCheck class must still be exported from your Worker entry and registered with Wrangler in the usual way; Sideffect only passes the binding through without generating a layer for it.
TanStack Start example
For full-stack frameworks that add their own Vite plugins (such as TanStack Start), you need to tell Sideffect which Vite environment corresponds to the Worker. PassviteEnvironment with the environment name used by the framework (typically "ssr"), and spread withCloudflareWorkflows alongside the framework plugins:
viteEnvironment option is forwarded unchanged to Cloudflare’s plugin and tells it which Vite environment to treat as the SSR/Worker entry point.