Skip to content

Pull-first Workflow

The pull-first workflow is for teams that already have content types in Contentful and want to start managing them with ctkit. Instead of recreating your content model by hand, ctkit generates TypeScript schema files from your existing space.

pull → review generated schemas → adjust → continue with migration or push
  1. Pull — ctkit reads your Contentful content types and generates schema files.
  2. Review — inspect the generated code, make adjustments.
  3. Continue — switch to the migration or push workflow for ongoing changes.
Terminal window
ctkit pull

ctkit connects to your Contentful space, reads every content type, and generates a .ts file for each one in your schemas/ directory:

✓ Pulled 5 content types
schemas/blogPost.ts
schemas/author.ts
schemas/category.ts
schemas/navigation.ts
schemas/siteSettings.ts

To pull a specific content type:

Terminal window
ctkit pull --content-type blogPost

To overwrite existing local files:

Terminal window
ctkit pull --force

Open the generated files and verify they look correct. ctkit maps Contentful field types, validations, and settings into their schema equivalents as accurately as possible.

Terminal window
ctkit check

If check reports everything is in sync, the generated schemas faithfully represent your remote content model.

You may want to:

  • Reorganize files — move schemas into subdirectories (e.g., schemas/blog/blogPost.ts). ctkit auto-discovers all .ts and .js files regardless of nesting.
  • Add comments — annotate fields with context that only exists in your team’s heads.
  • Clean up names — rename the exported variables for consistency.
  • Review edge cases — complex field configurations, deeply nested validations, or unusual content type setups may need manual tweaking.

From here, you have two options:

Migration workflow (recommended for teams):

Terminal window
# Make a schema change, then:
ctkit generate
ctkit migrate
ctkit check

Push workflow (for rapid iteration):

Terminal window
# Make a schema change, then:
ctkit push
  • Run check after pulling. If the output shows no differences, you know the pull was accurate. If there are diffs, review and adjust before continuing.
  • Commit the generated files. Once you’re happy with the schemas, commit them to source control. They’re now the source of truth for your content model.
  • Pull is a one-time operation. You use it to bootstrap your local schemas. After that, you make changes locally and push or migrate them to Contentful — not the other way around.
  • System content types are skipped. ctkit won’t pull its own internal content types (like ctkit_migration_history).