Skip to Content
Read the release notes before upgrading production environments.
Content ModelingSchema Design

Modeling principles

cms0 treats your TypeScript schema as the contract for:

  • Content structure
  • Validation shape
  • Generated API resources
  • Typed SDK accessors

Design your schema for long-term clarity, not only short-term speed.

1) Stable root resources

Use predictable root names and avoid frequent renames.

type RootSchema = { HomePage: { title: string }; SiteSettings: { brandName: string }; };

2) Collections for repeatable content

Use arrays for list-like resources such as posts, testimonials, and FAQs.

type RootSchema = { BlogPosts: { slug: string; title: string; body: string; }[]; };

3) Reuse shared structures

Extract repeated structures into named types.

type Cta = { label: string; href: string }; type RootSchema = { HomePage: { primaryCta: Cta; secondaryCta: Cta; }; };

4) Model localization intentionally

If you need locale-aware values, use localization types consistently.

5) Keep nesting reasonable

Deeply nested objects increase editing complexity. Flatten where practical.

Migration guidance

When evolving schema:

  1. Add new fields before removing old fields.
  2. Roll out readers that tolerate both old and new shapes.
  3. Backfill content where needed.
  4. Remove legacy fields after validation in production.