Field Types

Radiant supports 15 field types. Each maps to a specific database column type and TypeScript type. You can also nest objects as field types.

Scalar Types

TypeSQL StorageTypeScriptExample
textTEXTstringname: text
textareaTEXTstringdescription: textarea
richtextJSONBanybody: richtext
emailTEXTstringemail: email @unique
passwordTEXT (hashed)stringpassword: password
booleanBOOLEANbooleancompleted: boolean @default(false)
integerINTEGERnumberviewCount: integer
numberNUMERICnumberprice: number
dateTIMESTAMPTZstringpublishedAt: date @optional

text vs textarea — Both store as TEXT. The difference is semantic: textarea signals the admin UI to render a multi-line input.

password — Hashed automatically on write (bcrypt/argon2). Omitted from the generated model interface and API responses, but included in the Create input type.

email — Validated against an email pattern on create/update.

date — Stored as TIMESTAMPTZ. Values are ISO 8601 strings in TypeScript.

Selection Types

select

Enumerated type with a fixed set of string options. Requires at least one option — the compiler errors on zero.

status: select("draft", "published", "archived")
// Generated TypeScript
status: "draft" | "published" | "archived"

multiselect

Multiple string selections stored as TEXT[].

tags: multiselect("work", "personal", "urgent")
tags: string[]

Enum shorthand

An inline enum defined as an array literal. Same result as select but more concise for simple cases.

role: ["admin", "user"] @default("user")
role: "admin" | "user"

Relationship Type

relationship

A foreign key reference to another collection. The first argument is the target collection slug — it must exist, or the compiler produces a semantic error.

author: relationship("users")
// Base model (unpopulated):
author: string

// Populated model:
author: Users

Mark a relationship as an array with []:

tags: relationship("tags")[]

Complex Types

TypeSQL StorageTypeScriptExample
jsonJSONBanymetadata: json @optional
uploadJSONBanyavatar: upload @optional
array(type)JSONBT[]scores: array(integer)

array — Wraps another type. You can also use the [] suffix on any type: tags: text[].

upload — Stores file metadata (path, size, MIME type) as JSON.

Nested Object Fields

Fields can contain nested objects with their own field definitions. The nested object is stored as JSONB.

collection products {
  fields: {
    name: text
    dimensions: {
      width: number
      height: number
      unit: text
    }
  }
}
// Generated TypeScript
dimensions: { width: number; height: number; unit: string }

Auto-Generated Fields

Every collection automatically includes these — you never declare them:

FieldTypeScriptDescription
idstring (UUID)Primary key, auto-generated
createdAtstringISO timestamp, set on creation
updatedAtstringISO timestamp, updated on every modification