Skip to content

Sync Commands

Sync commands bridge the Strapi CMS and the React app codebase. They pull content from Strapi into TypeScript files (sync) or push local changes back to Strapi (reverse-sync).

Fetches questionnaire data from Strapi and generates TypeScript files with i18n wrapping.

Terminal window
yarn sync:questionnaire [-q slug] [-t type] [-d dir] [-s source]
Flag Long form Type Default Description
-q --questionnaireSlug string Sync only one questionnaire by its slug
-t --questionnaireType enum all Filter by type: signup, claim, adjustPolicy, cancelPolicy, all
-d --dir string src/syncedData/questionnaires Output directory for generated files
-s --source enum Source environment: prod, staging, dev

Generates TypeScript files in the output directory. Each file:

  • Exports a typed questionnaire definition object
  • Wraps all user-facing strings with i18n translation functions using the questionnaire’s translationKey
  • Includes all questions, rules, screens, validations, and metadata

Sync all questionnaires from staging:

Terminal window
yarn sync:questionnaire -s staging

Sync a single questionnaire:

Terminal window
yarn sync:questionnaire -q household -s staging

Sync only claim questionnaires:

Terminal window
yarn sync:questionnaire -t claim -s staging

Same as sync:questionnaire but uses .env.development for environment configuration.

Terminal window
yarn sync:questionnaire:dev [-q slug] [-t type] [-d dir]

Accepts the same options as sync:questionnaire except -s (source is always the dev environment).


Reads a local TypeScript questionnaire file and pushes changes back to Strapi.

Terminal window
yarn reverse-sync:questionnaire -q <slug> [-t target] [--dependent] [--main-only] [--dry-run] [--force]
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
--main-only boolean false No Only sync the main (non-dependent) variant
--dry-run boolean false No Show the diff without pushing changes to Strapi
--force boolean false No Skip the confirmation prompt
  1. Reads the local TypeScript questionnaire file
  2. Compares it against the current Strapi content
  3. Shows a diff of changes
  4. Prompts for confirmation (unless --force is used)
  5. Pushes the changes to the target Strapi environment

Dry-run to see what would change:

Terminal window
yarn reverse-sync:questionnaire -q household --dry-run

Push to staging (default target):

Terminal window
yarn reverse-sync:questionnaire -q household

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

Promotes a draft questionnaire to published status in Strapi.

Terminal window
yarn reverse-sync:questionnaire:promote -q <slug> [-t target]
Flag Long form Type Default Required Description
-q --slug string Yes Questionnaire slug to promote
-t --target enum No Target environment: prod, staging, dev

Changes the questionnaire’s status from draft to published in the target Strapi environment. This makes the questionnaire available via the Strapi API and, consequently, in the preview system.

Terminal window
yarn reverse-sync:questionnaire:promote -q household -t staging

Fetches all vertical definitions from staging Strapi and generates TypeScript mapping files.

Terminal window
yarn sync:verticals

No options. Always syncs from the staging environment.

Generates the following files:

src/models/insurances/types/mapping/index.ts

Section titled “src/models/insurances/types/mapping/index.ts”

Contains:

Export Description
InsuranceTypes enum All insurance type identifiers (e.g., HOUSEHOLD, PUBLIC_HEALTH)
Title lookups Maps insurance types to display titles
Excerpt lookups Maps insurance types to short descriptions
Description lookups Maps insurance types to full descriptions
Color mappings Maps insurance types to hex color codes
Image mappings Maps insurance types to icon/logo URLs

One file per vertical containing:

  • Policy modal section content (body text, lists)
  • Policy modal button configuration (text, href, variant)
Terminal window
yarn sync:verticals

  1. Edit the questionnaire in Strapi
  2. Sync it locally: yarn sync:questionnaire -q <slug> -s staging
  3. Review the generated TypeScript diff
  4. Create a pull request with the changes
  1. Edit the local TypeScript questionnaire file
  2. Dry-run to verify: yarn reverse-sync:questionnaire -q <slug> --dry-run
  3. Push to staging: yarn reverse-sync:questionnaire -q <slug>
  4. Preview in the staging app
  5. Promote when ready: yarn reverse-sync:questionnaire:promote -q <slug> -t staging
  1. Create the vertical in Strapi
  2. Sync all verticals: yarn sync:verticals
  3. Review the generated mapping files
  4. Create a pull request with the changes