VercelLogotypeVercelLogotype
LoginSign Up
Back to Templates

Workflow Builder

Workflow Builder is a free, open-source template for building visual workflow automation

DeployView Demo
Workflow Builder Screenshot

AI Workflow Builder Template

A template for building your own AI-driven workflow automation platform. Built on top of Workflow DevKit, this template provides a complete visual workflow builder with real integrations and code generation capabilities.

Deploy Your Own

You can deploy your own version of the workflow builder to Vercel with one click:

What happens during deployment:

  • Automatic Database Setup: A Neon Postgres database is automatically created and connected to your project
  • Environment Configuration: You'll be prompted to provide required environment variables (Better Auth credentials and AI Gateway API key)
  • Ready to Use: After deployment, you can start building workflows immediately

What's Included

  • Visual Workflow Builder - Drag-and-drop interface powered by React Flow
  • Workflow DevKit Integration - Built on top of Workflow DevKit for powerful execution capabilities
  • Real Integrations - Connect to Resend (emails), Linear (tickets), Slack, PostgreSQL, and external APIs
  • Code Generation - Convert workflows to executable TypeScript with "use workflow" directive
  • Execution Tracking - Monitor workflow runs with detailed logs
  • Authentication - Secure user authentication with Better Auth
  • AI-Powered - Generate workflows from natural language descriptions using OpenAI
  • Database - PostgreSQL with Drizzle ORM for type-safe database access
  • Modern UI - Beautiful shadcn/ui components with dark mode support

Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • pnpm package manager

Environment Variables

Create a .env.local file with the following:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/workflow_builder
# Better Auth
BETTER_AUTH_SECRET=your-secret-key
BETTER_AUTH_URL=http://localhost:3000
# AI Gateway (for AI workflow generation)
AI_GATEWAY_API_KEY=your-openai-api-key

Installation

# Install dependencies
pnpm install
# Run database migrations
pnpm db:push
# Start development server
pnpm dev

Visit http://localhost:3000 to get started.

Workflow Types

Trigger Nodes

  • Webhook
  • Schedule
  • Manual
  • Database Event

Action Nodes

  • AI Gateway: Generate Text, Generate Image
  • Blob: Put Blob, List Blobs
  • Clerk: Get User, Create User, Update User, Delete User
  • fal.ai: Generate Image, Generate Video, Upscale Image, Remove Background, Image to Image
  • Firecrawl: Scrape URL, Search Web
  • GitHub: Create Issue, List Issues, Get Issue, Update Issue
  • Linear: Create Ticket, Find Issues
  • Perplexity: Search Web, Ask Question, Research Topic
  • Resend: Send Email
  • Slack: Send Slack Message
  • Stripe: Create Customer, Get Customer, Create Invoice
  • Superagent: Guard, Redact
  • v0: Create Chat, Send Message
  • Webflow: List Sites, Get Site, Publish Site

Code Generation

Workflows can be converted to executable TypeScript code with the "use workflow" directive:

export async function welcome(email: string, name: string, plan: string) {
"use workflow";
const { subject, body } = await generateEmail({
name,
plan,
});
const { status } = await sendEmail({
to: email,
subject,
body,
});
return { status, subject, body };
}

Generate Code for a Workflow

# Via API
GET /api/workflows/{id}/generate-code

The generated code includes:

  • Type-safe TypeScript
  • Real integration calls
  • Error handling
  • Execution logging

API Endpoints

Workflow Management

  • GET /api/workflows - List all workflows
  • POST /api/workflows - Create a new workflow
  • GET /api/workflows/{id} - Get workflow by ID
  • PUT /api/workflows/{id} - Update workflow
  • DELETE /api/workflows/{id} - Delete workflow

Workflow Execution

  • POST /api/workflows/{id}/execute - Execute a workflow
  • GET /api/workflows/{id}/executions - Get execution history
  • GET /api/workflows/executions/{executionId}/logs - Get detailed execution logs

Code Generation

  • GET /api/workflows/{id}/generate-code - Generate TypeScript code
  • POST /api/workflows/{id}/generate-code - Generate with custom options

AI Generation

  • POST /api/ai/generate-workflow - Generate workflow from prompt

Database Schema

Tables

  • user - User accounts
  • session - User sessions
  • workflows - Workflow definitions
  • workflow_executions - Execution history
  • workflow_execution_logs - Detailed node execution logs

Development

Scripts

# Development
pnpm dev
# Build
pnpm build
# Type checking
pnpm type-check
# Linting
pnpm check
# Formatting
pnpm fix
# Database
pnpm db:generate # Generate migrations
pnpm db:push # Push schema to database
pnpm db:studio # Open Drizzle Studio

Integrations

Resend (Email)

Send transactional emails with Resend's API.

import { sendEmail } from "@/lib/integrations/resend";
await sendEmail({
to: "user@example.com",
subject: "Welcome!",
body: "Welcome to our platform",
});

Linear (Tickets)

Create and manage Linear issues.

import { createTicket } from "@/lib/integrations/linear";
await createTicket({
title: "Bug Report",
description: "Something is broken",
priority: 1,
});

PostgreSQL

Direct database access for queries and updates.

import { queryData } from "@/lib/integrations/database";
await queryData("users", { email: "user@example.com" });

External APIs

Make HTTP requests to any API.

import { callApi } from "@/lib/integrations/api";
await callApi({
url: "https://api.example.com/endpoint",
method: "POST",
body: { data: "value" },
});

Firecrawl (Web Scraping)

Scrape websites and search the web with Firecrawl.

import {
firecrawlScrapeStep,
firecrawlSearchStep,
} from "@/lib/steps/firecrawl";
// Scrape a URL
const scrapeResult = await firecrawlScrapeStep({
url: "https://example.com",
formats: ["markdown"],
});
// Search the web
const searchResult = await firecrawlSearchStep({
query: "AI workflow builders",
limit: 5,
});

Tech Stack

  • Framework: Next.js 16 with React 19
  • Workflow Engine: Workflow DevKit
  • UI: shadcn/ui with Tailwind CSS
  • State Management: Jotai
  • Database: PostgreSQL with Drizzle ORM
  • Authentication: Better Auth
  • Code Editor: Monaco Editor
  • Workflow Canvas: React Flow
  • AI: OpenAI GPT-5
  • Type Checking: TypeScript
  • Code Quality: Ultracite (formatter + linter)

About Workflow DevKit

This template is built on top of Workflow DevKit, a powerful workflow execution engine that enables:

  • Native TypeScript workflow definitions with "use workflow" directive
  • Type-safe workflow execution
  • Automatic code generation from visual workflows
  • Built-in logging and error handling
  • Serverless deployment support

Learn more about Workflow DevKit at useworkflow.dev

License

Apache 2.0

GitHub Repovercel-labs/workflow-builder-template
LicenseView License
Use Cases
StarterAI
Stack
Next.jsTailwind
Database
Neon

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Community

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • v0

        Build applications with AI

      • AI SDK

        The AI Toolkit for TypeScript

      • AI Gateway

        One endpoint, all your models

      • Vercel Agent

        An agent that knows your stack

      • Sandbox

        AI workflows in live environments

    • Core Platform
      • CI/CD

        Helping teams ship 6× faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
Back to Templates
DeployView Demo
v0

Build applications with AI

AI SDK

The AI Toolkit for TypeScript

AI Gateway

One endpoint, all your models

Vercel Agent

An agent that knows your stack

Sandbox

AI workflows in live environments

CI/CD

Helping teams ship 6× faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea