Skip to Content
New to cms0? Start with the hosted, self-hosted, or app integration path.

The shape you pass to cms0<T>() becomes the shape of the client.

src/example.ts
const homePage = await cms.homePage(); const articles = await cms.articles();

Accessors are generated from the TypeScript shape that the CLI publishes. If an accessor is missing, republish the schema.

Root content

Root content is a singleton.

src/example.ts
const homePage = await cms.homePage(); await cms.homePage.update({ headline: "A better headline", });

Collections

Array fields become collection accessors.

src/example.ts
const articles = await cms.articles(); const article = await cms.articles.byId("article_id"); await cms.articles.create({ title: "Launch notes", slug: "launch-notes", }); await cms.articles.update("article_id", { title: "Updated title", }); await cms.articles.delete("article_id");

Options

Accessors accept read options:

src/example.ts
const homePage = await cms.homePage({ fields: ["headline", "seo.title"], exclude: ["seo.jsonLd"], graph: { pageSize: "full", paths: { "seo.openGraph.images": { pageSize: 50 }, }, }, includeId: true, locale: "en", });

Use:

  • fields to include specific nested paths
  • exclude to remove specific nested paths
  • graph.page, graph.pageSize, graph.orderBy, graph.orderDir, and graph.search to control resolved graph arrays recursively
  • graph.paths to override graph controls for a nested dot path such as seo.openGraph.images
  • includeId to include cms0 object IDs
  • locale when reading localized content
  • response: "envelope" when you need response metadata

fields and exclude control the returned shape. Graph pagination and sorting live under graph so a read like cms.homePage({ fields: "seo", graph: { pageSize: "full" } }) applies the full page size to nested graph-backed arrays inside seo. Resolved root reads default to graph.pageSize: "full".

Success check

Accessor calls should match your TypeScript schema. If a field does not exist on the client, publish the schema again and confirm the entry file in cms0.config.ts points at the file that calls cms0<T>().