Type-to-UI Mapping Contract

Technical definition of how Drizzle/Zod types are transformed into Nuxt UI components within the nuxt-auto-crud ecosystem.

This contract defines the deterministic mapping of database schema types to UI components. It serves as a reference for AI agents to understand how specific data types will influence form generation and validation behavior.

Type-to-UI Mapping Contract

This guide defines how Drizzle/Zod types manifest as Nuxt UI components via useDynamicZodSchema.ts and Form.vue.

🧩 Component Mapping Table

Drizzle/Zod TypeField PatternComponentLogic / Constraint
boolean*UCheckboxDefaults to false.
date*UInputtype="datetime-local". Coerced via z.coerce.date().
stringpasswordCommonPasswordCreate only. UI is read-only on Edit.
`stringnumber`*Id, *_idCrudNameList
enum*USelectItems mapped from field.selectOptions.
textarea*UTextareaTriggered by field.type: 'textarea'.
stringstatusUSelectPermission-gated via canUpdateStatus.

🛡️ Operational Guardrails

  • System Fields: id, createdAt, updatedAt, deletedAt (and snake_case variants) are stripped by Form.vue and the Nitro backend.
  • Labeling: Labels are derived via capitalCase(fieldName.replace(/(_id|Id)$/, '')).
  • Passwords: Only accepted on POST. Stripped from PATCH payloads automatically.