# Content modeling walkthrough

A step-by-step walkthrough of the full content modeling process, from research to a finished schema in Hygraph.

This walkthrough takes you through the full content modeling process using a bookshop website as an example. Starting with research and stakeholder interviews, you will build a domain model with your team and then translate it into a working Hygraph schema. Following this method produces a schema that is structured, scalable, and straightforward for both editors and developers to work with.

## Prerequisites

- Read [Content modeling overview](https://hygraph.com/docs/core-concepts/content-modeling/content-modeling-overview) for the conceptual foundation.
- Read [Content modeling in Hygraph](https://hygraph.com/docs/core-concepts/content-modeling/content-modeling-in-hygraph) to understand models, fields, components, and other schema building blocks.
- Read [Plan your content model](https://hygraph.com/docs/core-concepts/content-modeling/plan-your-content-model) for guidance on the research and domain modeling process.
- Have a Hygraph project ready. If you don't have one yet, [create a project](https://hygraph.com/docs/getting-started/tutorial/tutorial-overview) first.

## Step 1: Research and discovery

Content modeling starts with research, not with the schema editor.

For this example, imagine you have been asked to build a content model for a chain of bookshops. Start with **desk research** to understand how bookshop websites typically structure their content. This would include book details, genres, authors, reviews, and so on.

Once you have a basic understanding, interview key stakeholders:

- **Content creators** to understand how they enter book details, manage inventory, and create content day-to-day.
- **Sales team** to learn what information supports the purchasing decision and how customers interact with the site.
- **Developers** to understand technical requirements, preferred stack, and how content needs to be structured for performance.
- **Marketing team** to identify what drives engagement and what promotional content needs to be supported.

After your research and interviews, compile a list of **terms** that will form the foundation of your content model:

    <div className="flex flex-col md:flex-row md:gap-4">
      <div className="flex-1">
        - Books
        - Authors
        - Genres
        - Reviews
      </div>
      <div className="flex-1">
        - Price
        - ISBN
        - Availability
        - Promotions
      </div>
    </div>

### Map the relationships

With your terms defined, think through how these concepts relate to each other:

- Each **Book** is written by one or more **Authors**.
- Each **Book** belongs to one or more **Genres**.
- Each **Book** may have multiple **Reviews**.
- Each **Book** has a single **ISBN**.
- Each **Genre** may be associated with multiple **Books** and **Authors**.
- Each **Book** has a **Price**.

Next, separate **object domains** (things that will become models) from **attributes** (values that describe an object). `Price`, `ISBN`, and `Availability` are attributes of `Book`, not models in their own right.

## Step 2: Build the domain model

Bring your cross-functional team together to build a **domain model**, which is a high-level picture of the entire business, its key objects, and the relationships between them.

The domain model is broader than what you will put into Hygraph. It covers the full scope of the business, including operational areas that are not directly relevant to the website.

Here is a domain model for the bookshop:

| Object domain           | Attributes                                                   |
|-------------------------|--------------------------------------------------------------|
| **Books**               | Title, ISBN, price, availability, summary, cover image       |
| **Authors**             | Name, biography, photo                                       |
| **Genres**              | Name, description                                            |
| **Reviews**             | User name, rating, review text                               |
| **Promotions**          | Discount name, description, amount, active period            |
| **Store locations**     | Shop name, address, contact details, operating hours         |
| **Employee management** | Employee name, role, shift schedule, contact information     |
| **Suppliers**           | Supplier name, contact information, order history, contracts |

Here are the key relationships:

| Objects                            | Relationship                                                                                                 |
|------------------------------------|--------------------------------------------------------------------------------------------------------------|
| `Books` and `Authors`              | A book is written by one or more authors. An author can write multiple books.                                |
| `Books` and `Genres`               | A book belongs to one or more genres. A genre can contain multiple books.                                    |
| `Books` and `Reviews`              | A book can have multiple reviews. A user can review multiple books.                                          |
| `Books` and `Promotions`           | A book can be associated with one or more active promotions. A promotion can apply to multiple books.        |
| `Books` and `Suppliers`            | A supplier provides one or more books. A book may be sourced from multiple suppliers.                        |
| `Store locations` and `Books`      | A store location stocks multiple books. A book may be available in multiple locations.                       |
| `Suppliers` and `Store locations`  | A supplier provides stock to one or more locations. A store location receives stock from multiple suppliers. |
| `Promotions` and `Store locations` | A promotion may apply to specific locations. A store location may have multiple active promotions.           |

**Scoping the schema:**

The domain model covers the full business, but the Hygraph schema only needs the object domains that relate to content your users interact with. This includes books, authors, genres, and promotions. Store locations, employee management, and suppliers are essential for business operations but are not part of the customer-facing content model.

## Step 3: Build the schema

With a domain model in hand, identify which parts belong in Hygraph. In Hygraph, object domains become **models** and attributes become **fields**.

Here is the high-level schema:

- **Book** model: Title, ISBN, Price, Summary, Availability, Book cover, Genres (reference), Author (reference), Promotion (component field)
- **Author** model: Name, Biography, Photo, Books (reference), Genres (reference)
- **Genre** model: Name, Description, Books (reverse reference), Authors (reverse reference)

The sections below define each model in detail.

### Book model

The `Book` model is the primary content type on the bookshop website.

| Field          | Type                | Description                             |
|----------------|---------------------|-----------------------------------------|
| `title`        | Single line text    | The book's title                        |
| `isbn`         | Single line text    | A unique identifier for the book        |
| `price`        | Float               | The book's price                        |
| `summary`      | Rich text           | A description of the book               |
| `availability` | Boolean             | Whether the book is currently in stock  |
| `bookCover`    | Asset picker        | The book's cover image                  |
| `genres`       | Reference (two-way) | Links to one or more `Genre` entries    |
| `author`       | Reference (two-way) | Links to one or more `Author` entries   |
| `promotion`    | Basic component     | Adds a promotion component to the entry |

#### Promotion component

The promotion component is a reusable group of fields attached to the `Book` model. Because it is a component, the same definition can be reused on other models without duplicating the field setup.

| Field         | Type             | Description                            |
|---------------|------------------|----------------------------------------|
| `name`        | Single line text | The promotion's name                   |
| `discount`    | Enumeration      | A predefined list of discount values   |
| `description` | Rich text        | A description of the promotion         |
| `image`       | Asset picker     | An image associated with the promotion |

**Pro Tip:**

A component is a predefined group of fields that can be reused across models without duplicating field definitions. Using a component here means promotion data is consistent wherever it appears, and changes to the component propagate automatically.

For this simplified example, promotions are embedded per book rather than modeled as shared `Promotion` entries. In a production schema where the same promotion applies to many books, use a `Promotion` model with a two-way many-to-many reference to `Book` instead.

### Author model

The `Author` model stores information about book authors.

| Field       | Type                | Description                          |
|-------------|---------------------|--------------------------------------|
| `name`      | Single line text    | The author's full name               |
| `biography` | Rich text           | A biographical description           |
| `photo`     | Asset picker        | A profile image                      |
| `books`     | Reference (two-way) | Links to one or more `Book` entries  |
| `genres`    | Reference (two-way) | Links to one or more `Genre` entries |

### Genre model

The `Genre` model stores genre definitions and connects to both books and authors through reference fields.

| Field         | Type                | Description                                         |
|---------------|---------------------|-----------------------------------------------------|
| `name`        | Single line text    | The genre name. For example, Fiction or Non-Fiction |
| `description` | Rich text           | Additional information about the genre              |
| `books`       | Reference (reverse) | Reverse field of the `genres` reference on `Book`   |
| `authors`     | Reference (reverse) | Reverse field of the `genres` reference on `Author` |

## What's next

You now have a schema that reflects a structured, scalable approach to content modeling. Editors can create entries efficiently, and developers can query the Content API with confidence because the relationships are explicit and field types are predictable.

**Iterating your content model:**

As your project grows, revisit the schema periodically to check that it still aligns with your business goals. Use [environments](https://hygraph.com/docs/api-reference/basics/environments) to test structural changes safely before applying them to production.

| Resource                                                              | Description                                                                  |
|-----------------------------------------------------------------------|------------------------------------------------------------------------------|
| [Getting Started tutorial](https://hygraph.com/docs/getting-started/tutorial/tutorial-overview) | Build a project from scratch, from schema design to frontend implementation. |
| [Hygraph recipes](https://hygraph.com/docs/recipes)                                      | Explore common schema patterns and field configurations.                     |
| [Implementation guides](https://hygraph.com/docs/implementations)                        | Step-by-step guides for connecting your Hygraph project to a frontend.       |
| [Integration guides](https://hygraph.com/docs/integrations)                              | Find out how third-party apps integrate with Hygraph to extend your project. |
