For the first version we used Mermaid, but in order to make it more interactive it’s now custom d3 code. It uses many of the same dependencies as Mermaid, for example graph layout.
Downsides are I need to have the Java JVM installed to use it. Also had to do some make a custom property file to make it work with postgres 12 the last time I used it.
You can initialize ERD by exporting database metadata, and you can manually edit ERD through web UI, and finally you can export sql, including mysql postgres and mssql format.