Flow Engine

Framework-agnostic TypeScript library for building execution flow graphs

Zero Dependencies

Pure TypeScript with no runtime dependencies. Lightweight and fast with minimal bundle size.

🎯

Framework Agnostic

Works seamlessly with React, Vue, Angular, or vanilla JS. Use it anywhere.

🔒

Fully Typed

Complete TypeScript support with exported types. Catch errors at compile time.

🎨

Minimal API

Three core functions, essential types. No bloat, just what you need.

📊

Visual States

Compute node and edge states during execution for easy visualization.

Graph Validation

Built-in validation ensures your flow graphs are structurally sound.

Quick Example

import { buildGraphFromTraces, computeVisualState } from '@majdibo/flow-engine';

// Build a graph from execution traces
const traces = [
  { step: 'start', nodeType: 'action', data: {}, timestamp: Date.now() },
  { step: 'process', nodeType: 'action', data: {}, timestamp: Date.now() },
  { step: 'end', nodeType: 'action', data: {}, timestamp: Date.now() }
];

const graph = buildGraphFromTraces(traces);

// Compute visual state at any timeline position
const timeline = traces.map(t => t.step);
const visualState = computeVisualState(graph, timeline, 1);

console.log(visualState.nodeStates);
// { start: 'traversed', process: 'current', end: 'untraversed' }

Get Started

Install via npm or yarn

npm install @majdibo/flow-engine