BrandApp Playground

Schema Sync

End-to-end walkthrough: author the schema, push it via syncSchema, inspect the diff and compatibility report, then consume the generated ATTRIBUTE_IDS. Sync reshapes the schema; to backfill record data alongside a schema change, see Migrations (/eav/migrate).

Author lib/eav.schema.ts with defineEntity / defineSchema.

Edit lib/eav.schema.ts in your project, then move to step 2 to push it to the BrandApp. The right pane shows the exact file shape.

lib/eav.schema.ts
// lib/eav.schema.ts
import { defineEntity, defineSchema } from "@reopt-ai/brandapp-sdk/eav/schema";

const contacts = defineEntity({
  name: "contacts",
  description: "Contact directory",
  attributes: {
    name: { dataType: "string", label: "Name", isRequired: true },
    email: { dataType: "email", label: "Email", isUnique: true },
    status: {
      dataType: "select",
      label: "Status",
      options: [
        { value: "active", label: "Active" },
        { value: "inactive", label: "Inactive" },
      ] as const,
    },
  },
});

export default defineSchema({ entities: { contacts } });