Pottr/Docs
Topic:Blueprints & Schema Migrations
Build & Integrate
.md

Blueprints & Schema Migrations

Declarative schema definitions for automated, non-destructive application provisioning on boot or deploy.

What are Blueprints?

A Blueprint is a JSON document declaring your application’s required collections, fields, and user authentication profile schema. When submitted to Pottr, the engine provisions missing collections and adds new fields automatically.

Additive, Non-Destructive Provisioning

Pottr provisioning is strictly additive:

  • Existing collections and entries are never dropped or deleted.
  • Existing fields retain their data.
  • Any field defined in the blueprint that does not yet exist is safely added to the schema.
  • The required primary title text field is automatically prepended if omitted.

Public vs Secret Provisioning Endpoints

EndpointRequired CredentialTypical Usage
POST /auth/bootstrapPublic Key (pk_live_...)Client-side web or mobile applications on initial boot. Rejects secret keys.
POST /blueprintSecret Key (sk_live_...)CI/CD deployment pipelines, build scripts, backend provisioning.
GET /blueprint/{app}Public or Secret KeyInspect live provisioned schema and version status.

Blueprint JSON Specification

blueprint.json
{
  "app": "task-manager",
  "version": "1.0.0",
  "auth": {
    "slug": "users",
    "name": "App Users",
    "fields": [
      { "key": "full_name", "type": "text", "required": true },
      { "key": "avatar_url", "type": "text" }
    ]
  },
  "collections": [
    {
      "slug": "project",
      "name": "Projects",
      "fields": [
        { "key": "title", "type": "text", "required": true },
        { "key": "user_id", "type": "relation" }
      ]
    },
    {
      "slug": "task",
      "name": "Tasks",
      "fields": [
        { "key": "title", "type": "text", "required": true },
        { "key": "project_id", "type": "relation", "target_collection": "project" },
        { "key": "completed", "type": "boolean" }
      ]
    }
  ]
}

Rules and Limits

  • Collection slugs match ^[a-z][a-z0-9_-]*$; field keys match ^[a-z][a-z0-9_]*$.
  • Auth fields can use the collection field types plus select, email, url and password. They describe the per-app user profile.
  • Provisioning is additive, so it is safe to run on every deploy or app boot.
  • If your plan’s collection limit is reached part-way, provisioning succeeds partially. Check each item in the response.

Provisioning Response

Response
{
  "app": "task-manager",
  "version": "1.0.0",
  "version_status": "new",
  "auth": { "slug": "users", "status": "created" },
  "results": [
    { "slug": "project", "status": "created" },
    { "slug": "task", "status": "existing" },
    { "slug": "report", "status": "failed", "code": "plan_limit_exceeded" }
  ]
}

Each result is created, existing or failed. version_status tells you whether this app version is new, unchanged or older than the one Pottr already recorded.

GET /blueprint/{app} returns the recorded version, the auth snapshot, timestamps and the live schema of the collections that app manages.