

Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Maybe you can support schemas in more dialects by using a similar approach to a little tool I made: sqlscope.netlify.app
Basically integrate sqlglot to translate the schema between dialects and then use a base dialect for generating the schema.
The two tools seem complementary and you seem to be a better designer, so it would be nice to see it all together
- The "entities vs tables" distinction is a real one, but I think for the majority of developers who just want to visualize an existing schema quickly, this is more than sufficient. Perfect is the enemy of useful here. Most people aren't building ORM abstractions — they just want to see what's connected to what.by eventinbox
- This is cool! I made something similar a little while ago that I’ve been touching up here and there. You can’t export to any SQL but I just wanted a tool I can use to diagram tables: https://datagram.studio
Edit: should clarify mine is also free! It’s quite specific to my needs but I’m happy with it
by hoofedear - This reminds me of a tool I vibed with v0 a few months back: https://v0-yaerd.vercel.app. I created it because I hadn't seen a tool before that could interpret Laravel migration files and create ERDs from them, then prompted basic SQL support into it as well.by mulquin
- Nice, but there is no LICENSE file in the github: https://github.com/royalbhati/sqltoerdiagramby petilon
- I'm using https://github.com/ondras/wwwsqldesigner and I think that's worth taking it in account for comparison.by mingodad
- The same Ondras from V8CGI? I loved that project, one of the first server side JS implementations. Perhaps I was the only follower? Hey, Ondřej, loved your work!by Kuyawa
- btw did you know that ER diagrams are supported by Mermaid diagrams: https://mdview.io/mermaid?example=working-er It's not that pretty as in your app, but it does the workby Igor_Wiwi
- Reminds me of: https://explain.dalibo.com/
For visualizing query plans. One of the most useful tools for optimizing sql queries I’ve ever used.
Just make sure to download the fully offline v2 version at the bottom if you want to use it with anything sensitive.
- Could we have the option of straight lines and 90 degree angles? I’ve never really liked the bendy ones. Looks cool, good job!by corkybeta
- Thanks and I will add this to my todos!by robhati
- It's a small too nothing great I just figured others might find it useful too. I kept finding myself needing to visualize database schemas, but most tools had the same problems: paywalls, mandatory signups, or sending your SQL to someone else's server.
No backend, no accounts, no data leaving your machine.
A few implementation details that were fun:
* Built on <canvas> instead of DOM/SVG. Tables are rasterized into cached bitmaps with viewport culling, which keeps things smooth even with hundreds of tables on screen.
* The SQL parser tracks source spans for every token. That lets edits stay surgical so a rename a table and only the relevant identifier (and its references) change while comments and formatting remain untouched.
* The URL contains the entire schema. Sharing simply serializes the schema into the URL itself, so there's no backend, no stored state, and no account required.
* I also experimented with a Rust/WASM version because why not? but the parser was ~37% slower because the JS↔WASM boundary cost outweighed the compute savings but The O(n^2) overlap-resolution pass was about 2.2x faster though * In the end I stuck with plain JavaScript. No framework ~32KB gzipped
by robhati - Beautiful software. Thanks!by vatsachak
- Truely good work! It’s responsive, clean and “onboarding” experience without signup walls is great. Good job.by __natty__
- The subject says this is free, if so what free license are you using? If the license is unspecified it may be open source but it is not free.by flowerlad
- > The URL contains the entire schema.
Isn’t that going to be a problem due to the URL length limitations?
> It is RECOMMENDED that all senders and recipients support, at a minimum, URIs with lengths of 8000 octets in protocol elements.
by Hendrikto - The tool looks very cool! But IMO you can't get an ER diagram from SQL since entities are fundamentally different from tables. They are certainly very similar, but SQL alone doesn't give you enough information to create an ER diagram.
That's not to say that the tool is useless or that diagrams of this sort are unhelpful. I'll admit I'm being pedantic and others will probably disagree.
by michaelmior - > entities are fundamentally different from tables
one man’s simplicity is another man’s headache
by jitl - Can you please elaborate? My understanding was that entities always have a 1:1 relationship with tables.
An example would be really helpful.
by thunderbong - Can you please elaborate on the differences? They are practically interchangeable, but conceptually there might be another layer on top of entities and relationships for somewhat richer semantics (like describing a relation, or additional annotations on the entity)
- the use case for sql to er, is to study a database new to you
so the db already exist, but they have no er, and maybe even little docs
so it act more like an exploratory tool, ideally, it should allow you to create views and add notes, so you dont have to look at the full er at once, especially if the number of table is huge, and if many of those tables are missing foreign keys
by systems - To make parent’s point more exact: from Chen’s definition, these ER diagrams derived from SQL are the “physical” (most low-level) diagrams, you cannot recreate the “logic” or “conceptual” diagrams from it.
I guess nowadays few people care about this difference.
by manoDev - > entities are fundamentally different from tables
Isn't the fact that they are _mostly_ interchangeable the foundational principle of hundreds of ORMs? Of course the DDL doesn't say much about the entity's lifecycle, but if the bar is set at representing its relationships, fields and cardinality as a graph, it seems sufficient?
by ezst - 100/10 for mobile usability. Panning, Zooming, selecting and moving was so seamless I thought I was tripping out.
- The only thing is that it zooms in on safari mobile when pressing a text field, but that problem is unanimousby elias1233
- That's really good yes, even double tapping editing does not reset the zoom level. Definitely one of the best mobile friendly site I have seen.by Galanwe
- > 100/10 for mobile usability. Panning, Zooming, selecting and moving was so seamless I thought I was tripping out.
Yeah, my first thought was that the diagramming bit needs to be ripped out into its own library, because I can see a use for the diagramming bits for more than ER diagrams.
by lelanthran - The whole code base is a breath of fresh air to be honest: https://github.com/royalbhati/sqltoerdiagram/blob/main/src/m...
Author is top notch in my book. I'm a sucker for someone taking a complex problem and distilling out a simple solution. I don't know of higher praise to give a developer.
by CraigJPerry