Seeding Strapi environments with content

Test and staging Strapi environments need realistic content to be useful, but copying production wholesale can expose personal data and credentials. This page explains how to seed them selectively and safely.

On this page

Seeding Strapi environments with content without copying production

Developers and editors need realistic content in development and staging to build and review Strapi 5 features, but a full copy of production brings personal data, editorial drafts and admin accounts into systems with weaker controls. Seeding means filling a test environment with a deliberately chosen subset: selected content types, their entries and the components they depend on. Media files and users are normally left out. Teams need this when a feature depends on realistic entries, when editors must rehearse publishing, or when a release candidate must be checked against representative content. The usual tools are selective import and transfer between Strapi instances, so the first decision is which of them your project's version supports for the content you need.

Before running any seed, confirm three things for your project's version. First, check how the data transfer and import features handle draft and published versions, relations, components and dynamic zones, since these behave differently across releases and the Document Service API replaces the Entity Service API in Strapi 5. Second, confirm that your sources exclude media and user records as intended, and that relations to excluded records do not leave broken references in the target. Third, confirm the Strapi version against the current Strapi GitHub releases, because minor releases ship frequently and transfer behavior can change between them. A short written test on a throwaway database, with a checklist of content types compared before and after, is usually a better gate than trusting the documentation alone. Record which team owns the seed set and where it is stored, so the same subset can be regenerated after schema changes.

Seeding options and when each fits

This table compares four ways to fill a Strapi development or staging environment with content, listing what each carries, what it leaves out, its main risk and where it fits. Read the rows as a decision guide: the further a copy is from production, the less sensitive data it should hold. The main takeaway is that full database copies are rarely the right default for test systems.

ApproachWhat it carriesWhat it excludesMain riskBest fit
Full database copyAll content entries, relations, component data, and users and roles tables as stored in the source databaseNothing by design, so media files and secrets must be handled separatelyPersonal data and credentials reach test systems, and schema drift can break a restoreStaging only, under the same access controls as production, and only when the team needs an exact reproduction
strapi export or transfer with content-type selectionSelected content types and their entries, with options to include or skip parts of the dataMedia files and users when excluded in the command, plus any content types left unselectedRelations to unselected types can break, and the target may not match the source schema versionDevelopment and staging, when you need real content shapes without the full data set
Scripted seed data using the Document Service APIEntries that your code creates, written against the current content model and validated by StrapiEverything not written into the script, including media, users and production recordsScripts drift from the schema over time and must be rerun after content-model changesDevelopment and staging, especially for repeatable environments built in CI
Team-created fixture dataSynthetic or hand-written records that reflect expected editorial casesAll production data, so edge cases in real content may be missedCoverage gaps that appear only after launch, and content that looks unlike real editorial workDevelopment for early builds and automated tests, with staging used to check realistic volume and layout

What counts as sensitive data in a Strapi test environment

A Strapi copy used for development or staging often holds more personal and secret data than teams expect, because the same content types, tokens and integrations that run production are carried across. The six categories below are where that data usually hides. Confirm each one against your organization's data classification before any export leaves production.

End-user accounts and profiles

Records created by the Users and Permissions plugin, including names, email addresses, phone numbers, password hashes and confirmation or reset tokens. These are the most direct personal data in a Strapi project and usually the first thing a seed file should exclude. Check whether any custom fields on the user content type store addresses, dates of birth or account identifiers, and whether password hashes or reset tokens would survive a transfer. Replace users with generated accounts that cannot sign in to anything real.

Strapi SSO docs

Admin accounts and roles

Administrator users, their emails and the roles and permissions assigned to them belong to your production control plane, not to the content. Copying them into a test system can expose staff identities and give test-environment logins privileges that match production. Recreate admin users in each environment through your identity process, and confirm that any SSO configuration in the test system points to a test identity provider tenant or is disabled.

Strapi SSO docs

API tokens and environment secrets

Admin API tokens, transfer tokens, database credentials, JWT and app keys, and third-party keys often sit in .env files or in config that is copied with the project. A seed or transfer that carries these values gives test systems the ability to act as production. Keep secrets out of exported files, generate fresh keys per environment, and scan the seed bundle for values that match production secret formats before it is shared.

