Docs / Platform / Studio

v0.1.10 · Study guide

Studio visual builder

Design schema.tpy, configure the database, manage auth, and stream build/migrate/seed logs from a local UI — without requiring end users to run npm install.

What you will learn
  • How to start Studio safely on localhost
  • Preview/diff before writing schema.tpy
  • Which API endpoints power the UI

1. Setup

$ cd myapp
$ tpy studio                 # http://127.0.0.1:4200
$ tpy studio --port 5000
$ tpy studio --no-open
$ tpy studio --host 0.0.0.0  # opt-in; security warning
$ tpy studio --version

Studio binds to 127.0.0.1 by default. Non-loopback hosts print a warning because there is no auth on the Studio API.

2. How it works

  1. tpy studio starts a FastAPI app that serves the pre-built SPA from tpy/studio/ui/dist/.
  2. The UI loads the current schema as JSON via GET /api/studio/schema.
  3. Edits are previewed with POST /api/studio/schema/preview (unified diff + validation) — nothing is written yet.
  4. Explicit save calls POST /api/studio/schema/save, which serializes a deterministic schema.tpy.
  5. Build / migrate / seed stream CLI output over SSE.

3. Screens

ScreenPurpose
ModelsEdit models/fields, constraints, references
RelationsNode/edge canvas for relations { }
DatabaseProvider + connection (secrets redacted / write-only)
AuthRoles & bootstrap in .tpy/studio.json
DiffUnified diff before Apply
BuildBuild / Migrate / Rollback / Seed / Serve logs
APIMinimal try-it explorer (OpenAPI if :8000 is up)
TemplatesPreview/apply starter templates

4. Common mistakes

  • Expecting auth in schema.tpy — Studio auth lives in .tpy/studio.json; enabling JWT still uses tpy auth generation.
  • Binding to 0.0.0.0 casually — Studio has no login; keep it on localhost unless you trust the network.
  • Rollback without confirm — API requires {"confirm": true}.
  • Missing UI dist in editable installs — rebuild with cd tpy/studio/ui && npm install && npm run build.

5. Related