Files
metabuilder/workflowui/START_GUIDE.md
johndoe6345789 dc982772af refactor(workflowui): complete monolithic file refactoring + business logic extraction + stub implementation
## Phase 1: Monolithic File Refactoring 
- Refactored 8 large files (300-500 LOC) into 40+ modular components/hooks
- All files now <150 LOC per file (max 125 LOC)
- CanvasSettings: 343 → 7 components
- SecuritySettings: 273 → 6 components
- NotificationSettings: 239 → 6 components
- Editor/Toolbar: 258 → 7 components
- InfiniteCanvas: 239 → 10 modules
- WorkflowCard: 320 → 5 components + custom hook
- useProjectCanvas: 322 → 8 hooks
- projectSlice: 335 → 4 Redux slices

## Phase 2: Business Logic Extraction 
- Extracted logic from 5 components into 8 custom hooks
- register/page.tsx: 235 → 167 LOC (-29%)
- login/page.tsx: 137 → 100 LOC (-27%)
- MainLayout.tsx: 216 → 185 LOC (-14%)
- ProjectSidebar.tsx: 200 → 200 LOC (refactored)
- page.tsx (Dashboard): 197 → 171 LOC (-13%)
- New hooks: useAuthForm, usePasswordValidation, useLoginLogic, useRegisterLogic, useHeaderLogic, useResponsiveSidebar, useProjectSidebarLogic, useDashboardLogic

## Phase 3: Dead Code Analysis & Implementation 
- Identified and documented 3 unused hooks (244 LOC)
- Removed useRealtimeService from exports
- Cleaned 8 commented lines in useProject.ts
- Documented useExecution stub methods
- Removed 3 commented dispatch calls in useCanvasKeyboard
- Fixed 3 'as any' type assertions

## Phase 4: Stub Code Implementation 
- Fully implemented useExecution methods: execute(), stop(), getDetails(), getStats(), getHistory()
- Integrated useCanvasKeyboard into InfiniteCanvas with Redux dispatch
- Verified useCanvasVirtualization for 100+ items
- Enhanced useRealtimeService documentation for Phase 4 WebSocket integration

## Backend Updates
- Added SQLAlchemy models: Workspace, Project, ProjectCanvasItem
- Added Flask API endpoints for CRUD operations
- Configured multi-tenant filtering for all queries
- Added database migrations for new entities

## Build Verification 
- TypeScript strict mode: 0 errors
- Production build:  Successful (161 kB First Load JS)
- No breaking changes
- 100% backward compatibility maintained

## Documentation Generated
- 6 comprehensive guides (70+ KB total)
- Test templates for all new implementations
- Quick reference for all 42 hooks
- Implementation checklist and deployment guide

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 06:44:57 +00:00

6.1 KiB

WorkflowUI - Getting Started

Quick Start

1. Start the Development Server

cd /Users/rmac/Documents/metabuilder/workflowui
npm run dev

The server will start on http://localhost:3005 (or the next available port).

2. Open in Browser

Navigate to: http://localhost:3005


Features Available

Dashboard

  • View all workflows
  • Create new workflows
  • Quick actions (edit, delete, duplicate)

Workflow Editor (React Flow)

  • Drag-and-drop nodes
  • Connect workflow steps
  • Configure node properties
  • Real-time preview

Project Canvas (NEW - Uses Fakemui!)

  • Infinite canvas with workflow cards
  • Drag-and-drop card positioning
  • Zoom in/out controls
  • Material Design 3 interface
  • Responsive grid layout

Built-in Workflows

The system comes with example workflows:

  • User Authentication Flow
  • Data Processing Pipeline
  • Email Notification System
  • Payment Processing

Key Endpoints

Route Purpose
/ Dashboard - view all workflows
/editor/:workflowId Workflow editor (React Flow)
/project/:projectId Project canvas (infinite canvas with cards)
/workspace Workspace selector

Technology Stack

  • Frontend: Next.js 14.2, React 18, TypeScript
  • UI Components: Fakemui (Material Design 3)
  • State Management: Redux + Custom Hooks
  • Data: IndexedDB (offline-first) + Backend API
  • Workflow Engine: Multi-language execution (TS, Python, Go, Rust, etc.)

Project Structure

