Skip to content

Spec File Format

Entity Definition

entities:
  EntityName:
    label: "English label"
    labelPlural: "English plural"
    type: "Base|BasePlus|Event|Person|Company"
    table: "snake_case_table_name"
    iconClass: "fas fa-icon"
    color: "#hexcolor"

    fields:
      fieldName:
        type: string          # Field type (see below)
        label: string         # Label
        required: bool        # Required?
        default: any          # Default value
        readonly: bool        # Read-only?
        # ... other attributes per type

    links:
      linkName:
        type: string          # hasMany|belongsTo|hasOne|etc
        entity: string        # Target entity
        foreign: string       # Field in target entity
        relationName: string  # For many-to-many

    layouts:
      detail: list            # Detail view layout
      list: dict              # List view layout
      filters: list           # Filters

    indexes: list             # Database indexes

Complete Entity Example

entities:
  ServiceRequest:
    # Basic metadata
    label: "Service intervention"
    labelPlural: "Service interventions"
    type: "Base"
    table: "service_request"
    iconClass: "fas fa-wrench"
    color: "#e74c3c"

    # Fields
    fields:
      number:
        type: "autoincrement"
        pattern: "SRV-{YYYY}-{0000}"
        label: "Intervention number"
        required: true
        readonly: true

      account:
        type: "link"
        entity: "Account"
        label: "Account"
        required: true
        audited: true

      priority:
        type: "enum"
        options:
          - value: "Critical"
            label: "Critical"
            color: "#dc3545"
          - value: "High"
            label: "High"
            color: "#fd7e14"
          - value: "Normal"
            label: "Normal"
            color: "#0d6efd"
          - value: "Low"
            label: "Low"
            color: "#6c757d"
        default: "Normal"
        required: true

    # Relationships
    links:
      account:
        type: "belongsTo"
        entity: "Account"
        foreign: "serviceRequests"

      assignedUser:
        type: "belongsTo"
        entity: "User"
        foreign: "assignedServiceRequests"

    # Database indexes
    indexes:
      - fields: ["accountId", "status"]
      - fields: ["assignedUserId", "status"]
      - fields: ["createdAt"]

➡️ Continue with Field Types.