Skip to content

Reverse-Sync a Questionnaire

Reverse sync reads a local generated TypeScript file and pushes the data back to Strapi, creating a new draft version. Use this when you have made local edits that need to be reflected in the CMS.

Always preview what will change before pushing:

Terminal window
yarn reverse-sync:questionnaire -q <slug> --dry-run

This shows a colored diff of what would change in Strapi — additions in green, deletions in red. No changes are made.

Check for:

  • Expected changes (the edits you made)
  • Unexpected changes (formatting differences, field ordering)
  • Missing data (questions or rules that should not be removed)
Terminal window
yarn reverse-sync:questionnaire -q <slug>

This creates a draft in Strapi with your local changes. The published version remains unchanged.

  1. Open the questionnaire in Strapi admin
  2. You should see it has a draft with your changes
  3. Preview the draft to verify it works correctly
Flag Long form Type Default Required Description
-q --slug string Yes Questionnaire slug to reverse-sync
-t --target enum staging No Target environment: prod, staging, dev
--dependent boolean false No Only sync the dependent variant (file under dependents/)
--main-only boolean false No Only sync the main (non-dependent) variant; skips dependents/, claims/, etc.
--dry-run boolean false No Show the diff without pushing changes to Strapi
--force boolean false No Skip the confirmation prompt

--dependent and --main-only are mutually exclusive.

Push to production with confirmation skip:

Terminal window
yarn reverse-sync:questionnaire -q household -t prod --force

Sync only the dependent variant:

Terminal window
yarn reverse-sync:questionnaire -q household --dependent
Issue Cause Fix
“Relation not found” warnings Expected when quote-page or option-list components do not exist on the target environment Link missing relations manually in the Strapi questionnaire editor after the draft is created
Diff shows unexpected changes Someone else modified the questionnaire in Strapi since your last sync Re-run a forward sync first (yarn sync:questionnaire -q <slug>) to update your local file, then re-apply your changes
“Cannot push to production” or wrong target Target environment not specified or defaulting to staging Use -t prod explicitly to target production
“Questionnaire file not found for slug” Local file does not exist for the given slug Verify the slug matches a file in src/syncedData/questionnaires/ (check subdirectories too)