workflowui/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── page.tsx            # Dashboard
│   │   ├── editor/[id]/        # Workflow editor
│   │   ├── project/[id]/       # Project canvas (NEW)
│   │   └── layout.tsx          # Root layout
│   ├── components/             # React components
│   ├── hooks/                  # Custom hooks
│   ├── services/               # API clients
│   ├── store/                  # Redux slices + middleware
│   ├── db/                     # IndexedDB schema
│   └── types/                  # TypeScript types
├── backend/                    # Flask API server
│   ├── server_sqlalchemy.py    # Main server
│   ├── models.py               # Database models
│   └── workflows/              # Workflow definitions
├── Dockerfile                  # Docker configuration
└── package.json

Creating Your First Workflow

  1. Click "Create Workflow" on the dashboard
  2. Enter workflow name (e.g., "My AI Pipeline")
  3. Click "Create"
  4. You're now in the workflow editor!

In the Workflow Editor:

  • Drag nodes from the left panel onto the canvas
  • Connect nodes by dragging from output → input ports
  • Click nodes to configure parameters
  • Click "Save" to persist your workflow

Available Node Types

Control Flow

  • Trigger (start workflow)
  • If/Then/Else (conditional branching)
  • Loop (iterate over items)
  • Wait (delay execution)

Data Operations

  • Filter (filter arrays)
  • Map (transform items)
  • Reduce (aggregate data)
  • Merge (combine datasets)

AI/ML

  • ChatGPT (call Claude/GPT APIs)
  • Image Generation (DALL-E, Midjourney)
  • Embedding (vector embeddings)
  • Classification (categorize data)

External Services

  • HTTP Request (call APIs)
  • Database (SQL queries)
  • File Operations (read/write files)
  • Email (send messages)

Running Workflows

  1. Open a workflow in the editor
  2. Click "Execute" button in the top toolbar
  3. Provide input values if the workflow has parameters
  4. Watch the execution in real-time
  5. View results in the output panel

Exporting & Importing

Export Workflow as JSON

# Click the "Export" button in the workflow editor
# This downloads the workflow as a .json file

Import Workflow from JSON

# Drag a .json file onto the import zone
# Or click "Import" and select the file

Using with Docker

Build the Docker image:

docker build -t metabuilder-workflowui:latest .

Run the container:

docker run -p 3000:3000 \
  -e NEXT_PUBLIC_API_URL=http://localhost:5000 \
  metabuilder-workflowui:latest

Automating AI Workflows

Example: Content Generation Pipeline

  1. Trigger: Webhook or scheduled time
  2. Input: Topic, style, length
  3. Process:
    • Call Claude API to generate content
    • Call image generation API for graphics
    • Format output as Markdown
  4. Output: Send to email, save to file, or publish

Example: Data Analysis Pipeline

  1. Trigger: New data file uploaded
  2. Process:
    • Load CSV file
    • Filter by criteria
    • Calculate statistics
    • Generate visualizations
  3. Output: Send report via email

Example: Workflow Orchestration

  1. Trigger: Main workflow starts
  2. Process:
    • Run multiple AI workflows in parallel
    • Combine results
    • Apply business logic
  3. Output: Save to database or trigger other workflows

Troubleshooting

Port Already in Use

# Kill existing process
lsof -i :3005
kill -9 <PID>

# Or try a different port
PORT=3010 npm run dev

Database Errors

# Clear IndexedDB cache (in browser DevTools)
# Application > Storage > IndexedDB > Clear All

Build Errors

# Clear Next.js cache
rm -rf .next
npm run dev

Next Steps

  1. Start the dev server: npm run dev
  2. Open http://localhost:3005 in browser
  3. Create your first workflow
  4. Add nodes and connect them
  5. Test execution
  6. Save and export

Documentation

  • Fakemui Components: See /fakemui/COMPONENT_GUIDE.md
  • Migration Summary: See /fakemui/MIGRATION_SUMMARY.md
  • Architecture: See CLAUDE.md in root
  • Workflow Engine: See /workflow/README.md

Support

For issues or questions:

  1. Check the logs: npm run dev (shows errors in real-time)
  2. Check browser console: F12 → Console tab
  3. Check Network tab: F12 → Network to see API calls
  4. Review workflow definitions: /workflow/examples/

Happy workflow automation! 🚀