
React Flow Architecture
Decide whether React Flow fits your product and how to structure node-based UI state before you implement a workflow or diagram editor.
Overview
React Flow Architecture is an agent skill most often used in Build (also Validate) that guides node-based UI design, scale strategy, and React Flow integration before you commit to implementation.
Install
npx skills add https://github.com/existential-birds/beagle --skill react-flow-architectureWhat is this skill?
- Fit checklist: visual programming, workflow builders, diagrams, pipelines, mind maps, node editors—and when to use SVG,
- 3-gate decision workflow: name interactions map to callbacks, classify scale against node-count guidelines, place state
- Explicit pass criteria per gate (e.g. onNodesChange, onConnect) so agents do not skip architecture on prototypes
- Node count guidelines table tying peak nodes to rendering strategies such as onlyRenderVisibleElements
- Calls out poor fits: static diagrams only, heavy realtime collab without sync layer, 10k+ graph analysis
- 3-step decision workflow with explicit pass gates before locking the stack
- Node count guidelines section with scale-dependent rendering strategies
Adoption & trust: 1 installs on skills.sh; 62 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You want a draggable node editor but are unsure if React Flow fits your scale, interactions, and state model.
Who is it for?
Solo builders shipping workflow builders, diagram editors, or visual automation UIs in React who need gates before coding.
Skip if: Simple static diagrams, 3D-only scenes, or 10k+ node graph analytics where WebGL tools like Sigma.js are the documented alternative.
When should I use this skill?
Designing flow-based applications, making decisions about state management or integration patterns, or evaluating whether React Flow fits a use case.
What do I get? / Deliverables
You lock fit, interaction-to-callback mapping, node-count strategy, and state placement so implementation follows a reviewed architecture instead of ad-hoc spikes.
- Documented fit decision (React Flow vs alternatives)
- Interaction-to-callback mapping and state placement plan
- Scale strategy aligned to node-count guidelines
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Build because the skill governs frontend architecture for interactive node graphs, not market research or launch SEO. Frontend is the right subphase for React Flow callbacks, rendering strategy, and integration patterns in the browser.
Where it fits
Decide if a clickable flow mock warrants React Flow versus a static SVG before building the MVP.
Map drag, connect, and delete actions to onNodesChange and onConnect before sprinting UI stories.
Re-check node-count guidelines when users report sluggish canvases after feature growth.
How it compares
Architecture and fit gates for React Flow—not a generic "use a chart library" chat answer or a dump of example nodes without scale strategy.
Common Questions / FAQ
Who is react-flow-architecture for?
Indie developers and agent users building React apps with nodes and edges who need decision support before investing in React Flow.
When should I use react-flow-architecture?
In Validate when prototyping a flow UI; in Build when designing state management and integrations; in Ship when revisiting perf after node counts grow.
Is react-flow-architecture safe to install?
It is documentation-only architectural guidance with no runtime hooks; still review the Security Audits panel on this Prism page for the parent repo.
SKILL.md
READMESKILL.md - React Flow Architecture
# React Flow Architecture ## When to Use React Flow ### Good Fit - Visual programming interfaces - Workflow builders and automation tools - Diagram editors (flowcharts, org charts) - Data pipeline visualization - Mind mapping tools - Node-based audio/video editors - Decision tree builders - State machine designers ### Consider Alternatives - Simple static diagrams (use SVG or canvas directly) - Heavy real-time collaboration (may need custom sync layer) - 3D visualizations (use Three.js, react-three-fiber) - Graph analysis with 10k+ nodes (use WebGL-based solutions like Sigma.js) ### Decision workflow (gates) Run this sequence before locking the stack or sprinting implementation. Skip only for throwaway prototypes. 1. **Name the interactions** — List the top user actions (e.g. drag, connect, delete, group). **Pass:** Each action maps to a concrete React Flow callback you will implement (`onNodesChange`, `onConnect`, …). 2. **Classify scale** — Estimate peak nodes (visible canvas or document total). **Pass:** Your range matches a row in [Node Count Guidelines](#node-count-guidelines) and you accept the listed strategy (e.g. `onlyRenderVisibleElements` when that row implies it). 3. **Place state** — Choose local hooks, an external store, or Redux/other. **Pass:** One sentence states where persistence, undo, or cross-surface sync will live, or explicitly “not needed yet.” 4. **Re-check alternatives** — If the use case matches [Consider Alternatives](#consider-alternatives), **Pass:** One sentence explains why React Flow still fits or which listed alternative you chose instead. ## Architecture Patterns ### Package Structure (xyflow) ``` @xyflow/system (vanilla TypeScript) ├── Core algorithms (edge paths, bounds, viewport) ├── xypanzoom (d3-based pan/zoom) ├── xydrag, xyhandle, xyminimap, xyresizer └── Shared types @xyflow/react (depends on @xyflow/system) ├── React components and hooks ├── Zustand store for state management └── Framework-specific integrations @xyflow/svelte (depends on @xyflow/system) └── Svelte components and stores ``` **Implication**: Core logic is framework-agnostic. When contributing or debugging, check if issue is in @xyflow/system or framework-specific package. ### State Management Approaches #### 1. Local State (Simple Apps) ```tsx // useNodesState/useEdgesState for prototyping const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); ``` **Pros**: Simple, minimal boilerplate **Cons**: State isolated to component tree #### 2. External Store (Production) ```tsx // Zustand store example import { create } from 'zustand'; interface FlowStore { nodes: Node[]; edges: Edge[]; setNodes: (nodes: Node[]) => void; onNodesChange: OnNodesChange; } const useFlowStore = create<FlowStore>((set, get) => ({ nodes: initialNodes, edges: initialEdges, setNodes: (nodes) => set({ nodes }), onNodesChange: (changes) => { set({ nodes: applyNodeChanges(changes, get().nodes) }); }, })); // In component function Flow() { const { nodes, edges, onNodesChange } = useFlowStore(); return <ReactFlow nodes={nodes} onNodesChange={onNodesChange} />; } ``` **Pros**: State accessible anywhere, easier persistence/sync **Cons**: More setup, need careful selector optimization #### 3. Redux/Other State Libraries ```tsx // Connect via selectors const nodes = useSelector(selectNodes); const dispatch = useDispatch(); const onNodesChange = useCallback((changes: NodeChange[]) => { dispatch(nodesChanged(changes)); }, [dispatch]); ``` ### Data Flow Architecture ``` User Input → Change Event → Reducer/Handler → State Update → Re-render ↓ [Dra