Skip to content

Entity specification

This page is generated from the canonical JSON Schema. Edit the schema and run npm run docs:generate; do not edit the generated tables directly.

The entity specification defines persisted records, fields, relations, and generation metadata.

Path Type Required Default Description and constraints
version integer No 1 Version of the Mettada entity-spec format. min: 1
entity object Yes — Entity identity and database mapping.
entity.name string Yes — PascalCase entity name used by generated classes.
entity.label string No — Singular label shown to users.
entity.plural string No — Plural label shown to users.
entity.description string No — Human-readable purpose of this entity.
entity.module string No — Optional module that owns the entity.
entity.namespace string No — Application namespace for generated models.
entity.table string No — Database table name; inferred when omitted.
entity.primary_key object No — Primary-key column configuration.
entity.primary_key.name string No "id" —
entity.primary_key.type string No "bigint" — ; enum: “bigint”, “integer”, “uuid”, “string”
entity.primary_key.auto_increment boolean No true —
meta object No — Controls Eloquent timestamps, soft deletes, and activity logging.
meta.timestamps boolean No true Use created_at/updated_at columns and Eloquent timestamps.
meta.soft_deletes boolean No false Add deleted_at and Eloquent SoftDeletes support.
meta.auditable boolean No false Log model activity with spatie/laravel-activitylog; independent of soft deletes.
generation object No — Select generated backend and frontend artifacts.
generation.backend object No — —
generation.frontend object No — —
fields object Yes — Map field names to their data types and validation/generation metadata.
relationships object No — Relationships keyed by their application-facing name.
database object No — Database indexes and uniqueness constraints.
database.indexes array No — —
database.indexes[].fields array Yes — —
database.unique array No — —
database.unique[].fields array Yes — —
query object No — Default query behavior for generated resources.
query.default_sort object No — —
query.default_sort.field string Yes — —
query.default_sort.direction string No "asc" — ; enum: “asc”, “desc”
query.searchable array No — —
query.sortable array No — —
query.pagination object No — —
query.pagination.default integer No 25 min: 1
query.pagination.max integer No 100 min: 1
permissions object No — Ability names for entity operations.
routes object No — Resource route generation and middleware.
routes.resource boolean No true —
routes.api boolean No true —
routes.prefix string No — —
routes.middleware array No — —