This document explains the two different frontend implementations for the workflow visualizer and when to use each.
There are two versions of the workflow visualizer:
Location: /frontend/ directory
cd frontend npm install npm run dev # Visit http://localhost:3000
The frontend expects the API server to be running separately on port 8000.
frontend/
βββ src/
β βββ App.tsx # Main app with sidebar
β βββ components/
β β βββ WorkflowVisualizer.tsx # ReactFlow canvas
β β βββ StepNode.tsx # Custom step node component
β βββ types.ts # TypeScript interfaces
β βββ *.css # Component styles
βββ index.html
βββ package.json
Location: examples/api-server-example.http.ts (embedded)
For Val Town:
Simply copy the contents of examples/api-server-example.http.ts to a Val Town HTTP val. Everything (API + frontend) is included in a single file.
For Local Development: Run the local server version for testing without deploying:
deno run --allow-all examples/api-server-example-local.ts # Open http://localhost:8000
This gives you the same embedded visualizer but running locally on port 8000.
api-server-example.http.ts # Val Town deployment version
api-server-example-local.ts # Local development version
βββ Workflow definitions
βββ Hono API routes
βββ Embedded HTML with:
βββ <style> - Inline CSS
βββ <script type="importmap"> - React imports
βββ <script type="module"> - React app code
# Only difference between files:
# .http.ts β exports app.fetch
# -local.ts β calls Deno.serve()
| Feature | ReactFlow Frontend | Val Town Frontend |
|---|---|---|
| Interactive Canvas | β Drag/zoom/pan | β Static layout |
| Node Visualization | β Custom nodes with ReactFlow | β οΈ Simple list items |
| Edge Animation | β Animated connections | β No edges shown |
| MiniMap | β Navigation aid | β Not applicable |
| Build Required | β Yes (Vite) | β No |
| Dependencies | ~15 npm packages | 0 (CDN only) |
| File Size | ~2MB bundled | ~20KB inline |
| Load Time | ~1-2s initial | ~300ms |
| Theme | Light | Dark |
| Step Output Display | β Collapsible | β Inline |
| Auto-refresh | β Yes | β Yes |
| Mobile Friendly | β οΈ Touch gestures | β Responsive |
| Setup Complexity | High | None |
| Val Town Compatible | β No | β Yes |
Both frontends consume the same API endpoints:
GET /api/workflows # List all workflows
GET /api/workflows/:id # Get workflow details
GET /api/workflows/:id/runs # List runs for workflow
POST /api/workflows/:id/runs # Create new run
GET /api/runs/:runId # Get run details
Data Format:
interface WorkflowData {
id: string
description?: string
steps: { id: string; description?: string }[]
exampleInput?: Record<string, unknown>
}
interface WorkflowRunData {
runId: string
workflowId: string
status: 'running' | 'success' | 'failed'
executionPath: number[]
stepResults: Record<string, StepResult>
inputData: unknown
result?: unknown
error?: string
createdAt: number
updatedAt: number
}
This means you can:
To test the Val Town-style embedded visualizer without deploying:
deno run --allow-all examples/api-server-example-local.ts # Open http://localhost:8000
cd frontend && npm installdeno run --allow-all examples/api-server-example-local.tsnpm run dev (in a separate terminal)Both frontends can run simultaneously (different ports).
examples/api-server-example.http.ts to Val TownBoth frontends serve different purposes:
Choose based on your deployment target and feature requirements. The shared API ensures you're never locked into one approach.