Uploaded media with personal data

Images, scanned documents, PDFs and audio uploaded by editors can show faces, identity documents, signatures or location details. Media is often excluded from seeding because it is stored separately from the database, so teams either forget it or copy it wholesale. Decide whether test content needs media at all, and if it does, use licensed or generated placeholder files. Check any storage bucket or CDN URL in the test configuration so it cannot serve production files.

Free-text fields with customer details

Rich text, long text and custom notes fields are where editors often paste real customer names, account references, case details or internal comments that no schema review would flag. A content type can look harmless while its body fields hold personal data. Sample entries from production with a text search for email patterns, phone formats and known customer identifiers, and replace matches with synthetic text. Treat this as a review step, since automated filters miss context.

Webhooks and integration endpoints

Webhooks, preview URLs, and connectors to email, search, CRM or payment services can reach live systems if their configuration is copied unchanged. A test publish could send customer emails, index records into a production search cluster or trigger a production workflow. Disable or repoint every outbound webhook and provider in the test environment, use sandbox credentials where a vendor offers them, and confirm which endpoints the front end calls before enabling it against staging data.

Seeding a staging environment step by step

This sequence produces a staging Strapi instance with a representative slice of content, where personal data has been removed or replaced and no production credentials or live integrations are present. Each step has a check that must pass before the next one starts.

  1. Define the content types in scope

    Start by listing the content types, components and dynamic zones that testers and editors need in staging, such as articles, landing pages, navigation and taxonomy. Mark which relations must be included so that linked entries come along with them. The owner is usually the Strapi product owner with a developer, and the output is a short written list that is agreed before any export runs. You know this step is done when every type on the list maps to a schema in the target project and anything left out is recorded with a reason.

  2. Export or script only the selected types

    Use a selective export or a script that calls the Document Service API to read only the chosen content types from the source environment, in the locales you need. Run it against a read-only database replica or a backup copy rather than the live production database, so the source is never written to. Record the command, the Strapi version and the filter used in the change ticket. The step is complete when the export file or JSON set exists and its manifest lists the content types, locales and entry counts you expected.

  3. Exclude media and user records

    Confirm that the export or script skips the upload files, the media library records that point to them, and every table used by the Users and Permissions plugin and admin users. Staging should reference placeholder media or nothing, so editors see empty image fields rather than production files. Check the export manifest and the file list for any entries from these areas. The step is done when a search of the output finds no user accounts, no admin records and no media references that resolve to production storage.

  4. Anonymize free-text personal data

    Review the exported text fields, especially author bios, comments, form submissions, contact details and rich text bodies, for personal data. Replace names, emails, phone numbers and identifiers with generated values through a transformation script, and remove free-text notes that cannot be safely rewritten. Keep the field structure and length patterns so that validation and layouts still behave as they do in production. Have a privacy or data owner sign off on the field list and sample a set of records. The step is complete when the sampled records contain only synthetic values and the sign-off is recorded.

  5. Import into an isolated staging database

    Create a dedicated staging database and a staging Strapi instance with their own secrets, and import the transformed content into them. The staging database must not share credentials, hosts or network routes with production, and the instance should not be able to reach production databases at all. Run the import with the same Strapi version as the target project. The step is complete when the import finishes without validation errors and the staging instance starts cleanly against its own database.

  6. Verify entry counts, relations and locales

    Compare entry counts per content type with the counts in the export manifest, then check that relations resolve to existing entries and that every configured locale has the expected localized content. Sample both draft and published entries and confirm that each keeps its state, since drafts that were published in production should not appear as public in staging by accident. Log every mismatch and rerun the import for the affected types. The step is done when counts match the manifest, no relation is broken and draft and published states match the source.

  7. Confirm admin SSO, API tokens and integrations stay out

    Check that the staging configuration does not contain admin SSO provider settings copied from production, that no production API tokens or transfer tokens exist, and that webhooks, email senders, payment hooks, search indexers and front-end deploy triggers are disabled or pointed at test endpoints. Also confirm that staging admin accounts are created separately under the staging identity setup. Record each check in the release log. The step is complete when a review of the configuration and the token list shows no production credentials and every outbound integration is either disabled or verified as a test target.

