> your AI agent picks dependencies from memory; give it dated facts — try starlog.dev ↗ vet your agent's deps ↗ vibe-coding is fine. vibe-importing isn’t. — try starlog.dev ↗ vibe-importing isn’t fine ↗ your agent has never seen your private packages — try starlog.dev ↗ facts for private packages ↗ a linter for the dependencies your AI agent picks — try starlog.dev ↗ a linter for agent deps ↗ whois is redacted, cdns mask the rest — get the real operator — try whoisgeni.us ↗ who really runs that domain ↗ domain attribution that shows its work — full evidence chain — try whoisgeni.us ↗ domain intel w/ evidence ↗

← Back to Articles

Building a Read-Only Graph Explorer: Inside Linkurio-Less's Canvas Rendering Strategy

[ View on GitHub ]

Building a Read-Only Graph Explorer: Inside Linkurio-Less's Canvas Rendering Strategy

Hook

Most graph visualization libraries crash your browser at 10,000 nodes. This tool profiles your GPU, calculates what you can actually render, and refuses to let you shoot yourself in the foot.

Context

If you're a cloud security engineer running Cartography to map your AWS infrastructure, you've hit this wall: you have thousands of nodes in Neo4j representing EC2 instances, S3 buckets, IAM roles, and their relationships, but visualizing them requires either paying for Linkurious Enterprise ($$$), wrestling with Neo4j Bloom's licensing, or writing Cypher queries in the browser console like it's 2015. The free options are surprisingly limited—Gephi requires exports and doesn't connect live to Neo4j, Cytoscape.js gives you a library but no application, and most generic graph tools weren't built for the specific shape of cloud inventory data.

Linkurio-less emerged from this gap as a self-hosted, read-only graph explorer that does one thing well: letting you visualize and explore Neo4j data without infrastructure complexity or licensing costs. The name is a cheeky reference to Linkurious, the commercial graph platform it mimics aesthetically, with the '-less' suffix signaling both its minimalism (no build tools, no frameworks) and its primary constraint (read-only access). It's particularly opinionated about who it serves—security teams already using Cartography—and makes no apologies for trade-offs that benefit that audience while excluding others.

Technical Insight

Frontend

Request

Serve

/api/expand

/api/neighbors

/api/cypher

Read-only queries

+ LIMIT enforcement

JSON graph data

Paginated results

Node/edge data

Graph positions

Updated coordinates

Canvas draw calls

Hardware limits

Persist constraints

Browser Client

Static Assets

HTML/CSS/JS

Python Flask API

Neo4j Database

Cytoscape.js

Graph Data Model

Custom Canvas2D

render.js

Web Worker

ForceAtlas2 Layout

Budget System

gx.local.json

System architecture — auto-generated

The architectural decision that defines linkurio-less is replacing Cytoscape.js's built-in renderer with a custom Canvas2D implementation. While Cytoscape.js handles the graph data model beautifully—nodes, edges, selectors, and graph theory operations—its default rendering strategies hit performance ceilings around 5,000-10,000 nodes depending on hardware. The author's solution was surgical: keep Cytoscape for data management, rip out its rendering, and implement a minimal canvas renderer in render.js that only draws what's visible.

The rendering loop is deliberately simple. On each frame, it clears the canvas, applies the current pan/zoom transform, iterates through visible nodes and edges, and draws them as circles and lines. No DOM elements, no React reconciliation, no WebGL shader compilation:

// Simplified from render.js
function drawGraph(ctx, nodes, edges, transform) {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.save();
  ctx.translate(transform.pan.x, transform.pan.y);
  ctx.scale(transform.zoom, transform.zoom);
  
  // Draw edges first (background layer)
  edges.forEach(edge => {
    if (!isVisible(edge, viewport)) return;
    ctx.strokeStyle = edge.color || '#888';
    ctx.lineWidth = edge.width || 1;
    ctx.beginPath();
    ctx.moveTo(edge.source.x, edge.source.y);
    ctx.lineTo(edge.target.x, edge.target.y);
    ctx.stroke();
  });
  
  // Draw nodes (foreground)
  nodes.forEach(node => {
    if (!isVisible(node, viewport)) return;
    ctx.fillStyle = node.color || '#3498db';
    ctx.beginPath();
    ctx.arc(node.x, node.y, node.size || 5, 0, Math.PI * 2);
    ctx.fill();
  });
  
  ctx.restore();
}

