ChartDB 1.21: Self-Host a Database Diagram Editor with Docker Compose
ChartDB is a browser-based database diagram editor you can run as a single, tiny Docker container. Import a schema from SQL, DBML or a metadata query and get an editable ER diagram. Tested on Ubuntu 24.04 with Docker Compose.
Every database ends up with a schema nobody remembers. Tables get added, foreign keys pile up, and the only "documentation" is a ten-year-old diagram that no longer matches reality. ChartDB tackles this from the other side: you feed it your schema (or a SQL script), and it draws an editable entity-relationship diagram in the browser. It showed up in the trending section of the Self-Host Weekly issue of 20 November 2026, and the current release, v1.21.0, came out on 1 November 2026.
The nice part for homelabbers: the whole thing is a static web app served by nginx. There is no database, no queue and no account system behind it. I tested the setup on a fresh Ubuntu 24.04 VM, and the container sat at about 3.7 MiB of RAM in docker stats while idle.
What ChartDB does
ChartDB is a web-based database diagram editor. According to its README, it supports PostgreSQL (including Supabase and Timescale flavors), MySQL, SQL Server, MariaDB, SQLite (including Cloudflare D1), CockroachDB and ClickHouse. The import dialog in the version I tested also listed Oracle on the first screen.
There are three ways to get a schema in:
- Smart Query: ChartDB shows you a query for your database engine. You run it yourself, copy the JSON result and paste it into the app. The project advertises this as "no database password required", because ChartDB never connects to your database.
- SQL Script: paste a
CREATE TABLEscript, or the output ofpg_dump -sfor PostgreSQL. This is the route I used for my test. - DBML: paste or edit a DBML description. The sidebar also has a live DBML view of whatever is on the canvas.
Once the tables are on the canvas you can drag them around, edit columns, add relationships and organize things into areas (v1.21.0 added "move to area" and "auto-arrange area" to the context menu). The Actions menu has Export SQL and Export as entries, and an "All Databases" list for switching between saved diagrams.
Docker Compose setup
The repository ships a Dockerfile and the project publishes an image on the GitHub Container Registry. The README only shows a docker run example with the latest tag, so I turned it into a Compose file and pinned the version. The tag for the current release is 1.21.0 (without the leading "v"; I tried v1.21.0 first and it does not exist).
1. Create a project folder
mkdir -p ~/chartdb && cd ~/chartdb2. Create docker-compose.yml
services:
chartdb:
image: ghcr.io/chartdb/chartdb:1.21.0
container_name: chartdb
restart: unless-stopped
ports:
- "127.0.0.1:8080:80"
environment:
- DISABLE_ANALYTICS=true
- HIDE_CHARTDB_CLOUD=trueThe container listens on port 80 internally. Binding it to 127.0.0.1 keeps it off the public interface, so you can put a reverse proxy in front of it. Change the host port if 8080 is already taken on your machine.
Both environment variables are read by the container's entrypoint script (it substitutes them into the nginx config), so they are real. DISABLE_ANALYTICS is documented in the README as the switch for the built-in Fathom analytics. HIDE_CHARTDB_CLOUD is listed in the entrypoint and the nginx template, but the README does not describe it. I left it in because it is harmless, but I did not dig into exactly which UI element it hides.
3. Start it
docker compose up -d
docker compose psOn my test VM the image pulled and the container reported healthy within about 20 seconds. The image takes roughly 238 MB of disk space. A quick check from the same machine:
curl -I http://127.0.0.1:8080/You should get an HTTP 200. Then open the address in a browser. If the app runs on a server, put it behind a reverse proxy with HTTPS (for example Caddy, Traefik or nginx) and point a hostname such as chartdb.example.com at it.
4. Import your first schema
On first load, ChartDB asks "What is your Database?". Pick your engine and hit Continue. For PostgreSQL you land on an import dialog with the three options mentioned above. For a quick start, choose SQL Script, paste your DDL and click Import. The dialog tells you how many tables it found before you commit.
For my test I pasted a small demo shop schema (customers, products, orders and order_items). ChartDB found four tables, picked up the foreign keys and drew the relationships with 1 and N markers.

The DBML view in the sidebar shows the same schema as text. This is handy if you want to keep the schema description in Git next to your code.

5. Export and save
The Actions menu has Save, Import, Export SQL, Export as and Delete, plus an entry for switching between your saved databases.

Tips
If you want ChartDB to generate SQL in a different dialect (say, from MySQL to PostgreSQL), the README describes an AI-powered export. It needs an OpenAI API key via OPENAI_API_KEY, or alternatively your own OpenAI-compatible endpoint via OPENAI_API_ENDPOINT and LLM_MODEL_NAME. The README says to use one option or the other, not both. I did not test the AI export, so I cannot say how good the results are. Without any of these variables, the diagram editing, DBML and plain SQL import work as shown above.
For PostgreSQL, the SQL Script dialog suggests dumping only the schema with pg_dump -s -F p -E UTF-8. That keeps your actual rows out of the picture entirely. If you do not want to share a schema dump at all, the Smart Query route only returns metadata as JSON.
Limits and security
A few things worth knowing before you expose this anywhere.
There is no login. In my test the app opened straight to the editor, and I found nothing about authentication in the README. Treat it like any other open tool and keep it behind your VPN or a reverse proxy with authentication.
Your diagrams live in the browser, not on the server. After the import I checked the page and found a single IndexedDB database called "ChartDB". So the container stores nothing, and diagrams do not follow you to another browser or device. Use the export functions for backups, and do not assume a second team member sees your diagram just because you share the URL.
API keys end up in the page. The nginx config serves a /config.js file that contains the values of OPENAI_API_KEY, OPENAI_API_ENDPOINT, LLM_MODEL_NAME and the two flags above. In my test, requesting it returned exactly those five fields, with the key empty. If you set a real key, anyone who can open the page can read it. That is another reason not to put an instance with a paid key on the open internet.
It is not fully offline. Even with DISABLE_ANALYTICS=true, the browser made requests to fonts.googleapis.com and ghbtns.com (the latter is a GitHub button service) while I used the app. I did not see analytics traffic, but if strict privacy is your goal, check this against your own setup, for example with your browser's network tab.
Finally, the README still labels the project a "Public Beta". Version 1.21.0 is a normal feature release, but expect some rough edges. The license is AGPL-3.0, which matters mainly if you modify it and offer it as a service to others.
Alternatives
drawDB is another open-source, browser-based diagram editor (AGPL-3.0 according to GitHub) and the closest comparison. Both start from the same idea: draw in the browser, keep the data client-side. I did not run it for this article, so I will not rank the two.
DBeaver (Apache-2.0) is a full desktop database client. It works against a live database connection, which is exactly what ChartDB avoids, so the two solve different problems. Hosted tools like dbdiagram.io are convenient, but then your schema sits on someone else's server.
Conclusion
ChartDB is a good example of a self-hosted tool that does one thing and costs almost nothing to run. It idles at a few megabytes, needs no database of its own and imports a schema in seconds. The trade-offs are the missing authentication and the browser-only storage, so it works best as a personal or small-team tool that you export from regularly. If you have a database nobody has documented, it is a quick way to see it for the first time.