Subchapter 6.7
references/strapi.mdMarkdown6 KBView on GitHub
Before writing migration code, determine:
__component values.Access changes extraction completeness more than downstream complexity:
| Access | Best use | Main risk |
|---|---|---|
| Repository | Prove schemas, components, dynamic zones | Does not contain content values |
| Public REST | Fast published-content extraction | Omits drafts/private fields and cannot prove completeness |
| Admin/authenticated API | Drafts, unpublished entries, private fields | Requires approved credentials |
| GraphQL | Typed extraction when enabled | Introspection may be disabled |
| Database | Completeness checks, hidden data | Requires manual joins through relation/morph tables |
REST with populate is often better than raw database extraction because Strapi returns joined relationships and components.
Snapshot all extracted records before transformation. For REST extraction, explicitly request deep population for nested components and dynamic zones.
When repository or admin access is available, prove the schema before sampling content:
# Content type schemas
ls src/api/*/content-types/*/schema.json
# Component schemas
ls src/components/*/*.json
# Strapi configuration snapshot
npx strapi configuration:dump --file strapi-config.jsonWith admin API access, inspect the content-type builder:
curl "http://localhost:1337/admin/content-type-builder/content-types" \
-H "Authorization: Bearer <admin-token>"Each Strapi schema file contains info, attributes, and options. Use these to find field types, validations, draft/publish settings, timestamps, components, dynamic zones, media, and relations.
_type per __component.documentId is the best stable source key. Use it for deterministic Sanity IDs and locale grouping.language fields and translation metadata.For localized Strapi v5 content, a useful deterministic ID pattern is <type>.<documentId>.<locale>.
Field mapping defaults:
string maps to string.text maps to text.richtext maps to Portable Text.number, integer, float, and decimal map to number.date, datetime, and time map to the closest Sanity date/datetime strategy the frontend expects.media maps to image, file, or arrays of those.relation maps to reference or an array of references.component maps to a named object type.dynamiczone maps to an array of union object types.__component values across all records, not a sample.documentId in Strapi v5. For v4, choose a stable fallback such as content type plus numeric ID or slug, and document the risk.hash when available.Body conversion depends on editor format:
@portabletext/markdown, with custom handling for GFM tables, fenced code, and inline images.@portabletext/block-tools with JSDOM or a custom converter if the HTML is inconsistent.hash when present; otherwise use source URL/path plus filename.oldUrl/hash -> asset _id.documentId is stable across locales and draft/published variants; numeric IDs are less useful for cross-locale identity.populate depth limits can hide nested dynamic-zone data. Test deeply nested examples.populate parameters, component usage, custom plugin fields, and expected response shapes.__component value is mapped or intentionally skipped.