Studio
Studio is the admin app that ships with every Supatype stack. It builds content editors from your models and gives developers the API docs, a SQL runner and the database history in one place.
Pre-1.0: APIs and config may change between releases.
Open Studio
Studio is served at /studio/ on the project’s gateway.
- Local, Docker (the default):
supatype devprints it in the Services running panel ashttp://localhost:<gateway-port>/studio/. The port isSUPATYPE_KONG_PORTin.env. - Self-hosted:
http://<your-host>:<gateway-port>/studio/, or/studio/on your domain once HTTPS is on. See Self-host. - Local, Native:
supatype devdoes not start Studio with the Native provider.
Sign in with an email and password. The first admin comes from SUPATYPE_ADMIN_EMAIL and SUPATYPE_ADMIN_PASSWORD in .env, as described in Local development. Add more people with supatype admin create-user.
Studio also offers every OAuth provider the project has enabled. To offer only some, name them in supatype.config.ts:
studio: { auth: { providers: ["github"] } }Signing in is not enough on its own. Every person also needs a Studio role.
Finding your way
The sidebar lists, top to bottom: Dashboard and Models; Database and Media & Storage; Authentication; Edge Functions, Static site and Realtime; and Plugins. Settings is pinned at the bottom.
Some entries depend on who you are or where Studio runs. Authentication is hidden from editors and viewers. Realtime is hidden when the server does not offer the Realtime inspector. Static site appears only when the host (Supatype Cloud or a self-host deployment that provides it) describes a site, and its Deployments page needs a host that can list deployments.
Features that are not built yet have no sidebar entry. Some pages inside a group still say a feature is coming soon: Database Wrappers, Read Replicas and Analytical Warehouse under Database, Backups there too except on Supatype Cloud, and Auth Hooks and Attack Protection under Authentication.
The Static site group shows the site address, whether it is served from files or proxied to an app, and what is served, with a Settings page for the serving mode, SPA fallback and response headers. A setting that supatype.config.ts sets is marked as such. Where a deployment can list site deployments, the group has a Deployments page. A deployment that cannot describe its site has no Static site group.
Jump to in the top bar searches pages, users and records.
If the newest schema push was refused or failed, a notice shows above every screen. It says that nothing was applied and links to that push in the migration history. It goes away once a push applies.
Editing content
Studio reads your schema after each push and builds an editor for every model. There is nothing to configure: add a model, save, and it appears under Models.
The list
Each model opens on a list of its records. Columns you can sort have sortable headers. Fields wrapped in Searchable<T>, or named in the model’s searchable: [...] option, get a search box. Tick rows to delete several at once, after a confirmation. Create Post (named after the model) opens an empty form.
The record editor
Each field gets an input that matches its type: text, numbers, dates, slugs, selects, relations, JSON, code, images, files, rich text and blocks among them. The model’s name in Studio comes from label and labelPlural in its options. A form also has Duplicate and Delete, and Delete asks first.
A Slug<"title"> field follows the title on a new record. A model with hooks shows “This post has custom logic that runs on save.”
A singleton model (singleton: true) is listed under Globals and opens straight into its one record.
If the project has more than one locale, a language switcher appears in the top bar on content screens.
Model tabs
Each model has tabs beside the editor:
| Tab | Shows |
|---|---|
| Schema | The model’s fields as the database has them |
| Rules | Field bounds, constraints and indexes, as the database enforces them |
| Data | A table browser for the model’s table, with filters, inline edits and a record inspector |
| API | REST examples for this model |
| GraphQL | GraphQL examples for this model |
| Cache | The model’s cached REST responses |
Editors do not see Schema or Rules. Cache is for admins and developers.
When the cache service refuses a request, the Cache tab shows the reason the server gave, with the HTTP status after it. If the project has no keyspace behind the cache yet, it says that nothing is cached and reads go straight to the database.
Rich text and blocks
A RichText field opens a rich text editor with a toolbar for bold, italic, underline, strikethrough, headings 1 to 3, paragraphs, bullet lists and numbered lists. The field stores a Lexical document.
A Blocks<T> field is a list of sections. An editor adds a block by type, fills in its fields, and can move or duplicate it. See Slugs, rich text and blocks for how they are declared and stored.
To render a rich text field in React, pass the stored value to RichText from @supatype/react:
import { RichText } from "@supatype/react"import type { TableRow } from "@supatype/client"
export function PostBody({ post }: { post: TableRow<"post"> }) { return <RichText content={post.body} as="article" />}Media and files
Media & Storage lists your buckets. Each bucket has two tabs:
- Files: browse folders, upload files (or drop them on the page), create folders, and download or delete files. Details shows a file’s size, type, owner, dates and its public URL.
- Policies: the bucket’s access rules. Who can read or change them is on Studio roles.
Declare buckets in your schema with Bucket<> so they are versioned with everything else. Studio can create one by hand, but warns first and recommends the schema instead. See Storage.
An image field in the record editor takes a dropped file, an Upload, or Select from bucket, which browses the bucket the field names. A localized image field uploads one image per locale.
Drafts and publishing
On a model with versions: { drafts: true } (see Drafts and versions), the editor’s side panel holds the publishing controls:
- Save draft saves without changing what readers see. On a new record the first save creates it.
- Publish makes the saved draft live, saving any unsaved edits first.
- The menu beside Publish has Schedule publish… (and Change schedule… or Cancel schedule once one is set), Discard changes, which returns the draft to the published version, and Unpublish, which keeps the content as a draft.
A status badge shows Draft, Published, Scheduled or Partly published, and “Changed” when there are edits since publishing. With several locales a record can be published, and unpublished, per language.
A draft may leave a required field empty. Studio asks before saving it, and it cannot be published until the field is filled.
Who sees drafts and the publish controls is set by publishing.draft_visibility. See Drafts and publishing in Studio roles, which also covers saving drafts from the Data tab.
Version history
A model with versions keeps a history of each record. On a model with drafts, open it with History in the publishing panel. Each version shows when it was saved, by whom, and its state: Live, Scheduled, Pending draft or Superseded. Select a version to compare its fields with the newest one.
- Restore as draft brings the version back as the current draft. Nothing goes live until it is published.
- Publish this version restores it and publishes it in one step.
A model without versions says so, and keeps no history.
Live preview and preview links
Tell Studio where each model renders in your app with admin.livePreview, keyed by model name. Field names in braces are filled from the record:
admin: { livePreview: { Post: { urlPattern: "/preview/{slug}" }, },},A path is enough when the same stack serves your app (app.mode is static or proxy). With app.mode: "none" give a full URL. supatype push refuses a path in that mode.
Live preview
With this set, the editor gets a Live preview button. It opens your page in a side panel and sends the unsaved form values to it on every change. Read them with useLivePreview:
import { useLivePreview } from "@supatype/react"
export function PostPreview({ post }: { post: { title: string } }) { const { data, isPreview } = useLivePreview({ initialData: post, model: "Post" }) return <h1>{data.title}{isPreview && " (preview)"}</h1>}model is the schema’s model name, as in admin.livePreview. The hook only accepts messages from the window that frames the page, at Studio’s origin. By default that is the origin of the client in SupatypeProvider. If Studio is served somewhere else, pass studioOrigin.
Share a preview
On a saved record, Share a preview makes a link for someone without an account. Choose how long it lives: 15 minutes, 1 hour, 1 day or 7 days. The link is your preview URL with a preview query parameter. Studio lists the links it has made, and each can be revoked.
On the preview page, create a client with that code as previewCode and read the draft with .draft(). The code is the client’s whole credential: it cannot be combined with serviceRoleKey. See Drafts and publishing in Client.
API docs
Settings > API > REST opens the REST docs. They are built from your models plus the auth and storage endpoints. Each endpoint lists its parameters, an example body and response, and a curl example. Filter by category or table, or search.
Try it sends a real request and shows the response headers and body. It asks who to send as: yourself, anonymous, the service role or a pasted token. See Send as.
The REST section also has Settings and Cache tabs for admins and developers.
GraphQL explorer
The GraphQL page sends queries to POST /graphql/v1. Pick a model to start from a list query, edit it, and press Run. It uses the same Send as choice as Try it. Each model’s GraphQL tab has examples for that model.
SQL runner
Database > SQL Runner runs SQL against the project. Press Run Query, or Ctrl+Enter (Cmd+Enter on a Mac).
- Each run opens a result tab with its time. Export a result as CSV or JSON.
- Statements that drop, empty or overwrite data (
DROP,TRUNCATE,DELETE,UPDATE, and anALTERthat drops something or turns off row level security) ask first and name what they change. EXPLAIN (FORMAT JSON)draws the plan as a tree.- Query History lists earlier runs in this session.
- A
DELETEorUPDATEwith noWHEREfails withDELETE requires a WHERE clause. That ispg_safeupdate, which the image loads for every session, this runner included. WriteWHERE trueto mean every row. On a connection of your own,SET safeupdate.enabled = 0turns the check off for that session.
Database, migrations and schema objects
Editors do not see the Database pages. The SQL runner is for admins and developers only.
| Page | Shows |
|---|---|
| Overview | A diagram of your tables and their relations |
| Tables, Views, Triggers, Indexes, Constraints, Types, Roles, Extensions | The database’s objects of that kind |
| Migrations | Every push: its status, number of changes, when it was applied, who pushed it and the engine version. Open one to see its schema changes and its SQL. Filter by status and date, or search by name or id |
| Schema objects | Every object Supatype manages, from the managed-object ledger, with its status (managed, adopted or released) and a link to the migration that last changed it |
| Seeds | Each recorded supatype seed run: file, status, rows written, time and duration |
Adopted and released objects come from supatype adopt. Seed runs are covered in Seeding.
Logs
Function logs are on the Edge Functions page. Pick a function and open its Logs tab. Live tail is on by default. Turn it off to read recent logs by time range, with optional auto-refresh. A deployment that runs functions inside the server process has no worker to tail, so Studio shows recent logs instead.
The same page has an Invoke tab to call a function, and Environment Variables. See Functions.
Other screens
| Screen | For |
|---|---|
| Dashboard | Totals and recent activity for users, records, storage and the database |
| Authentication | Users (including their Studio access), access policies, providers, SAML single sign-on (see Single sign-on), configuration and email templates. Configuration is read-only: change those settings in .env and restart the stack. A template saved under Email Templates is kept in the database until Reset to default removes it. See Auth |
| Settings | API keys, CORS origins and database settings |
| Realtime | Channels, clients, a live stream and a broadcast tester, where the deployment’s control plane supports the inspector |
Roles
What each person can see and change in Studio depends on their Studio role: admin, developer, editor or viewer. Admins and developers work with full access. Editors and viewers work within the role’s limits, and field masks still apply to them.
The full table, field masking, Send as and how to give someone a role are on Studio roles.