Skip to content
Package75 repository health

elkjs

Automatic graph layout engine for node-link diagrams, ported from the Eclipse Layout Kernel (ELK).

Library npmv0.12.12,904 stars EPL-2.0 OR GPL-3.0-or-later
npm install elkjs
View sourceVisit website

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity80
  • Maintenance64
  • Community56
  • Maturity60
  • Momentum40

Technical analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
Good
  • Architecture75
  • Code quality70
  • Innovation80
  • Learning curve62

elkjs brings the layout-computation core of the Eclipse Layout Kernel (ELK) to JavaScript, so applications can automatically compute node and edge positions for diagrams without implementing a layout algorithm themselves. Its flagship algorithm is a layered, Sugiyama-style layout well suited to node-link diagrams with an inherent direction and explicit ports (attachment points on a node’s border), the kind of structure common in flowcharts, data-flow diagrams, and dependency graphs.

elkjs is explicitly scoped to layout computation only — it does not render, style, or draw anything, leaving that to a diagramming framework such as Sprotty, D3, or a custom SVG/canvas renderer that consumes elkjs’s computed coordinates. It is the JavaScript successor to the earlier klayjs project and tracks ELK’s Java implementation, with releases loosely synchronized to upstream ELK version numbers.

What You Get

  • A layered (Sugiyama-style) automatic layout algorithm suited to directional node-link diagrams with ports
  • A pure layout API (elk-api.js) separate from the worker that performs the computation (elk-worker.js), plus a bundled browser build (elk.bundled.js)
  • Support for incremental and dynamic layout scenarios, including adding nodes/edges to an existing layout
  • Configurable layout options mirroring ELK’s Java configuration surface (direction, spacing, port constraints, edge routing)
  • A Node.js-friendly entry point (main.js) for require('elkjs')/import usage without manually composing the API and worker files
  • TypeScript typings for the layout graph input/output shapes

Common Use Cases

  • Automatically laying out flowcharts, BPMN diagrams, or state machines rendered with a separate diagramming library
  • Computing node/edge positions for dependency graphs, data-flow diagrams, or pipeline visualizations
  • Powering the layout step of interactive diagram editors (e.g. alongside Sprotty) where users can still manually adjust positions after auto-layout
  • Laying out graphs with explicit ports, such as circuit diagrams or diagrams where edges must attach to specific sides of a node
  • Providing consistent, algorithmic diagram layout in tools that previously required manually positioned nodes

Under The Hood

Architecture - elkjs separates the public layout API (src/js, compiled to elk-api.js) from the actual layout engine (elk-worker.js), which is generated from ELK’s original Java codebase (src/java, src/java-additional) via GWT (Google Web Toolkit) cross-compilation rather than being hand-written in JavaScript. This means elkjs’s core layout logic is a transpiled port of a mature, actively developed Java project (Eclipse ELK), while the thin JavaScript API layer handles calling into that generated worker and shaping the input/output graph JSON.

Tech Stack - The build pipeline spans two ecosystems: Gradle (build.gradle, gradlew) drives the Java-to-JavaScript GWT compilation of the layout engine, while Babel and Browserify (babel src/js/, browserify ... -s ELK) produce the JavaScript-facing API and bundled browser build from src/js. This dual-toolchain setup is a direct consequence of porting rather than reimplementing ELK’s algorithms.

Code Quality - Tests live under test/mocha and test/examples, run via mocha test/mocha, and the project’s README maintains an explicit, actively curated FAQ of recurring GitHub issues (module resolution errors from the GWT-generated code, poor modularization, dynamic/incremental layout requests), showing the maintainers directly track and document the rough edges inherent to the Java-to-JS porting approach.

API Design - The API takes a plain graph object (nodes, edges, ports, layout options) and returns a promise resolving to the same graph annotated with computed positions, keeping the surface framework-agnostic so any renderer can consume the output. The tradeoff of the GWT-generated worker is a less idiomatic JavaScript experience in places (documented issues like g is not defined under certain bundler configurations), which the README addresses directly rather than hiding.

Used by 14 apps in this directory

Every app whose dependencies include elkjs, nine to a page.

Showing 14 apps
Python 87%Apache 2.0

Apache Airflow

47,583

Data Engineering

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

App
Built with
  • Python 87%
Updated todayView details
TypeScript 96%Other

Amplication

16,005

AI Code Assistants · Automation · Developer Tools

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

App
Built with
  • TypeScript 96%
Updated 4 months agoView details
TypeScript 89%Other

anytype-ts

9,124

Collaboration · Knowledge Management · Note Taking

A local-first, end-to-end encrypted knowledge OS that lets you build notes, tasks, wikis, and entire apps — with your data stored offline and synced peer-to-peer.

App
Built with
  • TypeScript 89%
Updated yesterdayView details
JavaScript 100%Other

Automatisch

14,028

Automation · No Code Platforms

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

App
Built with
  • JavaScript 100%
Updated 9 months agoView details
TypeScript 55%MIT

Bytebase

14,721

Devops

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

App
Built with
  • TypeScript 55%
  • Go 39%
Updated todayView details
TypeScript 46%Other

Convex Backend

12,807

Databases · Developer Tools

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

App
Built with
  • TypeScript 46%
  • Rust 42%
Updated todayView details
Python 57%Other

Dify

161,595

AI Development · Design Tools · Developer Tools

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

App
Built with
  • Python 57%
  • TypeScript 40%
Updated todayView details
TypeScript 98%Other

Hexabot

1,164

AI Development · Automation

Build and run agentic workflows across channels with YAML, tools, and RAG

App
Built with
  • TypeScript 98%
Updated 3 days agoView details
Python 72%MIT

Langflow

156,814

AI Agents · AI Development

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

App
Built with
  • Python 72%
  • TypeScript 21%
Updated todayView details

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers