Code Export
Export your workflow as TypeScript SDK code or download a complete Next.js project ready for deployment.
Orchestrator can export your visual workflow into code. This lets you version-control your automations, review them in pull requests, and deploy them outside of the Orchestrator platform.
Export Options
View Generated Code
From the workflow editor toolbar, click Export → View Code. This opens a panel showing the generated TypeScript code for your workflow.
The code uses a workflow SDK format with special directives:
import { sleep, FatalError } from 'workflow';
export async function myWorkflow() {
"use workflow";
// Trigger output
const triggerOutput = { /* trigger data */ };
// Step 1: Generate Text
async function generateText() {
"use step";
const prompt = `Summarize: ${triggerOutput.content}`;
// ... step logic
return { success: true, data: { text: "..." } };
}
// Step 2: Send Slack Message
async function sendSlackMessage() {
"use step";
const textOutput = await generateText();
// ... step logic
return { success: true, data: { messageId: "..." } };
}
const output = await sendSlackMessage();
return output;
}Key features of the generated code:
"use workflow"directive marks the function as a workflow entry point"use step"directive marks each step function for observability- Template variables are translated to JavaScript template literals
- Dependencies are resolved from the actions used in the workflow
Download as ZIP
Click Export → Download to download a complete project package as a ZIP file.
The ZIP contains a ready-to-run Next.js application:
my-workflow/
├── workflows/
│ └── my-workflow.ts # Generated workflow code
├── app/
│ ├── page.tsx # Landing page with workflow info
│ └── api/
│ └── workflows/
│ └── my-workflow/
│ └── route.ts # API route to trigger the workflow
├── package.json # Dependencies auto-calculated from actions used
├── tsconfig.json
└── ... (Next.js boilerplate)What's included:
- Workflow module — Your workflow as a TypeScript function
- API route — A Next.js API endpoint to trigger the workflow via HTTP
- Auto-calculated dependencies — Only the npm packages needed by your specific actions
- Full boilerplate — Ready to
npm install && npm run dev
How Dependencies Are Resolved
The export system inspects which actions your workflow uses and includes only the required packages. For example:
| Actions Used | Dependencies Included |
|---|---|
| AI Gateway Generate Text | ai, openai, @google/genai, zod |
| Slack Send Message | @slack/web-api |
| Resend Send Email | resend |
| Stripe Create Customer | stripe |
| GitHub Create Issue | @octokit/rest |
Using the Exported Code
Extract the ZIP
unzip my-workflow.zip -d my-workflow
cd my-workflowInstall dependencies
npm installConfigure environment variables
Add the required API keys as environment variables. The specific variables depend on which integrations your workflow uses (e.g., SKYTELLS_API_KEY, SLACK_API_KEY, RESEND_API_KEY).
Run locally
npm run devThe API route is available at http://localhost:3000/api/workflows/my-workflow.
Limitations
- Exported code is a snapshot — it doesn't automatically sync with changes in the Orchestrator editor
- Integration credentials are not included in the export — you need to set up environment variables manually
- The
"use workflow"and"use step"directives are designed for the Orchestrator runtime SDK
Next Steps
Workflow Editor
Build workflows to export.
Actions Catalog
See which actions and dependencies are available.
Webhooks
Trigger exported workflows via HTTP.
How is this guide?