Keeping relations, components and drafts intact after seeding

A partial copy of a Strapi content graph often produces entries that load but point at nothing. Relations, components and dynamic zones are stored as references between documents, so if you copy an article type without the author, category or shared components it links to, the seeded entries lose those links or fail validation on save. Dynamic zones are the most fragile case because each zone entry names a component type, and a missing component definition or a skipped component block leaves editors with blank sections. Before you choose a subset, map every relation and component each seeded type depends on, follow those links until you reach content that stands alone, and include that whole closure in the seed. Treat the list as a design decision for the test environment, not a guess made during import.

Draft and published versions need a separate check, because a seed can preserve one state and silently drop the other. Confirm after each import that published entries appear with the expected content, that draft-only entries stay drafts, and that the review states your editors rely on are present if the feature is enabled on your plan. Localized entries deserve the same pass, since a locale that imports without its default-language counterpart can leave editors with empty variants. Record these checks as a repeatable script or checklist, and ask your team to confirm which Strapi features are enabled in each environment, because the features available depend on your plan.

Any seeding script that calls the Document Service API needs its own tests, since its behavior determines which versions and relations are written. Strapi 5 uses the Document Service API in place of the Entity Service API, so scripts carried over from older projects may create, publish or update documents differently than intended. Write tests that create a small graph with components, a dynamic zone, a relation and a draft, run the seed, and assert the results in the database and through the API. Re-run those tests after every Strapi upgrade and after changes to content types, because a schema change can make an otherwise valid seed fail on the next import.

Security and operational controls for seeded environments

Seeded development and staging environments often hold copies of production content, so they need the same discipline as production. The six controls below work together: they limit who can reach seed data, keep environments separated, strip sensitive values before data moves, and leave a record of every seed run.

Restricted access to staging data

Staging is often reachable by more people than production, including contractors and vendors testing features. Limit database access and admin logins to the people who run seeds and verify results, and review that list each time a new environment is stood up. Ask your team which accounts can read the seeded database directly, not only through the admin panel, because a direct database login bypasses content permissions.

Separate credentials per environment

Development, staging and production should never share database users, API tokens or admin accounts. If a staging token leaks, it should expose only staging. Create distinct Strapi API tokens and database roles for each environment, and confirm that seed scripts use the target environment's credentials rather than values copied from production configuration files.

Masking pipelines before data leaves production

Personal details, customer names, internal comments and draft legal or pricing text can all sit inside content entries. Run a masking step on the exported data before it reaches any test system, replacing names, email addresses and free-text fields with generated values. Test the pipeline on a sample and confirm that masked fields are excluded from search indexes and preview links.

Logging of seed operations

Record who started each seed, which source and target were used, the Strapi version, the content types included and the time of the run. Store these logs outside the environment being seeded so that a reset does not erase them. Without a record, a staging database containing unexpected production text cannot be traced back to its origin.

Retention and deletion of seed files

Export files and dumps created for seeding are copies of production data and should not accumulate on laptops or shared drives. Set a deletion rule for each file, tied to the purpose of the test, and confirm that CI runners and cache directories are cleared after use. Ask your team to name the owner who deletes files when a test cycle ends.

Encryption of export archives

Seed archives should be encrypted at rest and during transfer between networks, with keys held separately from the archive. Confirm which encryption options your Strapi export and transfer workflow supports in your version, and document the key owner. If your plan does not include audit logs, which are an Enterprise feature in Strapi's self-hosted pricing, plan an equivalent record of seed operations in your own logging system and confirm it with Strapi before you rely on it.

Questions teams ask before seeding Strapi environments

How much effort does seeding a Strapi environment take?

Effort depends mostly on how complex the content model is, how many locales need content, and how many fields need anonymization rules. A flat model with a few collection types and one locale is a small job. A model with nested components, dynamic zones, relations across many types and several locales means more mapping, more test runs and more checks that relations still resolve after import. Strapi's data transfer and export tooling can move content between environments, but it does not decide which records are safe to copy or how to rewrite them. Ask any partner to break the work into schema mapping, selection rules, anonymization, load runs and verification, and to price each part separately.

Can our own team seed Strapi environments without a partner?

