When you runDocumentation 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.
vite build or vite dev, Sideffect reads your workflow source files with the TypeScript parser and walks the AST to find exported WorkflowLayer values — it never imports or executes your modules during this phase. This means discovery is safe to run in any environment, works before your runtime dependencies are available, and cannot trigger side effects from your application code.
Supported export patterns
Sideffect recognises four static forms. Any of these can appear in the files or directories you list inworkflowPaths.
1. Inline Workflow.make(...).toLayer(...)
The most direct form: call Workflow.make and chain .toLayer in a single exported variable declaration.
2. Variable holding the definition, then .toLayer() in the same file
You can define the workflow object first and call .toLayer on it later in the same file. Sideffect tracks the intermediate variable and resolves the name correctly.
3. Imported workflow definition from a relative module
The workflow definition can live in a separate file and be imported into the file that calls.toLayer. Sideffect follows local relative imports to resolve the definition.
4. Default-exported workflow layer
A default export is also discovered. Sideffect uses"default" as the export name internally and derives the class name and binding from workflow.name as usual.
Naming convention
Thename string you pass to Workflow.make drives two identifiers that Sideffect generates automatically:
name value | Cloudflare class name | Worker binding |
|---|---|---|
"add-numbers" | AddNumbers | ADD_NUMBERS |
"image-processing" | ImageProcessing | IMAGE_PROCESSING |
"billing_invoice" | BillingInvoice | BILLING_INVOICE |
WorkflowEntrypoint export name.
Binding rule: the name is converted to SCREAMING_SNAKE_CASE by inserting underscores before uppercase-to-lowercase transitions and replacing non-alphanumeric runs with _, then the whole string is uppercased.
Unsupported patterns
Configuring workflowPaths
The workflowPaths option accepts an array of file or directory paths relative to your project root (or to the directory containing your Wrangler config if you pass configPath).
.ts, .tsx, .mts, .cts, .js, .jsx, .mjs, or .cjs, skipping declaration files (.d.ts, .d.mts, .d.cts). When a path points to a file, that file is read directly without any directory traversal.
Sideffect also follows barrel re-exports. If a file contains export * from "./other-file" or export { myLayer } from "./other-file" pointing at a local module, the referenced module is scanned for workflow layers automatically.
TypeScript dependency
Workflow discovery uses the TypeScript compiler API (
ts.createSourceFile) to parse source files. The typescript package must be installed as a dev dependency in the project that uses sideffect/vite. Runtime usage of sideffect and sideffect/cloudflare in the Worker itself is unaffected and does not require TypeScript at runtime.Using collectWorkflowEntries directly
collectWorkflowEntries is exported from sideffect/vite for cases where you need to run workflow discovery outside of the Vite plugin — for example, in a custom build script or a test helper that asserts which workflows are registered.
workflowPaths array and an optional baseDirectory (defaults to process.cwd()). It returns the same CapturedSideffectWorkflow[] array that withCloudflareWorkflows uses internally when writing bindings and the sideffect-env.d.ts type file.