All posts
April 18, 2026 6 min read

Building a Production-Ready Flowchart Canvas from Scratch

engineering react-flow canvas

The heart of FreeFlowCharts is the canvas — the infinite, zoomable, pannable workspace where you drag nodes around and connect them with edges. Here's how we built it.

Why React Flow

We evaluated several options: Konva, D3, Cytoscape, and React Flow. React Flow won because:

  • It's React-native (no DOM hacking)
  • Built-in support for custom node types, edge types, handles, and minimap
  • Excellent performance even with 100+ nodes
  • Active community and good docs
  • Custom node types

    We built 20+ custom node types, each with its own visual style:

  • Standard: Start (green), End (red), Process (blue), Decision (orange diamond), Input/Output (purple), Delay (gray), Subprocess (teal)
  • Team actions: Task, Bug, Email, Meeting, Approval — each with contextual icons and colors
  • Annotations: Sticky notes, text labels, swimlanes for organization
  • Project: Approval gates, deadlines, milestones, handoffs, cost nodes
  • Each node has a rich properties panel where you can set descriptions, assignees, due dates, costs, and approval statuses.

    Auto-layout with dagre

    When you generate a flow from AI or import a template, we run the dagre graph layout algorithm to automatically position nodes in a clean, readable hierarchy. This prevents the spaghetti problem that plagues most flowchart tools.

    Version history

    Every save creates a snapshot. You can browse previous versions and restore any point in time. We store the full canvas state (nodes, edges, zoom, pan) as a Firestore document.

    Performance

    The biggest challenge was keeping the canvas responsive with lots of nodes. Key optimizations:

  • Memoized node components with React.memo
  • Debounced auto-save (2 seconds after last change)
  • Virtualized node rendering via React Flow's built-in viewport culling
  • Lazy loading of node properties panel
  • The result is a canvas that feels snappy even with 50+ nodes and complex edge routing.