Define Content Structure


When using a headless CMS, the role of content architecture becomes vitally important. When any content structure is possible, choosing the right abstractions from the beginning will be a key determinate in your success in adopting a headless CMS.

When working with GraphCMS, we recommend keeping these three core tenants in mind. Like all rules, it's good to know the rules so you know when to break them as well. That being said, keep these points in mind:

Reduce the Content Model

If your content can be re-used by any other model both now or in the future, break it into its own model. Relationships are cheap and easy mental models to carry. Use them to your advantage.

Only Track Inherent "Data Truths"

Avoid mixing presentational into your data model like the plague. If you need to maintain a visual structure, abstract that into its own data model and use a relationship where appropriate.

A common example, aligning header text over an image.

Inherent Truth: Area of Image Focus => Left
Presentational Logic: Text Align => Right

A better approach would be to extend the asset model to declare the area of focus, and create a new model for banner arrangements.

Create a Blog Structure

Let's consider the structure for a blog. It would be possible to track a tag or category with simple string values, enum values or something similar. However, that content will be shared amongst multiple entries and updating the data could become tedious. Further, a tag and a category could own their own specific set of data such as a url slug. A more effective structure, in this case, would be the following.


Create Models

All content structures in GraphCMS exist as models. For the GraphQL initiated, these generate new Root Query types. In the example above, authors, posts, tags and categories would exist as a model in graphcms.

To create a model, you begin by navigating to the schema tab as indicated in the screenshot below and clicking on the plus icon.

For more information regarding models, see the relevant section under GraphcMS Concepts.

Adding Models Naming Models

Create Fields

Fields are the unique pieces of data that exist on your model. Fields have extensive configurations which can be found in the GraphCMS Concepts section. In their simplist form, they consist of a display name and a generated and overwriteable apiId. Through our convenient drag-and-drop UI, you can add all your fields to the model in a visual manner.