Yes, if you have an engineer who knows the Strapi content model, can write import scripts against the Document Service API, and can own the data rules. Many teams start internally and bring in help only for the anonymization design or for a first large dataset. The work becomes harder when no one on the team owns both the schema and the privacy rules, or when seeding must repeat on a schedule. Decide who maintains the seed scripts after launch, because a script that breaks after the next schema change is a common source of stale test data.

What do we need to give a partner before seeding starts?

A seeding engagement needs read access to the current content schema, the versions of Strapi in use, and the environments involved. It also needs a named data owner who signs off on which content types, locales and fields may leave production or be copied into a test system. Access to a source environment or export, a target environment for loading, and a place to store the scripts is usually required. Agree in writing who approves the anonymization rules and who checks the result, because the data owner's sign-off is what makes the seed defensible in a later review.

Should media files be copied into development and staging?

In most cases, no. Copying uploaded media brings across image files that may contain personal information, such as photos of people, scanned documents or metadata with locations. It also multiplies storage and bandwidth in non-production environments. Seed the content records with placeholder media or a small set of approved sample files instead. If a team needs real media to test rendering or performance, document that need, limit it to a reviewed subset, and confirm how the test storage bucket is access-controlled. Strapi's data transfer tooling can exclude media, but you should confirm the exact options for your version in the official docs before relying on them.

How do we keep personal data out of test systems?

Keep it out by design rather than by cleaning up afterward. Exclude the users and permissions data entirely, which means no admin accounts, end-user accounts or tokens are copied. For content types that hold personal data, define field-level rules: replace names, emails and phone numbers with generated values, drop free-text fields that may contain personal details, and check relations that could expose identities through linked records. Run a scan of the seeded output for email patterns and identifiers before anyone gains access. Record the rules and the scan results so the data owner can approve them. Where regulation applies, your compliance team should confirm the approach against its own obligations.

How often should seed data be refreshed?

Refresh it when the content model changes, when a release needs realistic content to test, or on a fixed schedule that the team can keep. Each refresh repeats the selection, anonymization and verification steps, so frequency directly drives recurring effort. Frequent refreshes suit teams with active editorial testing. Teams that mostly test code can refresh less often, using a small fixture set that they update with schema changes. Put the refresh trigger in writing, and keep the seed scripts in version control so a refresh does not depend on one person's memory.

What should a quote for seeding Strapi include?

A useful quote lists the scope in writing: which content types, components and locales are in, which are out, and what is excluded entirely, including media and users. It should itemize schema review, selection and anonymization rule design, script development, test loads, verification steps and handover documentation. It should name who signs off on the data rules, state the environments covered, and say whether refreshes are included as a one-time or recurring item. Ask how changes to scope are priced and what evidence you receive that the seed ran and was checked. A quote that does not mention personal data handling or exclusions is incomplete.

How DeployOpen scopes Strapi seeding work

DeployOpen starts every Strapi seeding engagement with a written seeding plan that names each content type in scope, the components and relations those types depend on, and the fields that must never leave production. The plan lists which collections are copied as data, which are generated as synthetic records, and which are left empty. Media files and Users & Permissions accounts are excluded by default, so the plan states how editors will test image-heavy pages without them and how test logins will be created. The plan is agreed in writing before any export or import runs, because the scope decides how much of the work is configuration and how much is data handling.

The second part of the plan covers masking rules and environment controls. For each field that carries personal or commercial information, the plan records whether it is dropped, replaced with generated values, or hashed, and who approves the rule. It also sets the controls around each environment: which tokens or admin accounts can run a transfer, where export files are stored and how long they persist, and how a staging instance is marked so nobody mistakes it for production. Where a dynamic zone or localized field needs a special rule, the plan says so explicitly.

DeployOpen then implements the plan inside your infrastructure, using your database, hosting accounts and secrets store, and verifies it with checks the client can repeat. Verification usually means searching seeded data for values that should have been masked, confirming excluded types are empty, and checking that an editor can complete a full publish cycle on the seeded content. Ask any provider for the written scope, the masking rule list and the verification steps before accepting a quote. A quote follows from the written scope, so the detail of the plan is what determines the price and effort.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.