A CLI tool for migrating Contentful spaces to Sanity CMS. Current stable version is 5.0.0. It generates Sanity schemas, types, and prepares dataset NDJSON files for import. Supports Contentful management tokens and access tokens. Requires Node >=20. Ships TypeScript types. Differentiates from manual migration by automating schema generation and dataset preparation.
npm install contentful-to-sanityNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Migrate a Contentful space to a locally prepared Sanity project.
Upgrade Node.js to v20 or later.
Use Sanity CLI v3 when creating the destination project.
Generate a personal token in Contentful Settings → API keys → Content management tokens.
The Studio will reflect import progress in real-time.
Replace 'import {schemaTypes} from ./schemas' with 'import {types as schemaTypes} from ./schema' in sanity.config.ts.Use npx contentful-to-sanity@latest or npm install -g contentful-to-sanity.
Run with all required flags: npx contentful-to-sanity@latest -s <space-id> -t <management-token> -a <access-token> ./migrate
Generate a new personal token in Contentful and use with -t flag.
Upgrade Node.js to v20 or later.
No dependency data recorded yet.