Skip to content

Configuration

ctkit reads credentials from environment variables. You can set them in a .env file at the project root.

.env
CONTENTFUL_MANAGEMENT_TOKEN=CFPAT-xxxxxxxxxxxxx
CONTENTFUL_SPACE_ID=your_space_id
CONTENTFUL_ENVIRONMENT_ID=master
VariableRequiredDefaultDescription
CONTENTFUL_MANAGEMENT_TOKENYesContent Management API token with write access.
CONTENTFUL_SPACE_IDYesThe ID of your Contentful space.
CONTENTFUL_ENVIRONMENT_IDNomasterThe environment to target.
  1. Open your Contentful space.
  2. Go to Settings → API keys.
  3. Open the Content management tokens tab.
  4. Click Generate personal token, give it a name, and copy the value.

Management tokens start with CFPAT-. Store them securely — they grant full write access to your space.

By default, ctkit looks for content type definitions in the schemas/ directory relative to your project root.

schemas/
├── blogPost.ts
├── author.ts
└── settings/
└── navigation.ts
  • Nested folders are supported — ctkit auto-discovers all .ts and .js files recursively.
  • Each file should export one or more contentType() definitions.
  • File names don’t affect the content type ID; the ID comes from the first argument to contentType().

Generated migrations are stored in migrations/. Each migration is a timestamped file that describes the changes needed to move from one content model state to the next.

migrations/
├── 0001_create_blogPost.ts
├── 0002_create_author.ts
└── 0003_add_blogPost_publishedAt.ts

Don’t edit migration files by hand — they are generated by ctkit push and applied in order. Commit them to version control to keep a history of your content model changes.