Skip to content

Neatfig

A PlantUML editor that reads your diagram as UML, not just as syntax, and tells you what is wrong in plain words.

Role
Personal project
Year
2026
Type
Web app
Status
Release candidate

Overview

Neatfig is a PlantUML editor that runs in the browser. You write the diagram as text, it draws the figure beside the code as you type, and it checks what you drew against the rules of UML. It covers use case, class and component diagrams.

I designed, built and shipped it on my own. It is a release candidate: live and usable, and still waiting to find out what breaks.

The starter use case example. Line 19 has an extend arrow pointing the wrong way, and the warning says why.

The problem

PlantUML will happily draw a diagram that is valid and still wrong. An include arrow points the wrong way, an actor has no links, a use case can never be reached. The syntax is fine and the figure looks fine, but the UML is not, and no editor tells you.

Students with a report due are the obvious audience, and they rarely get a second pair of eyes on a diagram before it goes in.

Approach

The checks read every diagram two ways. A hand-written parser, ported from PlantUML’s own link grammar, works out what each element and relationship is. The rendered SVG says where everything landed. Together a rule can ask a real UML question, like which end of this arrow is the base use case, and still point at the exact line and the exact shape. The two readings also check each other, which is how I notice when an engine upgrade changes the output.

Each warning says in a sentence or two what is off and which rule it used. Click one and a thin rule is drawn from the code line to the element in the figure. Click an element in the figure and its line lights up. Where there is one obvious answer, a button applies the fix as a single undo step.

The drawing is done by the official PlantUML engine, not a lookalike, so the notation is PlantUML's own. It runs in a module Web Worker so typing never waits on a render: the Wasm build where the browser can run it, the JS build where it cannot. The engine expects a DOM, so the worker carries a small shim for text measurement, which also keeps the layout the same across browsers.

Everything is client side. The diagram stays on the device and autosaves to the browser, and it is never uploaded. The page runs under a strict content security policy: scripts from its own origin and a hash for each of Next's inline scripts, rewritten after every build. Only the worker has a looser policy, because the engine's Wasm build needs it.

Key features

  • Checks for use case, class and component diagrams, each explained in plain words with the rule behind it.
  • Click from a warning to its code line and the figure element, or from the figure back to its line.
  • Apply fix for the safe one-line rewrites, as one undo step.
  • Syntax errors get their own panel, and the last good figure stays on screen, dimmed.
  • Export to SVG, or PNG at 300 dpi, with a readout of how small the text will print on A4.
  • Other PlantUML diagram types still draw and export, just without the checks.
  • Light and dark, a phone layout, and autosave on the device.

Tech stack

A static Next.js 16 export with Tailwind 4 and shadcn/ui, CodeMirror 6 for the editor, and the PlantUML engine in a worker. It deploys to Cloudflare Pages, and the security headers live in a headers file because a static export cannot set them itself.

  • Next.js
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • CodeMirror 6
  • PlantUML
  • WebAssembly
  • Cloudflare Pages

Where it stands

Neatfig has been live since 24 November 2026 as a release candidate. Still to come: export as A4 PDF and Word, more diagram themes, and share links. None of those are in the app yet.

I tested the checks on diagrams written to trigger each rule and on a public set made by learners. They will miss things, and I do not have accuracy figures I would stand behind, so there are none here.

You can try it at neatfig.thilina.dev (opens in a new tab). The code is closed for now.

v3.1© 2026 Thilina Rathnayaka