This approach sacrifices Cytoscape's advanced rendering features (node borders, gradients, bezier curves) for raw speed. Drawing 50,000 circles and lines in Canvas2D is fast; managing 50,000 DOM elements or compiling complex WebGL shaders is not.

The second critical decision is the budget system. On first run, the application executes a client-side hardware profiling routine that attempts to detect CPU cores, available RAM, and GPU capabilities through browser APIs (admittedly unreliable, but better than nothing). It then writes rendering limits to gx.local.json:

{
  "maxNodes": 15000,
  "maxEdges": 25000,
  "layoutIterations": 500,
  "renderThrottle": 60
}

When you query Neo4j and the result exceeds these budgets, the application doesn't crash—it refuses to render and prompts you to refine your query. This is treating graph visualization as a resource management problem rather than assuming infinite client capacity. The /api/expand and /api/neighbors endpoints respect these limits server-side, paginating results automatically.

ForceAtlas2 layout calculations run in a dedicated web worker (layout.worker.js), which is essential for UI responsiveness. Force-directed layouts are iterative physics simulations—each frame recalculates repulsive forces between nodes and attractive forces along edges. Running this on the main thread would block all user interaction during the 500+ iterations needed for stabilization. By offloading to a worker:

// Main thread
const layoutWorker = new Worker('layout.worker.js');
layoutWorker.postMessage({ nodes, edges, config });
layoutWorker.onmessage = (e) => {
  // Update node positions from worker
  e.data.positions.forEach(pos => {
    nodes.find(n => n.id === pos.id).x = pos.x;
    nodes.find(n => n.id === pos.id).y = pos.y;
  });
  requestAnimationFrame(render);
};

The main thread remains responsive for filtering, clicking nodes, and panning while layout stabilizes in the background. The worker sends position updates via postMessage, and the renderer interpolates between frames for smooth animation.

The data layer enforces read-only access at the Neo4j driver level using transaction functions. Rather than parsing Cypher to detect writes (fragile and incomplete), the Python backend exclusively uses session.read_transaction(), which Neo4j enforces server-side. If you somehow slip a CREATE or DELETE into a query string, Neo4j rejects it before execution. The /api/cypher endpoint also silently appends LIMIT 10000 to any query missing a limit clause, preventing accidental full-table scans that would return millions of nodes and crash the browser.

The Cartography integration is more than just example data—the styles/ directory contains pre-configured node colors, sizes, and labels for AWS resource types. An EC2 instance renders as an orange square, an S3 bucket as a blue circle, IAM roles as purple diamonds. This domain-specific styling means security engineers can immediately parse their infrastructure visually without configuring symbolism.

Gotcha

The 15-million-node 'live-scale' test requiring 16GB of Docker RAM exposes the fundamental limitation: this architecture doesn't scale to truly massive graphs. Real production Neo4j databases in fraud detection or social networks can have hundreds of millions of nodes. Canvas2D rendering every visible node on every frame, even with viewport culling, becomes a bottleneck. There's no level-of-detail rendering, no clustering, no virtualization—if 50,000 nodes are in your viewport, all 50,000 get drawn. The lack of WebGL means you're not leveraging GPU parallelism for rendering, only for layout calculations indirectly.

The read-only constraint is a feature for the target audience but a dealbreaker for others. You cannot annotate graphs, mark nodes as investigated, create case files, or collaboratively build threat models. This is purely exploratory—you find interesting patterns, take screenshots, and document findings elsewhere. Combined with the lack of authentication (the NEO4J_USER is shared; there's no session management), you cannot safely expose this to a team over the network. It's localhost-only unless you bolt on your own auth layer, which defeats the 'no infrastructure complexity' value proposition. The full-text search implementation scans up to 200,000 nodes linearly when no Neo4j index exists, which will timeout on large datasets, and creating the index requires write access—a chicken-and-egg problem for read-only deployments.

Verdict

Use if: You're already running Cartography to inventory AWS/GCP/Azure infrastructure, need to visualize cloud security relationships during incident response, want a free alternative to Linkurious/Bloom for read-only exploration, or you're comfortable with Neo4j and need something running in 5 minutes without Docker Compose complexity. The tool delivers immediate value for its intended niche—cloud security practitioners who need graph exploration, not graph editing. Skip if: You need collaborative features, write operations, plan to explore graphs over 10M nodes regularly, require authentication for team access, or aren't already invested in Neo4j (no import/export for other formats). Also skip if you want a general-purpose graph visualization library—just use Cytoscape.js directly or pick Gephi/yEd. This is purpose-built tooling that trades breadth for depth in one specific domain.