Docs
Every surface answers the same way. POST JSON, or send the schema as a raw text body (--data-binary @schema.dbml) with options in the query string. Inputs up to 512 KiB. Version 0.1.0.
HTTP API
| Endpoint | Body | Answer |
|---|---|---|
POST /api/v1/validate | {dbml} | {valid, errors[]} (always 200) |
POST /api/v1/parse | {dbml} | {valid, errors, model} |
POST /api/v1/summary | {dbml} | {valid, summary:{counts, tables, refs, enums, text}} |
POST /api/v1/review | {dbml, rules?} | {valid, score, counts, findings[]} |
POST /api/v1/format | {dbml} | {ok, dbml} |
POST /api/v1/dbml-to-sql | {dbml, dialect} postgres | mysql | mssql | oracle | {ok, dialect, sql} |
POST /api/v1/sql-to-dbml | {sql, dialect} postgres | mysql | mssql | oracle | snowflake | schemarb | json | {ok, dialect, dbml} |
POST /api/v1/convert | {from, to, input}, one side dbml | {ok, sql | dbml} |
GET /api/v1/rules | review rules | |
GET /api/v1/syntax | DBML cheat sheet (text) |
An invalid schema answers 422 with errors: [{message, line, column, end_line, end_column, code}]. A bad request (missing field, unknown dialect) answers 400.
curl -s https://dbml.db.pit.world/api/v1/dbml-to-sql?dialect=mysql --data-binary @schema.dbml -H 'content-type: text/plain'
MCP server
Streamable HTTP (stateless, JSON responses) at https://dbml.db.pit.world/mcp. No key. Tools:
validate_dbmlparse_dbmlsummarize_dbmlreview_dbmlformat_dbmldbml_to_sqlsql_to_dbmllist_review_rulesdbml_syntax
claude mcp add --transport http dbml https://dbml.db.pit.world/mcp
Over stdio (for clients without HTTP transport): npx -y @profullstack/dbml mcp. It proxies to this server.
CLI
npm i -g @profullstack/dbml dbml validate schema.dbml dbml review schema.dbml # exits 1 when there are errors dbml to-sql schema.dbml --dialect mysql > schema.sql dbml from-sql dump.sql --dialect postgres > schema.dbml dbml summary schema.dbml cat schema.dbml | dbml format - dbml mcp # MCP over stdio
Set DBML_API to use another server.
Review rules
| Rule | Severity | What it means |
|---|---|---|
missing_primary_key | error | A table has no primary key (no [pk] column and no pk index). |
ref_target_not_unique | error | A ref points at columns that are not a primary key or unique, so the foreign key cannot be created. |
fk_type_mismatch | warning | A foreign key column type differs from the column it references. |
unindexed_foreign_key | warning | A foreign key column is not the leading column of any index or the primary key; joins and cascading deletes scan the table. |
nullable_foreign_key | warning | A foreign key column allows NULL. Fine for an optional relationship; otherwise add [not null]. |
many_to_many_ref | warning | A many-to-many ref (<>) needs a junction table in SQL; model it explicitly. |
duplicate_index | warning | Two indexes on the same table cover the same columns in the same order. |
reserved_word | warning | A table or column is named with an SQL reserved word and needs quoting everywhere. |
float_for_money | warning | A money-like column (price, amount, total, balance, cost) uses a floating-point type; use decimal/numeric or integer cents. |
varchar_without_length | warning | MySQL and SQL Server need a length on varchar. |
table_naming_inconsistent | info | Table names mix naming styles (snake_case, camelCase, PascalCase) or singular and plural. |
column_naming_inconsistent | info | Column names mix naming styles across the schema. |
redundant_index | info | An index is a leading prefix of another index on the same table. |
possible_missing_ref | info | A column named like <table>_id matches a table but has no ref. |
isolated_table | info | A table has no refs in or out while the schema has other tables. |
missing_timestamps | info | A table has no created_at/updated_at style column. |
unused_enum | info | An enum is declared but no column uses it. |
wide_table | info | A table has more than 40 columns. |
Score: 100 minus a weighted penalty (error 15, warning 5, info 1), scaled by schema size. The review is deterministic: no AI model is called.
DBML cheat sheet
# DBML cheat sheet (full docs: https://dbml.dbdiagram.io/docs)
Project shop {
database_type: 'PostgreSQL'
Note: 'Optional project note'
}
Table users as U { // alias U is optional
id integer [pk, increment] // column settings go in [ ]
email varchar(255) [unique, not null]
role user_role [default: 'member'] // enum type
created_at timestamp [default: `now()`] // backticks = SQL expression
Note: 'Table note'
}
Table orders {
id bigint [pk]
user_id integer [not null, ref: > users.id] // inline ref: many orders -> one user
total numeric(12,2) [not null, note: 'cents are safer']
status varchar
created_at timestamp
Indexes {
user_id // single column
(user_id, created_at) [name: 'ix_orders_user_created']
status [type: hash]
(id, user_id) [unique]
}
}
Table order_items {
order_id bigint [ref: > orders.id]
product_id integer
qty integer [not null, default: 1]
Indexes { (order_id, product_id) [pk] } // composite primary key
}
Table products {
id integer [pk]
name varchar [not null]
}
Table invoices {
id bigint [pk]
order_id bigint [not null]
user_id integer [not null]
Indexes { (order_id, user_id) [unique] }
}
// Standalone refs. > many-to-one, < one-to-many, - one-to-one, <> many-to-many
Ref: order_items.product_id > products.id [delete: cascade, update: no action]
Ref fk_name: invoices.(order_id, user_id) - orders.(id, user_id)
Enum user_role {
admin
member [note: 'default']
}
TableGroup billing {
orders
order_items
}
Schemas: write schema.table (e.g. Table auth.users { ... }); the default is public.
Column settings: pk, primary key, null, not null, unique, increment, default: <value>, note: '...', ref: <rel> <table>.<column>
Index settings: pk, unique, name: '...', type: btree|hash, note: '...'
Ref settings: delete|update: cascade | restrict | set null | set default | no action
Limits and pricing
Free: 60 requests a minute per caller. Over that, the answer is a 429, or a 402 offering a $1 day pass (x402 USDC or CoinPay checkout).
Credits
Parsing and SQL conversion use @dbml/core by Holistics (Apache-2.0). DBML is their language; this is an independent service by Profullstack, Inc. Source: github.com/profullstack/dbml.db.