Working with DatoCMS

Workflow

3-Step Schema Change Workflow

This aims to prevent breaking changes in production and allows smooth transitions during A/B testing or staged rollouts.
By having DatoCMS schema changes follow a 3-step process, we ensure that new features can be introduced without disrupting existing functionality.

  1. Introduce New Versions - When modifying fields or models, create new versions instead of altering existing ones.

    • Example: use ComponentXv2 instead of editing ComponentX directly.
    • Example: add field “subheading” as a new field instead of changing an existing field "subtitle".
  2. Update and Deploy Code - Update the application code to handle both the new fields/models and the old ones. Once tested, merge the changes into the main branch and deploy.

  3. Clean Up Deprecated Schema - After confirming the new version is fully in use and stable, remove any unused fields or models from DatoCMS (e.g. ComponentX if replaced by ComponentXv2).

    • Example: remove ComponentX.
    • Example: remove field "subtitle".

Development Guidelines

DatoCMS Components - DatoCMS blocks are reusable content modules that can be added flexibly across the CMS. Our codebase should reflect this modularity by structuring components for reusability and clarity.

When implementing a component tied to a DatoCMS block:

  1. Create UI Component in /components folder
  2. Create GraphQL Fragment in lib/datocms/fragments folder This fragment should cover all fields needed by the component.