dartonic_studio 1.0.0-beta.1 copy "dartonic_studio: ^1.0.0-beta.1" to clipboard
dartonic_studio: ^1.0.0-beta.1 copied to clipboard

Studio backend for Dartonic — HTTP API to inspect tables and run queries.

dartonic_studio #

Lightweight HTTP backend for inspecting a Dartonic database. Add it to your app to explore tables and run queries from any REST client or browser.

Installation #

dependencies:
  dartonic_studio:
    path: ../dartonic_studio   # or pub.dev version when published

Starting Studio #

import 'package:dartonic_sqlite/dartonic_sqlite.dart';
import 'package:dartonic_studio/dartonic_studio.dart';

void main() async {
  final db = await connectSqlite('app.db', schemas: [users, posts]);
  await startStudio(db, port: 4444);
  // Listening at http://localhost:4444
}
Parameter Type Default Description
db DartonicDb required Connected database handle
port int 4444 HTTP port
host String 'localhost' Bind address

Endpoints #

GET /tables #

Returns a list of all registered table names.

{ "tables": ["users", "posts"] }

GET /tables/:name #

Describes the columns of a table.

{
  "table": "users",
  "columns": {
    "id":         { "type": "INTEGER", "modifiers": ["PRIMARY KEY AUTOINCREMENT"] },
    "email":      { "type": "TEXT",    "modifiers": ["NOT NULL", "UNIQUE"] },
    "created_at": { "type": "DATETIME","modifiers": ["DEFAULT CURRENT_TIMESTAMP"] }
  }
}

POST /query #

Executes a raw SELECT query. Only SELECT statements are allowed.

{ "sql": "SELECT * FROM users LIMIT 10" }

Response:

{ "rows": [...], "count": 10 }

CORS #

All endpoints include permissive CORS headers (Access-Control-Allow-Origin: *) so the API can be consumed from a browser or external UI.

Security #

  • Only SELECT queries are accepted via /query
  • Bind to localhost (default) to avoid exposing the endpoint on the network
  • Do not run Studio in production
0
likes
150
points
29
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Studio backend for Dartonic — HTTP API to inspect tables and run queries.

Repository (GitHub)
View/report issues

Topics

#orm #database #devtools

License

MIT (license)

Dependencies

dartonic_core, shelf, shelf_router

More

Packages that depend on dartonic_studio