ExFlowGraph

Interactive flow graph component library for Phoenix LiveView

Build powerful, interactive workflow editors and visual node-based interfaces in your Phoenix LiveView applications.

PhoenixLiveViewElixirHex.pmHex DocsHex.pm DownloadsLicenseBuild StatusCoverage Status

Screenshot 2026-02-01 at 22 15 47

Features

Interactive Canvas

Graph Management

LiveView Native

Developer Friendly


Quick Start

Installation

Add to your mix.exs:

def deps do
  [
    {:ex_flow_graph, "~> 0.1.0"}
  ]
end

Basic Usage

defmodule MyAppWeb.FlowLive do
  use MyAppWeb, :live_view
  alias ExFlow.Core.Graph, as: FlowGraph

  def mount(_params, _session, socket) do
    graph = FlowGraph.new()

    {:ok, graph} = FlowGraph.add_node(graph, "node-1", :task, %{
      position: %{x: 100, y: 100},
      label: "Start"
    })

    {:ok, assign(socket, graph: graph)}
  end

  def render(assigns) do
    ~H"""
    <ExFlowGraphWeb.ExFlow.Canvas.canvas
      id="my-canvas"
      nodes={prepare_nodes(@graph)}
      edges={prepare_edges(@graph)}
      selected_node_ids={MapSet.new()}
    />
    """
  end
end

See INSTALLATION.md for complete setup guide.


Documentation

Getting Started

Reference

Features

Advanced

API Reference


Demo Application

A complete, production-ready workflow editor is included in the /demo directory.

Features

Core Functionality

Advanced Features

Running the Demo

cd demo
mix deps.get
mix ecto.create  # If using database
mix phx.server

Visit http://localhost:4000


Architecture

Component Structure

ExFlowGraph/
├── lib/
│   ├── ex_flow/
│   │   ├── core/
│   │   │   └── graph.ex          # Core graph operations
│   │   ├── commands/              # Undo/redo commands
│   │   ├── storage/               # Persistence backends
│   │   └── history_manager.ex    # History management
│   └── ex_flow_graph_web/
│       └── components/
│           └── ex_flow/
│               ├── canvas.ex      # Main canvas component
│               ├── node.ex        # Node component
│               └── edge.ex        # Edge component
├── assets/
│   └── js/
│       └── hooks/
│           └── ex_flow.js         # JavaScript hook
└── demo/                          # Complete example app

Core Concepts

Graph Structure

# Nodes
%{
  id: String.t(),
  type: atom(),
  label: String.t() | nil,
  position: %{x: number(), y: number()},
  metadata: map()
}

# Edges
%{
  id: String.t(),
  source: String.t(),
  source_handle: String.t(),
  target: String.t(),
  target_handle: String.t(),
  label: String.t() | nil,
  metadata: map()
}

Keyboard Shortcuts

Action Shortcut Description
Select Node Click Single selection
Multi-select Shift/Ctrl/Cmd + Click Add to selection
Drag Node Click + Drag Move node
Create Edge Drag from handle Connect nodes
Pan Canvas Drag background Move viewport
Custom Action Option/Alt + Click Trigger custom event
Deselect All Escape Clear selection

License

MIT License


Credits

Built with:


Made for the Phoenix community