Skip to Content
SchemaEntity Reference

Entity Reference

Define entities with defineEntity().

React
import { defineEntity } from '@flexkit/studio';
 
export const customers = defineEntity({
  name: 'customer',
  plural: 'customers',
  menu: {
    label: 'Customers',
    group: 'sales',
  },
  attributes: [
    {
      name: 'name',
      label: 'Name',
      scope: 'global',
      dataType: 'string',
      inputType: 'text',
      isPrimary: true,
      defaultValue: '',
    },
  ],
});

Entity Shape

  • name: string singular identifier (example: customer).
  • plural: string plural collection name (example: customers).
  • menu?: { hidden: true; label?: string } | { label?: string; group?: string; icon?: JSX.Element }
  • attributes: Attribute[] list of field definitions.

Naming Guidelines

  • Use singular name values for entity types (product, not products).
  • Use alphanumeric or underscore names for compatibility.
  • Keep names stable: changing names impacts queries, references, and migrations.
  • Avoid reserved/system-like names for fields and entities when possible.
  • menu.label controls sidebar label.
  • menu.group maps to project menuGroups.name.
  • menu.hidden: true excludes entity from menu while keeping it in schema.

Entity Design Tips

  • Keep entity boundaries business-centric (Catalog, CRM, ERP, etc.).
  • Pick one isPrimary attribute for predictable relationship display.
  • Normalize shared concepts into separate entities (currency, country, tag, supplier).
  • Model cross-entity workflows via relationships, not duplicated text fields.
Last updated on

© 2026