Skip to content

Examples ​

A guided ladder from the smallest possible workflow to full, real-world ones. Each page renders a complete, runnable script (the code is imported directly from flowyd/examples/, so it never drifts from what actually runs). Read them in order — every example assumes the ones before it.

#ExampleTierKey features
01Document Approval (Basics)BasicsActions, steps, the graph, dispatch, blocked results, Mermaid
02Guards & ContextFeatureTyped context, every guard flavour, routing by guard, canExecute
03Parallel Work (Fork/Join)FeatureFork/join, join modes (all/any/quorum), auto-complete
04Deadlines, Hooks & WaitingFeatureafter deadlines, tick/getNextDueAt, hooks, wait states
05Loan OriginationFullEverything together, service-style: snapshot/restore, rewind, exporters
06Incident ResponseFullRole guards, SLAs (incl. a deadline from a waiting state), dashboards
07Dynamic WorkflowFullcreateDynamicWorkflow: compiling workflows from runtime config

Running the examples ​

The code on each page is ready to paste into a project that has flowyd installed (pnpm add flowyd zod).

To run the examples themselves, get them from the GitHub repository:

sh
git clone https://github.com/zihung20/flowyd.git
cd flowyd && pnpm install
npx tsx examples/01-document-approval-basics.ts

The examples/ directory also has a README with a full feature-coverage map.

Released under the MIT License.