Frameworks
SvelteKit
Configure Workflow Studio with SvelteKit
Overview
This guide configures Workflow Studio for SvelteKit applications.
Two settings control behavior:
execution.modecontrols local vs remote execution.- adapter
modecontrols ingress behavior (passthroughorproxy-trigger).
Mode matrix
| execution.mode | adapter mode | Behavior |
|---|---|---|
remote | passthrough | Standard start(...) routes remain unchanged; execution runs on remote compute worker with production reroute env. |
remote | proxy-trigger | Remote execution plus optional app-host proxy routes for trigger/webhook ingress. |
local | passthrough | Local/default execution behavior. |
local | proxy-trigger | Local execution with optional proxy ingress routes. |
Default remote setup
import { withWorkflowStudioSvelteKit } from 'workflow-studio/sveltekit';
export default await withWorkflowStudioSvelteKit(
{ kit: {} },
{
execution: { mode: 'remote' },
mode: 'passthrough',
}
);Set production reroute in deployment environment:
WORKFLOW_TARGET_WORLD=workflow-studio/world-remoteOptional proxy-trigger routes
import { withWorkflowStudioSvelteKit } from 'workflow-studio/sveltekit';
export default await withWorkflowStudioSvelteKit(
{ kit: {} },
{
execution: { mode: 'remote' },
mode: 'proxy-trigger',
}
);import { proxyTriggerFromSvelteKit } from 'workflow-studio/sveltekit';
import { json } from '@sveltejs/kit';
export async function POST({ request }) {
const body = await request.json();
const result = await proxyTriggerFromSvelteKit({
payload: {
workflowName: 'send-email',
input: { userId: body.userId },
},
});
return json(result);
}import { proxyWebhookFromSvelteKit } from 'workflow-studio/sveltekit';
export async function POST({ request, params }) {
const body = new Uint8Array(await request.arrayBuffer());
return await proxyWebhookFromSvelteKit({
provider: params.provider,
body,
headers: Object.fromEntries(request.headers.entries()),
});
}Required production settings
WORKFLOW_TARGET_WORLD=workflow-studio/world-remoteWORKFLOW_COMPUTE_BASE_URLWORKFLOW_COMPUTE_API_KEY