A modern workflow automation platform with visual interface and event-driven execution engine. BuildFlow enables developers to build, deploy, and manage automated workflows connecting various services and APIs.
- Overview
- Architecture
- Tech Stack
- Project Structure
- Database Schema
- Getting Started
- Development
- Microservices
- Key Features
- Roadmap
BuildFlow is a workflow automation platform inspired by N8N, designed to solve debugging and reliability issues in workflow execution. It provides a visual interface for creating workflows that connect triggers and actions (nodes) to automate business processes.
- Workflows: Visual representations of automated processes
- Triggers: Events that initiate workflow execution
- Nodes: Individual actions or operations within a workflow
- Executions: Tracked runs of workflows with detailed status and error handling
- Credentials: Secure OAuth and API key storage per integration
BuildFlow follows a microservices architecture with an event-driven execution model:
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Web App ββββββΆβ HTTP Backend ββββββΆβ Database β
β (Next.js) β β (Express) β β (PostgreSQL)β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
βΌ
ββββββββββββββββ
β Hooks API β
β (Express) β
ββββββββββββββββ
β
βΌ
ββββββββββββββββ βββββββββββββββ
β Processor ββββββΆβ Kafka β
β (KafkaJS) β β (Broker) β
ββββββββββββββββ βββββββββββββββ
β β
ββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββ
β Worker β
β (Consumer) β
ββββββββββββββββ
- Trigger Event: External event hits Hooks API (
/hooks/catch/:userId/:workflowId) - Transaction Outbox: Workflow execution created atomically with outbox entry
- Event Publishing: Processor reads outbox and publishes to Kafka
- Execution: Worker consumes messages and executes workflow nodes
- Status Tracking: Each node execution tracked with retry logic
- Framework: Next.js 15.4.5 (App Router, Turbopack)
- UI Library: React 19.1.1
- State Management: Redux Toolkit 2.11.2 with React Redux
- Visual Editor: React Flow (@xyflow/react) 12.9.3
- Authentication: NextAuth.js 4.24.13
- Styling: TailwindCSS 4.x with PostCSS
- UI Components: Radix UI, Lucide React icons
- Validation: Zod 3.25.76
- HTTP Client: Axios 1.13.2
- HTTP Backend: Express.js 5.1.0 (Port 3002)
- Hooks Service: Express.js 5.1.0 (Port 3002)
- Processor: KafkaJS 2.2.4 (Producer)
- Worker: KafkaJS 2.2.4 (Consumer)
- Database: PostgreSQL
- ORM: Prisma Client
- Migrations: Prisma Migrate
- Broker: Apache Kafka
- Client: KafkaJS 2.2.4
- Topic:
First-Client
- Monorepo: Turborepo 2.5.5
- Package Manager: pnpm 10.26.2
- TypeScript: 5.7.3 / 5.9.2
- Linting: ESLint 9.32.0
- Formatting: Prettier 3.6.2
- Google APIs: googleapis 166.0.0
- OAuth: google-auth-library 10.5.0
- Node.js: >=20
- Package Manager: pnpm@10.26.2
BuildFlow/
βββ apps/
β βββ web/ # Next.js frontend application
β β βββ app/ # App Router pages and routes
β β β βββ api/ # API routes (NextAuth, Google Sheets)
β β β βββ components/ # React components
β β β βββ hooks/ # Custom React hooks
β β β βββ workflow/ # Workflow editor page
β β β βββ types/ # TypeScript types
β β βββ store/ # Redux store configuration
β β
β βββ http-backend/ # Main Express API server
β β βββ src/
β β βββ routes/ # API route handlers
β β β βββ userRoutes/ # User management
β β β βββ nodes.routes.ts
β β β βββ google_callback.ts
β β βββ index.ts
β β
β βββ hooks/ # Webhook receiver service
β β βββ src/index.ts # Receives external triggers
β β
β βββ processor/ # Kafka producer service
β β βββ src/index.ts # Reads outbox, publishes to Kafka
β β
β βββ worker/ # Kafka consumer service
β βββ src/index.ts # Consumes messages, executes workflows
β
βββ packages/
β βββ db/ # Prisma database package
β β βββ prisma/
β β βββ schema.prisma # Database schema
β β
β βββ nodes/ # Node registry and executors
β β βββ src/
β β βββ google-sheets/ # Google Sheets integration
β β βββ common/ # Shared OAuth services
β β βββ registry/ # Node registration system
β β
β βββ common/ # Shared utilities and schemas
β β βββ src/index.ts # Zod schemas, constants
β β
β βββ ui/ # Shared UI component library
β β βββ src/components/ # Reusable React components
β β
β βββ eslint-config/ # Shared ESLint configurations
β βββ typescript-config/ # Shared TypeScript configurations
β
βββ turbo.json # Turborepo configuration
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ package.json # Root package.json
- User: User accounts with email/password authentication
- Credential: OAuth tokens and API keys per integration type
- Workflow: Main workflow definition with status tracking
- Trigger: Workflow trigger configuration (one per workflow)
- AvailableTrigger: Registry of available trigger types
- Node: Individual action nodes in a workflow
- AvailableNode: Registry of available node types
- WorkflowExecution: Tracks entire workflow runs
- NodeExecution: Tracks individual node executions with retry logic
- WorkflowExecutionTable: Transaction outbox pattern implementation
enum WorkflowStatus {
Start // Initial state
Pending // Queued for execution
InProgress // Currently executing
ReConnecting // Retrying connection
Failed // Execution failed
Completed // Successfully completed
}- User β Workflows (1:N)
- Workflow β Trigger (1:1)
- Workflow β Nodes (1:N)
- WorkflowExecution β NodeExecution (1:N)
- Node β Credential (N:1, optional)
- Node.js: >=20
- pnpm: 10.26.2
- PostgreSQL: Running instance
- Apache Kafka: Running broker (default: localhost:9092)
-
Clone the repository
git clone <repository-url> cd BuildFlow
-
Install dependencies
pnpm install
-
Set up environment variables
Create
.envfiles in respective directories:Root
.env:DATABASE_URL="postgresql://user:password@localhost:5432/buildflow" NEXTAUTH_SECRET="your-secret-key" NEXTAUTH_URL="http://localhost:3000" GOOGLE_CLIENT_ID="your-google-client-id" GOOGLE_CLIENT_SECRET="your-google-client-secret"
Kafka Configuration (for processor/worker):
KAFKA_BROKERS="localhost:9092" KAFKA_CLIENT_ID="buildflow-client"
-
Set up the database
cd packages/db pnpm prisma generate pnpm prisma migrate dev -
Start Kafka (if not already running)
# Using Docker docker run -p 9092:9092 apache/kafka:latest
# Start all services in development mode
pnpm devThis will start:
- Web app:
http://localhost:3000 - HTTP Backend:
http://localhost:3002 - Hooks API:
http://localhost:3002(same server) - Processor: Background service
- Worker: Background service
# Web application only
cd apps/web && pnpm dev
# HTTP Backend only
cd apps/http-backend && pnpm dev
# Processor only
cd apps/processor && pnpm dev
# Worker only
cd apps/worker && pnpm dev
# Hooks service only
cd apps/hooks && pnpm dev# Build all packages
pnpm build
# Build specific package
cd apps/web && pnpm buildBuildFlow uses Turborepo for monorepo orchestration and pnpm workspaces for dependency management.
pnpm dev- Start all services in development modepnpm build- Build all packagespnpm lint- Lint all packagespnpm format- Format code with Prettier
@repo/db- Database client@repo/nodes- Node registry and executors@repo/common- Shared utilities@workspace/ui- UI component library@workspace/eslint-config- ESLint configurations@workspace/typescript-config- TypeScript configurations
- Create node definition in
packages/nodes/src/[node-name]/ - Implement executor class extending base executor
- Register node in
NodeRegistry.registerAll() - Node will be automatically available in the UI
Example:
// packages/nodes/src/my-node/my-node.node.ts
export class MyNode {
static async register() {
await NodeRegistry.register({
name: "My Node",
type: "my-node",
description: "Does something",
config: {},
requireAuth: false,
});
}
}- Port: 3002
- Purpose: Main API server for web app
- Routes:
/user/*- User management, authentication/node/*- Node operations/google/*- Google OAuth callbacks
- Features: CORS enabled, cookie-based auth, Node registry initialization
- Port: 3002 (shared with HTTP Backend)
- Purpose: Receives external webhook triggers
- Endpoint:
POST /hooks/catch/:userId/:workflowId - Pattern: Transaction Outbox - creates workflow execution atomically
- Purpose: Kafka producer
- Function: Polls
WorkflowExecutionTable(outbox), publishes to Kafka - Topic:
First-Client - Pattern: Transaction Outbox Pattern implementation
- Purpose: Kafka consumer and workflow executor
- Function: Consumes messages, executes workflow nodes sequentially
- Group ID:
test-group - Features: Manual offset commits, error handling
- Drag-and-drop interface using React Flow
- Real-time workflow visualization
- Node configuration panels
- Trigger and action node types
- Dynamic node registration
- Pluggable architecture
- OAuth credential management per node
- Node metadata (name, type, description, auth requirements)
- Transaction Outbox Pattern for reliable event publishing
- Kafka-based message queue
- Asynchronous workflow execution
- Guaranteed delivery semantics
- Workflow-level execution tracking
- Node-level execution tracking
- Retry logic with configurable attempts
- Status monitoring (Start, Pending, InProgress, Failed, Completed)
- Input/output data capture
- Error logging and debugging
- NextAuth.js integration
- OAuth 2.0 support (Google)
- Per-node credential storage
- Secure credential management
- OAuth-based authentication
- Read/write operations
- Sheet and tab management
- Token refresh handling
- Database schema design
- Microservices architecture
- Event-driven execution system
- Transaction Outbox Pattern
- Node registry system
- Google Sheets integration
- Visual workflow editor (basic)
- User authentication
- Enhanced visual workflow editor
- Real-time execution dashboard
- Improved error handling and debugging
- Slack integration
- Webhook triggers
- Email integration
- Database integration nodes
- Conditional logic nodes
- Workflow templates
- Team collaboration features
- Workflow versioning
- Advanced retry strategies
- Webhook authentication
- API rate limiting
- Workflow scheduling (cron)
- Workflow testing/debugging tools
Ensures reliable event publishing by storing workflow executions in a database table (WorkflowExecutionTable) before publishing to Kafka. The processor service polls this table and publishes events, ensuring no events are lost even if Kafka is temporarily unavailable.
- Workflow execution created with status
Start - Nodes executed sequentially based on
positionfield - Each node execution tracked with:
- Input/output data (JSON)
- Execution timestamps
- Retry count
- Error messages
- Status updated through lifecycle:
StartβPendingβInProgressβCompleted/Failed
- User initiates OAuth flow from UI
- Redirected to Google OAuth consent screen
- Callback handled at
/google/callback - Tokens stored in
Credentialtable with encryption - Tokens refreshed automatically when expired
Start β Pending β InProgress β Completed
β
Failed β ReConnecting β InProgress
See CONTRIBUTING.md for guidelines on:
- Branch naming conventions
- Pull request process
- Code review requirements
- Issue reporting
[MIT license]
- [Vamsi , Teja]
Built with β€οΈ using Next.js, Express, Kafka, and PostgreSQL