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.
Recommended patterns
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:
- Add new fields before removing old fields.
- Roll out readers that tolerate both old and new shapes.
- Backfill content where needed.
- Remove legacy fields after validation in production.