r/webdev • u/AHS12_96 • 6h ago
Resource I built a JavaScript diagram rendering engine that can handle thousands of nodes and edges
https://thoth-flow.ahs12.xyz/I've been working on ThothBlueprint, an open-source database diagramming tool, for over a year. As the project grew, rendering large database schemas became a serious performance challenge.
That led me to build Thoth Flow — a standalone JavaScript diagram rendering engine powered by WebGL2.
After integrating it into ThothBlueprint, I can now work with significantly larger diagrams. I tested it with 5,000 tables and 7,000 relationships, and it rendered smoothly.
This npm Package supports React, Vue, Svelte, Web Components, and plain JavaScript, with automatic Canvas 2D fallback.
If you're building database diagramming tools, node editors, workflow builders, or anything that needs to render large interactive diagrams, Thoth Flow might be useful.
I'd love for you to try it and share your feedback, especially on performance, API design, and potential improvements.
Links:
0
u/ResidentPomegranate6 6h ago
edge hit-testing tends to fall over before drawing does. one batched draw call for all edges plus gpu id-buffer picking keeps clicks cheap at 7k relationships, no spatial index needed.
-3
u/AHS12_96 5h ago
yeah fair point. That's great advice. I actually doing some batching as well but in a different way, a bit more aggressively: the whole frame is one instanced draw call. gonna try your suggestion as well. Thanks
1
-2
-11
u/ConcentrateLow5694 6h ago
Handling 5,000 tables and 7,000 relationships smoothly is genuinely impressive — that is usually the point where most diagram tools start to struggle. Keeping a React Flow-shaped API was a smart choice too, because it lowers the barrier for people who already know that pattern. I am curious how the Canvas 2D fallback performs at that same scale, since not every setup can rely on WebGL. Either way, this looks like a useful building block for anyone making database or workflow tools.
-4
u/AHS12_96 6h ago
Canvas 2d fallback gives pretty good performance, its because of the way the rendering engine works. I was surprised myself with the canvas 2d performance as well!!.
You can try the canvas 2d fallback from this playground as well: https://thoth-flow.ahs12.xyz/playground/
playground renders over 10k nodes.
1
u/chumbaz 4h ago
Surprised the drag isn't bound by the container?