Documentation · v3.6.0
Content as code.
Hosted by you.
Trokky is a headless CMS written in TypeScript. Your schema is code, your content is yours to read and commit, and your frontend compiles against types generated from the same schema.
-
$ brew install trokky/tap/trokky -
$ trokky create my-site --template minimal --data filesystem $ cd my-site && npm install && npm run devStudio → http://localhost:3000/studio
One definition
Write the schema once. Everything else follows from it.
The object you export drives storage validation, the editing form in Studio, and the interfaces your frontend compiles against. Rename a field and your build fails, instead of your page.
- 01 You write
schemas/post.ts export const postSchema = {name: 'post',title: 'Post',type: 'document',fields: {title: { type: 'string', title: 'Title', required: true },slug: { type: 'slug', title: 'Slug', source: 'title' },body: { type: 'richtext', title: 'Body' },coverImage: { type: 'media', title: 'Cover image' },publishedAt: { type: 'date', title: 'Published at' },},} - 02
trokky generate-typeswritessrc/types/trokky/index.ts export interface PostDocument extends BaseDocument {_type: 'post'title: stringslug?: stringbody?: RichTextValuecoverImage?: MediaFieldValue | nullpublishedAt?: string} - 03 Studio renders Title * Spring opening hoursSlug spring-opening-hoursBody From 21 March the office opens at 8:00 on weekdays and closes at noon on Saturdays.Cover image Drop an image or browsePublished at 2026-03-21Save draft Publish
Principles
- 01
Schemas are code
Define content in TypeScript. One definition drives storage, validation, the admin UI and the types your frontend compiles against.
- 02
Content you can read
Documents are JSON on disk by default: open them, diff them, commit them. Move to Postgres or Cloudflare D1 with a configuration change.
- 03
Types that follow the schema
trokky generate-types derives interfaces from the running server. Rename a field and your frontend stops compiling, instead of stopping working.
- 04
You host it
An Express app you deploy. No per-seat pricing, no API quota, no export button you hope still works.
Find your way
Organised by what you are trying to do.
Trokky — a TypeScript-native headless CMS you host yourself. Open source.