<!-- https://svgrid.com/docs/enterprise/studio/api/ - SvGrid documentation as markdown. Index of every page: https://svgrid.com/llms.txt -->

# Studio API reference

Every Studio export in one place, grouped by what it does. Each links to the guide
with the full detail. All are imported from **`@svgrid/enterprise`** unless noted;
`createServerDataSource` is from `@svgrid/grid`.

## Data sources

Each returns a [`ServerDataSource`](https://svgrid.com/docs/enterprise/studio/data-binding/) - the one contract the grid,
form, sorting, filtering, paging, and CRUD all speak.

| Function | Signature (key options) | Guide |
| --- | --- | --- |
| `createInMemoryDataSource` | `(rows, schema)` | [In-memory](https://svgrid.com/docs/enterprise/studio/in-memory/) |
| `createSqlDataSource` | `({ schema, table, dialect, execute, dbSchema?, returning? })` - `dbSchema` qualifies the table as `"schema"."table"` | [Databases](https://svgrid.com/docs/enterprise/studio/databases/) |
| `createSupabaseDataSource` | `({ client, table, schema, searchColumns? })` | [Supabase](https://svgrid.com/docs/enterprise/studio/supabase/) |
| `createRestDataSource` | `({ url, schema, headers?, query?, buildQuery?, parse? })` | [REST & custom APIs](https://svgrid.com/docs/enterprise/studio/rest-api/) |
| `offsetLimitAdapter` / `dummyJsonAdapter` / `jsonServerAdapter` | wire-format `{ buildQuery, parse }` presets for real server paging/sort - spread into `createRestDataSource` | [REST & custom APIs](https://svgrid.com/docs/enterprise/studio/rest-api/#adapters-for-common-apis) |
| `createKitDataSource` | `({ endpoint })` - the SvelteKit-transport client | [REST & custom APIs](https://svgrid.com/docs/enterprise/studio/rest-api/) |

## Controller & transport

| Symbol | Signature | Purpose |
| --- | --- | --- |
| `createServerDataSource` *(from `@svgrid/grid`)* | `(source, { pageSize, optimistic?, getRowId, onChange })` | Reactive controller: state, lifecycle, optimistic CRUD. Methods: `refresh` / `setSort` / `setFilter` / `setPage` / `setPageSize` / `createRow` / `updateRow` / `deleteRow`. See [Data binding](https://svgrid.com/docs/enterprise/studio/data-binding/). |
| `createKitHandlers` | `({ schema, source })` -> `{ POST }` | Server-side handler for a `+server.ts` route; one JSON endpoint for read + CRUD. |
| `withEntityRules` | `(source, schema)` -> `ServerDataSource` | Wrap a source so [computed fields + hooks](https://svgrid.com/docs/enterprise/studio/business-logic/) apply on read/write. |

## Schema helpers

| Function | Signature | Returns |
| --- | --- | --- |
| `schemaToColumns` | `(schema)` | `ColumnDef[]` for `<SvGrid>`. |
| `schemaToFormFields` | `(schema)` | Field descriptors for `<SvGridEditPanel>`. |
| `resolveIdField` | `(schema)` | The id field name. |
| `validateField` | `(field, value)` | Built-in validation result. |
| `applyComputed` | `(schema, row)` | Row with [computed fields](https://svgrid.com/docs/enterprise/studio/business-logic/) materialized. |

See [The EntitySchema](https://svgrid.com/docs/enterprise/studio/schema/) for the model these read.

## Components

| Component | Key props | Guide |
| --- | --- | --- |
| `SvGridEditPanel` | `schema`, `row`, `presentation` (`modal` \| `drawer` \| `inline`), `onSubmit({ mode, id, values })`, `onCancel` | [Edit forms](https://svgrid.com/docs/enterprise/studio/edit-forms/) |
| `SvGridMasterDetail` | `schema`, `data`, `detailSchema`, `getChildren`, `containerHeight?`, `detailHeight?` | [Master-detail](https://svgrid.com/docs/enterprise/studio/master-detail/) |
| `SvSchemaDashboard` | `schema`, `rows` \| `getAggregate`, `spec?`, `refreshKey?`, `filterModel?`, `onDrill?` | [Dashboards](https://svgrid.com/docs/enterprise/studio/dashboards/) |
| `SvSchemaChart` | schema-bound chart (dimension / measure / reduce / type) | [Dashboards](https://svgrid.com/docs/enterprise/studio/dashboards/) |
| `SvSchemaDesigner` | `schema`, `onChange?`, `showPreview?` | [Schema designer](https://svgrid.com/docs/enterprise/studio/designer/) (embeddable, single entity) |
| `SvStudioDesigner` | `project`, `onChange?` | [Visual app designer](https://svgrid.com/docs/enterprise/studio/app-designer/) |
| `SvLookupInput` / `createRelationLookup` | searchable foreign-key picker over any `ServerDataSource` | [Relations](https://svgrid.com/docs/enterprise/studio/relations/) |
| `SvAuthGate` | `client`, `title?` | [Auth](https://svgrid.com/docs/enterprise/studio/auth/) |

## Auth & realtime

| Symbol | Signature | Guide |
| --- | --- | --- |
| `createSupabaseAuth` | `({ client, onChange })` -> `{ signIn, signUp, signOut, getState, dispose }` | [Auth](https://svgrid.com/docs/enterprise/studio/auth/) |
| `createSupabaseRealtime` | live refetch / row-flash on Postgres change streams | [Real-time](https://svgrid.com/docs/enterprise/studio/realtime/) |
| `introspectSupabaseTable` | `({ url, key, table })` -> `EntitySchema` (reads columns + FKs) | [Supabase](https://svgrid.com/docs/enterprise/studio/supabase/) |
| `listSupabaseTables` | `(url, key)` -> `string[]` (table names from the PostgREST doc) | [Supabase](https://svgrid.com/docs/enterprise/studio/supabase/) |

## Designer & project model

| Symbol | Signature | Purpose |
| --- | --- | --- |
| `createProject` | `(schemas, { title })` -> `StudioProject` | Seed a designer project (one screen per entity). |
| `serializeProject` / `parseProject` | `(project)` / `(json)` | Save / reopen a `studio.config.json`. |
| `emitStudioProject` | `(project)` -> `{ path, contents, description }[]` | The app's source files. |

See the [visual app designer](https://svgrid.com/docs/enterprise/studio/app-designer/).

## Types

`EntitySchema`, `EntityField`, `DashboardSpec` (from `@svgrid/enterprise`);
`ServerDataSource`, `ServerRequest`, `ServerState`, `ColumnDef` (from
`@svgrid/grid`). The [EntitySchema reference](https://svgrid.com/docs/enterprise/studio/schema/) documents the field
options in full.

## See also

- [Data binding](https://svgrid.com/docs/enterprise/studio/data-binding/) - the `ServerDataSource` contract
- [The EntitySchema](https://svgrid.com/docs/enterprise/studio/schema/) - the model everything derives from
- [SvGrid Studio overview](https://svgrid.com/docs/enterprise/studio/)

---

SvGrid is the Svelte 5 data grid (`npm install @svgrid/grid`, MIT). This page: https://svgrid.com/docs/enterprise/studio/api/ . All docs: https://svgrid.com/llms.txt
