Skip to content

Quick Start

Get a self-documenting pipeline running in 3 steps.

npm install footprintjs
pnpm add footprintjs
yarn add footprintjs
interface OrderState {
orderId: string;
total: number;
status?: string;
}
import { flowChart } from 'footprintjs';
const chart = flowChart<OrderState>('ValidateOrder', async (scope) => {
scope.status = scope.total > 0 ? 'valid' : 'invalid';
}, 'validate')
.addFunction('ProcessPayment', async (scope) => {
scope.status = 'paid';
}, 'process')
.build();
import { narrative } from 'footprintjs';
const rec = narrative();
await chart.recorder(rec).run({ input: { orderId: 'ORD-001', total: 49.99 } });
console.log(rec.lines().join('\n'));
// Stage 1: The process began with ValidateOrder.
// Step 1: Write status = "valid"
// Stage 2: Next, it moved on to ProcessPayment.
// Step 1: Write status = "paid"