Entity Reference
Define entities with defineEntity().
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: stringsingular identifier (example:customer).plural: stringplural 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
namevalues for entity types (product, notproducts). - 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 Behavior
menu.labelcontrols sidebar label.menu.groupmaps to projectmenuGroups.name.menu.hidden: trueexcludes entity from menu while keeping it in schema.
Entity Design Tips
- Keep entity boundaries business-centric (Catalog, CRM, ERP, etc.).
- Pick one
isPrimaryattribute 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