Configure Vite
Add the Workflow plugin to your Vite config:The plugin automatically:
vite.config.ts
- Adds the Rollup transform plugin for workflow code transformation
- Configures hot module replacement for workflow files
- Builds workflow bundles before SvelteKit starts
- Generates Vercel functions during production builds (when using Vercel adapter)
How it works
The SvelteKit integration:- Uses
@workflow/rollupfor code transformation - Uses
@workflow/vitefor hot module replacement - Builds workflows synchronously on startup (before SvelteKit initialization)
- Automatically discovers workflows in your project
- Generates route handlers at
.well-known/workflow/v1/* - Configures Vercel queue triggers when deploying to Vercel
Example workflow
src/lib/workflows/subscription.ts
Triggering workflows
Start workflows from API routes:src/routes/api/subscribe/+server.ts
Development
Run the development server:Production
Build for production:Vercel deployment
When using the Vercel adapter, the plugin automatically:- Patches Vercel function configurations
- Configures queue triggers for workflow and step execution
- Sets retry policies (max 64 deliveries, 5s retry delay)
svelte.config.js:
svelte.config.js
Next steps
Core Concepts
Learn about workflows and steps
API Reference
View the full SvelteKit API reference