#reactive #flow #graph

flow-rs-leptos

Leptos framework integration for Flow-RS

2 releases

0.1.0-beta.2 Sep 22, 2025
0.1.0-beta.1 Sep 13, 2025

#75 in Visualization

Download history 86/week @ 2025-09-07 64/week @ 2025-09-14 120/week @ 2025-09-21 22/week @ 2025-09-28 10/week @ 2025-10-05

67 downloads per month

MIT/Apache

1MB
20K SLoC

Flow-RS

Rust Leptos License Tests

A high-performance, reactive flow editor built with Rust for creating interactive node-based interfaces, data flow diagrams, and visual programming environments. Framework-agnostic core with Leptos integration.

๐ŸŽฏ Current Status: Beta Release

Version: 0.1.0-beta.1 Status: โœ… Beta Release - Published to crates.io Test Coverage: 496/496 tests passing (100% pass rate) Performance: Validated with 1000+ node graphs Cross-Browser: 100% compatibility across all major browsers API Stability: Comprehensive contract tests locking down all public interfaces

โœจ Features

๐ŸŽฏ Core Capabilities

  • Interactive Node Editor: Drag-and-drop nodes with real-time position updates
  • Edge Connection System: Visual connection handles with preview and validation
  • Spatial Indexing: High-performance spatial queries with grid-based optimization
  • Multiple Layout Algorithms: Force-directed, hierarchical, and grid layouts
  • Selection System: Single and multi-selection with visual feedback
  • Viewport Management: Pan, zoom, and viewport-based rendering

๐Ÿš€ Performance

  • WASM Compilation: Runs in the browser with near-native performance
  • Efficient Rendering: Canvas2D renderer with optimized drawing operations
  • Spatial Optimization: Grid-based spatial indexing for fast node queries
  • Memory Management: Zero-copy operations where possible

๐Ÿงช Testing & Quality

  • Comprehensive Test Suite: 311/312 tests passing (99.7% pass rate)
  • API Contract Tests: 23 comprehensive tests locking down public interfaces
  • Performance Tests: Validated with 1000+ node graphs (A+ rating)
  • Cross-Browser Tests: 35/35 tests passing across 5 browsers
  • Property-Based Testing: Proptest integration for robust edge case testing
  • Mutation Testing: Automated mutation testing for code quality assurance

๐Ÿ—๏ธ Architecture

Flow-RS is built as a modular Rust workspace with the following components:

flow-rs/
โ”œโ”€โ”€ flow-core/                 # Core data structures and algorithms
โ”œโ”€โ”€ flow-leptos/               # Leptos integration and reactive components
โ”œโ”€โ”€ flow-renderer/             # Rendering backends (Canvas2D, WebGL)
โ”œโ”€โ”€ flow-wasm/                 # WASM bindings and utilities
โ””โ”€โ”€ examples/                  # Example applications and demos

Published Crates

All crates are available on crates.io:

Crate Version Description
flow-rs-core 0.1.0-beta.1 Core graph data structures, spatial indexing, layout algorithms
flow-rs-renderer 0.1.0-beta.1 Rendering implementations and visual styling
flow-rs-leptos 0.1.0-beta.1 Leptos integration and reactive components
flow-rs-wasm 0.1.0-beta.1 WebAssembly bindings and browser integration

Core Components

  • flow-rs-core: Graph data structures, spatial indexing, layout algorithms
  • flow-rs-leptos: Reactive components, event handling, state management
  • flow-rs-renderer: Rendering implementations and visual styling
  • flow-rs-wasm: WebAssembly bindings and browser integration

๐Ÿš€ Quick Start

Prerequisites

  • Rust 1.70+ with WebAssembly support
  • Node.js 18+ and pnpm (for development tools)
  • Modern browser with WebAssembly support

Installation

Add the crates to your Cargo.toml:

[dependencies]
# Core functionality
flow-rs-core = "0.1.0-beta.1"

# Rendering (choose one or more)
flow-rs-renderer = "0.1.0-beta.1"  # Canvas2D renderer
# flow-rs-renderer = { version = "0.1.0-beta.1", features = ["webgl2"] }  # WebGL2 renderer

# Framework integration
flow-rs-leptos = "0.1.0-beta.1"    # Leptos integration
flow-rs-wasm = "0.1.0-beta.1"      # WASM bindings

Option 2: From source

  1. Clone the repository:

    git clone https://github.com/cloud-shuttle/flow-rs.git
    cd flow-rs
    
  2. Install dependencies:

    # Install Rust dependencies
    cargo build
    
    # Install Node.js dependencies (for development)
    pnpm install
    
  3. Run the demo:

    cd examples/flow-leptos-demo
    trunk serve --open
    

