Standards Docs
Quickstart

First object

Define a typed object with attributes and register it with the standards registry.

// @noverify
import { object, text, number, registry } from "@stndrds/schema";

export const contact = object({ name: "contact", label: "Contact" })
  .attribute(text({ name: "full_name", label: "Full name" }).required())
  .attribute(number({ name: "score", label: "Score" }));

registry.register(contact);

Each .attribute() call extends the inferred TypeScript type of the object. The builder accumulates attributes at the type level, so contact carries full autocompletion for record values with no manual type declarations.

Two configuration keys appear in every builder config:

  • name — the technical identifier (snake_case). Used as the database column name and in API payloads.
  • label — the human-readable string displayed in the UI.

Keep name stable after the first migration — renaming it requires a database column rename. label can change freely at any time.

registry.register(contact) makes the object available to the runtime, the API layer, and all UI components. Call this once per object at module initialization time.