Configuration
Environment variables
Section titled “Environment variables”ctkit reads credentials from environment variables. You can set them in a .env file at the project root.
CONTENTFUL_MANAGEMENT_TOKEN=CFPAT-xxxxxxxxxxxxxCONTENTFUL_SPACE_ID=your_space_idCONTENTFUL_ENVIRONMENT_ID=master| Variable | Required | Default | Description |
|---|---|---|---|
CONTENTFUL_MANAGEMENT_TOKEN | Yes | — | Content Management API token with write access. |
CONTENTFUL_SPACE_ID | Yes | — | The ID of your Contentful space. |
CONTENTFUL_ENVIRONMENT_ID | No | master | The environment to target. |
Getting a management token
Section titled “Getting a management token”- Open your Contentful space.
- Go to Settings → API keys.
- Open the Content management tokens tab.
- 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.
Schema directory
Section titled “Schema directory”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
.tsand.jsfiles 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().
Migration directory
Section titled “Migration directory”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.tsDon’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.