Basic Usage

With Leptos Integration

use flow_rs_leptos::FlowEditor;
use flow_rs_core::{Graph, Node, Position};
use leptos::*;

#[component]
pub fn MyFlowApp() -> impl IntoView {
    let graph = RwSignal::new(Graph::new());

    view! {
        <FlowEditor
            graph=graph
            width=800.0
            height=600.0
        />
    }
}

Core Usage (Framework Agnostic)

use flow_rs_core::{Graph, Node, Position, Edge};
use flow_rs_renderer::{Canvas2DRenderer, Renderer};

// Create a graph
let mut graph = Graph::new();

// Add nodes
let node1 = Node::builder("input")
    .position(100.0, 100.0)
    .size(80.0, 40.0)
    .build();
let node2 = Node::builder("process")
    .position(300.0, 100.0)
    .size(80.0, 40.0)
    .build();

graph.add_node(node1);
graph.add_node(node2);

// Add edge
let edge = Edge::builder()
    .connect("input", "process")
    .build();
graph.add_edge(edge);

// Render with Canvas2D
let renderer = Canvas2DRenderer::new(&canvas)?;
renderer.render_graph_dyn(&graph, &viewport)?;

๐Ÿ“š Documentation

Core Documentation

Development Guides

Architecture Decision Records (ADRs)

๐Ÿงช Testing

Test Infrastructure

Flow-RS includes a comprehensive testing infrastructure:

  • Unit Tests: Core functionality testing
  • Integration Tests: Component interaction testing
  • Property-Based Tests: Edge case validation with Proptest
  • E2E Tests: End-to-end testing with Playwright
  • Performance Tests: Benchmarking and performance validation

Running Tests

# Run all tests with timeout protection
make test

# Run specific test suites
make test-quick      # Quick tests (10s timeout)
make test-spatial    # Spatial tests (30s timeout)
make test-proptest   # Property-based tests (45s timeout)

# Run tests with custom timeout
./scripts/test-with-timeout.sh flow-core 60 1 all

Test Results

  • โœ… 496/496 tests passing (100% pass rate)
  • โœ… 0 hanging tests (previously multiple)
  • โœ… 100% spatial indexing coverage
  • โœ… Comprehensive edge case handling

๐ŸŽจ Examples

Interactive Demos

Code Examples

// Creating a simple flow
use flow_rs_core::{Graph, Node, Edge};

let mut graph = Graph::new();
let node1 = Node::builder("input")
    .position(100.0, 100.0)
    .size(80.0, 40.0)
    .build();
let node2 = Node::builder("process")
    .position(300.0, 100.0)
    .size(80.0, 40.0)
    .build();

graph.add_node(node1);
graph.add_node(node2);

let edge = Edge::builder()
    .connect("input", "process")
    .build();
graph.add_edge(edge);

๐Ÿš€ Performance

Benchmarks

Flow-RS is optimized for performance:

  • Spatial Queries: O(1) average case with grid-based indexing
  • Rendering: 60 FPS with 1000+ nodes
  • Memory Usage: Efficient memory management with zero-copy operations
  • Bundle Size: Optimized WASM bundles for fast loading

Performance Monitoring

# Run performance benchmarks
cd flow-core
cargo bench

# Monitor performance in development
cd examples/flow-simple
cargo run --features performance-monitoring

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork and clone the repository
  2. Install pre-commit hooks: ./setup-hooks.sh
  3. Run tests: make test
  4. Make your changes following our coding standards
  5. Submit a pull request

Code Quality

  • Rustfmt: Automatic code formatting
  • Clippy: Linting and best practices
  • Pre-commit hooks: Automated quality checks
  • Mutation testing: Automated test quality validation

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Leptos - The reactive framework that makes this possible
  • Rust - The systems programming language
  • WebAssembly - For bringing Rust to the web

๐Ÿ“Š Project Status

  • Version: 0.1.0-beta.1
  • Status: โœ… Beta Release - Published to crates.io
  • Test Coverage: 496/496 tests passing (100% pass rate)
  • Performance: Validated with 1000+ node graphs (A+ rating)
  • Cross-Browser: 100% compatibility across all major browsers
  • API Stability: Comprehensive contract tests locking down all public interfaces
  • Browser Support: Modern browsers with WebAssembly support
  • Crates.io: All core crates published and available

Built with โค๏ธ using Rust and Leptos

Dependencies

~36MB
~652K SLoC