concepts / entities
Stable

Entities

  • Use entities for information that must survive beyond one request or page session.
  • Use indexed ID fields for stored relationships.
  • App Marché manages record IDs and timestamps.

What An Entity Owns

An entity names one durable business record and defines its stored fields. APIs, crons, and listeners can load and update these records. Page-local state and request-local values do not belong in an entity.

entities/Task.entity.nenu
1entity Task {2  title: string3  done: bool4  assignee_id: string?5}

Relationships

Model stored relationships with explicit ID fields. Use a required ID when the relationship must exist and an optional ID when the record can stand alone. Index relationship fields that are used for lookups.

entities/Submission.entity.nenu
1entity Submission {2  activity_id: string @index3  user_id: string @index4  content: string5}

For parent-scoped child records, use canonical Parent.lowerCamelChild naming. An exact child fetch with | default creates a saveable child whose durable identity combines the live parent and child key. Saving an unscoped child fails.

Indexes And Validation

RuleUse
@uniqueRequire one stored record per field value.
@indexSpeed up common filters, relationships, and sort paths.
Typed validatorsReject invalid email, slug, length, or numeric values.

For joins, a custom exact lookup on the left must use @unique so one key selects at most one record. The right-side join field may use @unique or @index because one left record can match many right records.

code
1entity Member {2  email: string @unique ! email3  workspace_id: string @index4  display_name: string ! max_length(80)5}

Managed Fields

Do not declare id, createdAt, or updatedAt in the entity body. App Marché supplies these fields for every stored record.

Screenshot
Entity records

Entity information view with fields, indexes, and stored records.