> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doglytdc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Per-script server

> Typed tables, endpoints and explicit publication through the Dev panel or MCP.

The **Server** keeps each script's data and endpoints separate. Only the script owner administers this area. Tables are typed logical tables persisted in PostgreSQL, not independent Supabase projects.

## Prepare and publish

1. Open **Dev panel → Server → Overview → Prepare server**.
2. Create columns, types and permissions in **Tables**. Set the method, path, input and handler in **Endpoints**.
3. **Save file** writes the repository but does not activate the server. Validate and review changes.
4. Choose **Publish server** and confirm. Public resources can be used without signing in.
5. Test the endpoint with real input and read the saved record in its table.

With MCP, use `server_get_guide`, `server_get`, `server_prepare`, `table_create`, `endpoint_create`, `server_validate`, `server_plan_changes`, `server_publish` and `endpoint_test`. File changes require `expected_head`; publishing requires `request_key` and public-access confirmation when applicable. AI tools follow the panel's approval and permission rules.

## Files and profile

`supabase/script.md` contains the name, photo, description and immutable script ID. Updating the script profile synchronizes this Markdown. `supabase/server.json` contains `{"version":1}`. Read `supabase/README.md` and `supabase/SKILL.md` before editing.

Each table uses `supabase/tables/<name>.json`. Each endpoint uses `supabase/endpoints/<name>/endpoint.json` and `handler.js`. This folder is private; do not expose implementation details in the README shown to end users.

## Fields, permissions and operations

Types: `text`, `number`, `integer`, `boolean`, `date`, `datetime`, `enum`, `json` and `reference`. Use `required`, `default`, `min`, `max`, `minLength` and `maxLength` where appropriate. Enums require `values`; references require `table` within the same script. `unique` and `indexes` are lists of column lists. Indexes are declarative; queries use shared infrastructure, not arbitrary PostgreSQL indexes.

Per-operation rules (`read`, `insert`, `update`, `delete`): `owner` means the script owner; `users` accepts any validated session; `own` filters the caller's own records; `public` accepts visitors. Default: `owner`. The server sets authorship and script identity, never client-provided fields.

`doglytdc.db.table(name)` provides `get(id)`, `list({limit,cursor,where,sort,order})`, `count(where)`, `insert(data)`, `update(id,data,revision)` and `delete(id,revision)`. Updates require the record revision. Filters are equality objects over declared columns. Custom sorting cannot be combined with a cursor in this version.

## Endpoints and limits

Methods: GET, POST, PUT, PATCH and DELETE. Paths are literal and relative, with no dynamic parameters in this version. GET reads `request.query`; other methods read `request.body`. `input` and optional `output` validate declared fields. Define a synchronous `handler`, without Deno, filesystem access or unrestricted network access. `doglytdc.*` calls already wait for their results.

Copy the complete URL shown under Test. User endpoints use a validated session; never embed an administrative key in a distributed script. Public endpoints work without signing in. Panel tests execute as the owner, not as another simulated user.

Limits: 20 tables, 30 endpoints, 40 columns/table, 10,000 records/table, 64 KB/record, 100 records/page and 5 seconds/execution. JSON/CSV import accepts batches of up to 100 records with individual validation; earlier records remain saved if a later record fails. Export follows pagination.

## Versions, data and errors

Publication is atomic; failure preserves the previous version. Removing populated tables/columns, changing types or restricting enums incompatibly is blocked. Export before changing data structures. Restoring code does not undo records; incompatible data blocks rollback.

`supabase/migrations/*.json` accepts declarative notes `{"version":1,"description":"..."}`. It does not execute SQL or delete data. Table definitions drive additive changes.

Main errors: `OWNER_ONLY`, `HEAD_MOVED`, `INVALID_SERVER`, `PUBLIC_ACCESS_CONFIRMATION`, `REVISION_CONFLICT`, `VERSION_CONFLICT`, `UNIQUE_CONFLICT`, `INVALID_REFERENCE`, `DATA_MIGRATION_REQUIRED`, `QUOTA_EXCEEDED`, `BACKEND_UNAVAILABLE`.

Legacy `supabase/functions/*.js`, `collections.json` and `doglytdc.db.collection()` remain compatible. Preparing the folder does not convert or publish these resources. No free-form SQL, arbitrary joins, extensions or Realtime in this release.

## Complete example

```json supabase/tables/tasks.json theme={null}
{
  "columns": {
    "text": {
      "type": "text",
      "required": true,
      "maxLength": 200
    },
    "done": {
      "type": "boolean",
      "default": false
    }
  },
  "permissions": {
    "read": "own",
    "insert": "users",
    "update": "own",
    "delete": "own"
  },
  "unique": [],
  "indexes": []
}
```

```json supabase/endpoints/save-task/endpoint.json theme={null}
{
  "method": "POST",
  "path": "tasks",
  "access": "users",
  "input": {
    "text": {
      "type": "text",
      "required": true,
      "maxLength": 200
    }
  }
}
```

```javascript supabase/endpoints/save-task/handler.js theme={null}
function handler(request) {
  return doglytdc.db.table('tasks').insert({
    text: request.body.text
  });
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.