Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ MySQL/SQL Server, mixed naming styles and singular/plural table names, columns
that look like keys with no ref, isolated tables, missing timestamps, unused
enums and wide tables. `GET /api/v1/rules` is the list.

## Ask (pay as you go)

A person asks a database question in plain words at `/ask/<personal link>` and
gets an answer grounded in the engine: the schema's summary, every review
finding and exact SQL go into the prompt, and the checker's exact output is
added to convert and review answers. 5 cents per answered question from a
prepaid balance; failures are free. Top up $5/$10/$20 through CoinPay's
hosted checkout (no subscriptions). Everything asked stays on the page,
newest first. Models: c0mpute first through `@profullstack/ai-providers`,
OpenAI/Anthropic fallback when keys are set.

Operator (`ADMIN_KEY` from the vault):

```sh
DBML_ADMIN_KEY=... node bin/admin.js create "Name" --credit 1000 # prints the personal link
node bin/admin.js list | credit <id> <cents> | link <id> | revoke <id> | costs | backup <file>
```

State is one SQLite file in `/data` (the c0mpute app state directory).

## Run it

```sh
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@profullstack/dbml",
"version": "0.1.0",
"version": "0.2.0",
"description": "CLI and MCP stdio bridge for dbml.db: validate, review and convert DBML database schemas (DBML to SQL and back) from the terminal or an AI agent.",
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dbml.db",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"description": "DBML as a service for AI agents: validate, parse, review and convert database schemas over an HTTP API, MCP server and CLI.",
"type": "module",
Expand Down
3 changes: 3 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ app.all('/mcp', async (c) => {
app.all('/crawl', async (c) => (gateway && (await gateway.handle(c.req.raw))) || c.text('not found', 404));


const FAVICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="12" fill="#0b0d0a"/><path d="M14 18h36v8H14zm0 14h16v14H14zm20 0h16v14H34z" fill="#a6ff1a"/></svg>`;
app.get('/favicon.svg', (c) => c.body(FAVICON, 200, { 'content-type': 'image/svg+xml', 'cache-control': 'public, max-age=86400' }));
app.get('/favicon.ico', (c) => c.body(FAVICON, 200, { 'content-type': 'image/svg+xml', 'cache-control': 'public, max-age=86400' }));
app.get('/health', (c) => c.json({ ok: true, version: VERSION }));
app.get('/', async (c) => c.html(await homePage()));
app.get('/docs', async (c) => c.html(await docsPage()));
Expand Down
3 changes: 2 additions & 1 deletion src/askpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const JS = `<script>
if (j.status === 'working') continue;
if (j.status === 'answered') done('good', 'Done. Your answer is below, at the top of the list.');
else done('bad', j.error || 'The answer did not come through. You were not charged.');
setTimeout(() => location.reload(), 1500);
setTimeout(() => { location.hash = 'q-' + id; location.reload(); }, 1500);
return;
}
});
Expand Down Expand Up @@ -174,6 +174,7 @@ function shell(title, body, js) {
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<meta name="referrer" content="no-referrer">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<title>${h(title)} | dbml.db</title>
<link rel="canonical" href="${h(SITE)}ask">
<style>${CSS}</style>
Expand Down
Loading