A sophisticated, production-grade HR Workflow Designer built with React, TypeScript, and advanced graph algorithms
Demo โข Features โข Installation โข Documentation โข Architecture
- Overview
- Vision & Principles
- Features
- Architecture
- Tech Stack
- Quick Start
- Project Structure
- Core Algorithms
- API Documentation
- Usage Guide
- Development Guide
- Testing
- Deployment
- Roadmap
- License
The HR Workflow Designer is a sophisticated visual workflow builder that enables HR administrators to architect, configure, and simulate complex internal workflows such as employee onboarding, leave approvals, and automated document verification. Built as a technical showcase, this platform demonstrates expertise in React architecture, advanced graph algorithms, and modular frontend design.
- Graph Theory at its Core: Real DAG (Directed Acyclic Graph) validation with cycle detection using depth-first search (DFS).
- Execution Engine: Topological sort-based simulation using Kahn's Algorithm for deterministic workflow execution paths.
- Production-Ready Prototype: MSW (Mock Service Worker) enabled in production for a functional demo, Zustand for state management, and full TypeScript coverage.
- Extensible Registry: Modular node pattern for seamless addition of new node types (Start, Task, Approval, Automated, End).
Utilizing a modular pattern for nodes and configuration forms allows for easy extension. New node types can be integrated by updating the node factory and type definitions without rewriting core canvas logic.
Moving beyond simple UI drag-and-drop to true Graph Theory application. The system enforces DAG constraints, performs reachability analysis (Forward/Backward BFS), and executes workflows using proven computer science algorithms.
A sandbox that doesn't just "show" steps but executes a logical model of the workflow, complete with conditional branching, approval thresholds, and automated action simulation.
- โ Visual Workflow Designer - Drag-and-drop interface powered by React Flow
- โ Custom Node Types - specialized Start, Task, Approval, Automated, and End nodes
- โ Auto-Layout Engine - Intelligent positioning using Dagre graph layout
- โ Undo/Redo - Full history management with state snapshots in Zustand
- โ Cycle Detection - DFS-based algorithm that traces the exact path of circular dependencies
- โ Reachability Analysis - Forward BFS from Start node and Backward BFS from End nodes to find orphans and dead-ends
- โ Workflow Health Score - Real-time weighted metric (0-100%) for structural integrity
- โ Topological Sort - Kahn's Algorithm used to determine valid linear execution order
- โ Conditional Branching - Resolves approval paths based on thresholds and edge labels
- โ Simulation Sandbox - Real-time execution timeline with collapsible detail logs
- โ Dynamic Node Forms - Context-aware configuration panels with auto-save (onBlur)
- โ JSON Import/Export - Full serialization for workflow persistence and portability
- โ Dark/Light Mode - Polished Zinc design system with theme persistence
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Presentation Layer โ
โ Designer.tsx โข WorkflowCanvas โข Node Forms โข SandboxPanel โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Business Logic Layer โ
โ graphValidator.ts โข handlers.ts (Exec Engine) โข Zustand โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data & Integration Layer โ
โ MSW browser.ts โข serializer.ts โข Dagre Layout โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Technology | Purpose |
|---|---|
| React 18 | UI framework with concurrent features |
| TypeScript | Strict type safety across the entire graph engine |
| React Flow | Node-graph visualization engine |
| Zustand | Lightweight state management with History (Undo/Redo) |
| MSW | API mocking at the network layer (Production-enabled) |
| Tailwind CSS | Premium Zinc styling system |
| Dagre | Graph layout algorithms |
# Install dependencies
npm install
# Start development server
npm run devThe application will be available at http://localhost:5173
HR-workflow/
โโโ public/ # Static assets & MSW Worker
โโโ src/
โ โโโ api/ # Mock API Layer (MSW)
โ โ โโโ browser.ts # Worker setup
โ โ โโโ handlers.ts # Simulation Engine & API Logic
โ โ โโโ mockData.ts # Initial templates
โ โโโ components/ # React Components
โ โ โโโ canvas/ # Flow canvas & layout
โ โ โโโ forms/ # Dynamic configuration forms
โ โ โโโ layout/ # Sidebar & structure
โ โ โโโ nodes/ # Custom node templates
โ โ โโโ sandbox/ # Timeline & simulation panel
โ โ โโโ sidebar/ # Node palette
โ โ โโโ ui/ # Reusable primitives
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useSimulate.ts # Simulation orchestration
โ โ โโโ useAutomations.ts # Action fetching
โ โโโ pages/ # Top-level views (Designer, Home)
โ โโโ store/ # Zustand state (workflowStore.ts)
โ โโโ types/ # Unified TS types (workflow.ts)
โ โโโ utils/ # Core Algorithms & Utilities
โ โ โโโ graphValidator.ts # DFS/BFS Validation logic
โ โ โโโ layout.ts # Dagre layout logic
โ โ โโโ nodeFactory.ts # Component registry
โ โ โโโ serializer.ts # JSON Import/Export
โ โโโ App.tsx # Routing
โ โโโ main.tsx # Entry & MSW Initialization
โ โโโ index.css # Global styles & Zinc theme
โโโ package.json
Location: src/utils/graphValidator.ts
Uses an iterative DFS with a color-coding scheme (WHITE/GRAY/BLACK) to not only detect cycles but reconstruct the exact path causing the circular dependency.
Location: src/api/handlers.ts
The execution engine determines the correct execution sequence by calculating in-degrees of all nodes and processing them via a queue-based BFS.
Location: src/utils/graphValidator.ts
- Forward BFS: Identifies nodes unreachable from the "Start" node.
- Backward BFS: Identifies nodes that can never reach an "End" node (dead-ends).
Location: src/utils/graphValidator.ts
Calculates a weighted 0-100 score based on total errors (cycles, missing starts) and warnings (orphans, dead-ends) to provide instant user feedback.
The application uses Mock Service Worker (MSW) to handle logic as if a backend were present.
Takes a WorkflowGraph and returns a SimulationResult containing:
steps: Array of execution updates with duration and status.branchDecisions: Record of which paths were taken at approval forks.executionPath: Sequential IDs of traversed nodes.
- Persistence: Integration with Supabase/PostgreSQL.
- Templates: Pre-defined onboarding patterns.
- Action Hooks: Real webhook integration (Slack/Discord notifications).
- AI Insights: Auto-suggestion for workflow optimization.
Built by Shashikumar Ezhilarasu
AI Agentic Engineering - Tredence Studio
