Best Practices
Schema Design Best Practices for Headless CMS
Good schema design saves hours of refactoring. Here are the patterns we recommend for Localess projects.
A poorly designed schema leads to content that is hard to reuse, difficult to translate, and painful to query. Follow these principles to keep your Localess schemas maintainable.
Keep schemas flat where possible
Deeply nested schemas are harder to translate and query. Prefer linking references over embedding complex objects.
Use references for shared content
If the same author or product appears in multiple articles, model it as a separate schema and reference it. Localess resolves references automatically at fetch time.
Version your schemas
Use Localess schema versioning to roll out breaking changes without impacting live content.
Name fields consistently
Use camelCase for field keys. Avoid abbreviations — description is better than desc.