Quick Start
1. Initialize a project
Section titled “1. Initialize a project”ctkit initThis creates:
schemas/— where your content type definitions livemigrations/— where generated migrations are storedctkit.config.ts— project configuration
2. Add your credentials
Section titled “2. Add your credentials”Create a .env file in the project root:
CONTENTFUL_MANAGEMENT_TOKEN=CFPAT-xxxxxxxxxxxxxCONTENTFUL_SPACE_ID=your_space_idCONTENTFUL_ENVIRONMENT_ID=masterSee the Configuration page for details on where to find these values.
3. Test the connection
Section titled “3. Test the connection”ctkit testThis verifies that ctkit can reach your Contentful space. You should see a success message with your space name and environment.
4. Define a content type
Section titled “4. Define a content type”Create a schema file at schemas/blogPost.ts:
import { contentType, fields } from '@ctkit/core';
export const blogPost = contentType('blogPost', { name: 'Blog Post', fields: { title: fields.symbol({ name: 'Title', required: true, }), body: fields.richText({ name: 'Body', }), publishedAt: fields.date({ name: 'Published At', }), },});5. Push to Contentful
Section titled “5. Push to Contentful”ctkit pushctkit diffs your local schemas against the remote content model, generates the necessary migration, and applies it to your Contentful environment.
6. Verify everything is in sync
Section titled “6. Verify everything is in sync”ctkit checkIf your local schemas match the remote content model, you’ll see:
✓ Everything is in sync.That’s it — your content model is now defined in code and deployed to Contentful.