|
| 1 | +# flowkit |
| 2 | + |
| 3 | +A **common, abstract, portable, configurable visual-builder UI kit** for React — |
| 4 | +the canvas UX extracted from [Flowise](https://github.com/FlowiseAI/Flowise)'s |
| 5 | +Agentflow builder and generalized so other products (BPMN builders, data-pipeline |
| 6 | +studios, automation designers, …) can stand up the same polished node-editor |
| 7 | +experience with a single config object. |
| 8 | + |
| 9 | +## Layers |
| 10 | + |
| 11 | +``` |
| 12 | +┌──────────────────────────────────────────────────────────────┐ |
| 13 | +│ Your app — supplies ONE config object: │ |
| 14 | +│ registry, rules, renderers, persistence, slots │ |
| 15 | +├──────────────────────────────────────────────────────────────┤ |
| 16 | +│ @flowkit/flow-builder — the canvas kit │ |
| 17 | +│ FlowBuilderCanvas · NodePalette · SchemaFields │ |
| 18 | +│ PropertyInspectorDialog · BuilderNode/Edge · GroupNode │ |
| 19 | +│ FlowBuilderProvider (graph CRUD, dirty state, selection) │ |
| 20 | +├──────────────────────────────────────────────────────────────┤ |
| 21 | +│ @flowkit/ui-foundation — the design system │ |
| 22 | +│ theme factory (light/dark) · MainCard · buttons · inputs │ |
| 23 | +│ Dropdown/AsyncDropdown · CodeEditor · JsonEditor · DataGrid │ |
| 24 | +│ ConfirmDialog · Loader · hooks · utils │ |
| 25 | +└──────────────────────────────────────────────────────────────┘ |
| 26 | +``` |
| 27 | + |
| 28 | +The kit never imports an API client, a store, or a domain constant — everything |
| 29 | +domain-specific is injected through `FlowBuilderConfig`. |
| 30 | + |
| 31 | +## Quick start |
| 32 | + |
| 33 | +```tsx |
| 34 | +import { FlowBuilderProvider, FlowBuilderCanvas, typedPortsIsValidConnection } from '@flowkit/flow-builder' |
| 35 | +import { FlowkitThemeProvider } from '@flowkit/ui-foundation' |
| 36 | +import '@flowkit/flow-builder/styles.css' |
| 37 | + |
| 38 | +const operators = [ |
| 39 | + { |
| 40 | + name: 'httpSource', |
| 41 | + label: 'HTTP Source', |
| 42 | + category: 'Sources', |
| 43 | + color: '#7C3AED', |
| 44 | + baseClasses: ['Record[]'], |
| 45 | + inputs: [{ label: 'URL', name: 'url', type: 'string' }] |
| 46 | + } |
| 47 | + // …transforms and sinks |
| 48 | +] |
| 49 | + |
| 50 | +const config = { |
| 51 | + registry: { list: async () => operators }, |
| 52 | + isValidConnection: typedPortsIsValidConnection, // typed ports |
| 53 | + outputStrategy: 'standard', |
| 54 | + onSave: (doc) => localStorage.setItem('my-flow', JSON.stringify(doc)) |
| 55 | +} |
| 56 | + |
| 57 | +export const Studio = () => ( |
| 58 | + <FlowkitThemeProvider> |
| 59 | + <FlowBuilderProvider config={config}> |
| 60 | + <FlowBuilderCanvas /> |
| 61 | + </FlowBuilderProvider> |
| 62 | + </FlowkitThemeProvider> |
| 63 | +) |
| 64 | +``` |
| 65 | + |
| 66 | +A complete data-pipeline studio (typed ports, schema-driven property forms, |
| 67 | +palette search, minimap, dark mode, save/load) is ~100 lines of config. |
| 68 | + |
| 69 | +## What's configurable |
| 70 | + |
| 71 | +| Area | Config hook | Default | |
| 72 | +| --- | --- | --- | |
| 73 | +| Node source | `registry: NodeRegistryAdapter` | — (required) | |
| 74 | +| Form fields | `fieldRenderers` (by type or `node:param`) | 17 built-in renderers | |
| 75 | +| Node/edge look | `nodeRenderers`, `edgeRenderers` | v2-Agentflow-style cards & gradient edges | |
| 76 | +| Connection rules | `isValidConnection` | no self-loops, no cycles | |
| 77 | +| Typed ports | — | compose `typedPortsIsValidConnection` | |
| 78 | +| Drop rules | `validateDrop` (singletons, group rules) | allow all | |
| 79 | +| On-connect side effects | `onConnectInput` (e.g. Flowise `{{ref}}`) | none | |
| 80 | +| Serialization | `serialize` / `deserialize` | React Flow `toObject()` | |
| 81 | +| Persistence | `onSave`, `initialFlow` | — | |
| 82 | +| Colors | `resolveNodeColor`, `connectionLineColor` | `data.color`, theme primary | |
| 83 | +| Node extras | `renderNodeSummary`, `onNodeInfo`, `resolveNodeWarning`, `canDuplicateNode` | off | |
| 84 | +| Features | `features.{minimap,stickyNote,groupNodes,snapping,backgroundDots,palette,readOnly}` | on | |
| 85 | +| Slots | `slots.{header,floatingActions}` | — | |
| 86 | + |
| 87 | +## Documentation |
| 88 | + |
| 89 | +Full technical docs in [`docs/`](docs) (AsciiDoc): |
| 90 | + |
| 91 | +- [Architecture & mental model](docs/architecture.adoc) — layers, data flow, state ownership, the three core conventions |
| 92 | +- [Graph node model spec](docs/node-model.adoc) — schemas, params, anchors, handle-id grammar, visibility engine, edges, FlowDocument |
| 93 | +- [Backend API spec](docs/backend-api-spec.adoc) — node registry, icons, async options, persistence, concurrency |
| 94 | +- [Configuration reference](docs/configuration.adoc) — `FlowBuilderConfig`, features, slots, theming, context API |
| 95 | +- [Extending flowkit](docs/extending.adoc) — registries, field/node/edge renderers, connection rules, serializers, walkthroughs |
| 96 | + |
| 97 | +## Repo layout |
| 98 | + |
| 99 | +``` |
| 100 | +packages/ |
| 101 | + ui-foundation/ @flowkit/ui-foundation — theme, generic components, hooks, utils |
| 102 | + flow-builder/ @flowkit/flow-builder — the visual builder kit |
| 103 | +examples/ |
| 104 | + playground/ two demos on one kit: data-pipeline studio + BPMN builder |
| 105 | +``` |
| 106 | + |
| 107 | +## Develop |
| 108 | + |
| 109 | +```bash |
| 110 | +pnpm install |
| 111 | +pnpm -r build # build packages (topological order) |
| 112 | +pnpm -r test # unit tests (utils, search, visibility, graph, handles) |
| 113 | +pnpm --filter flowkit-playground dev # run the demos on :5174 |
| 114 | +``` |
| 115 | + |
| 116 | +## Status & roadmap |
| 117 | + |
| 118 | +- [x] ui-foundation: theme factory + controlled/uncontrolled dark mode |
| 119 | +- [x] flow-builder: canvas, palette, schema-driven forms, group nodes, sticky notes |
| 120 | +- [x] playground demos (data-pipeline, BPMN) |
| 121 | +- [ ] Flowise v2 Agentflow canvas running on the kit (adapter in the Flowise repo) |
| 122 | +- [ ] v1 chatflow-style inline params on node bodies (`nodeEditMode: 'inline'`) |
| 123 | +- [ ] Undo/redo, multi-select sub-graph copy/paste, alignment guides |
| 124 | + |
| 125 | +License: Apache-2.0. Extracted with care from Flowise (Apache-2.0). |
0 commit comments