Unsaved
Ready
Loading Monaco Editor...
Preview
Styling
ER Diagram
All Database Design templates

CMS Content Model — Mermaid ER Diagram

ER diagram for a headless CMS with pages, blocks, media, and versioned content publishing workflow.

What this diagram shows

This Mermaid ER diagram is a headless CMS. A site has many pages. A page has many versions and many blocks, plus a published_version_id that points at the version currently live. Each version stores title, meta description, locale, version number, and author. Blocks belong to a page, reference a block type, and store JSON content plus a sort order. Block types carry a JSON schema. Media can be used by blocks. Authors create versions.

Use it when content and presentation are splitting and you need the draft versus published distinction in the schema, not in a status enum alone. The page status column still exists, and the published_version_id is the precise pointer. A page can hold versions in more than one locale because locale is on PAGE_VERSION, not on PAGE. The slug stays on the page, so locales share a slug unless you move it.

BLOCK.content is jsonb. The shape of that JSON is constrained by BLOCK_TYPE.schema. The diagram cannot express the JSON Schema itself; the two columns are the hook for it.

Mermaid syntax in this template

Entities list typed attributes. Relationships use a label when the column name is not enough, such as has versions versus the published pointer.

  • PAGE ||--|{ PAGE_VERSION : has versions

    One or more versions. The first save creates version 1. The label is quoted in the source because it contains a space.

  • uuid published_version_id FK

    A second foreign key from PAGE to PAGE_VERSION, besides the one-to-many. Mermaid shows the column even when a second relationship line is not drawn.

  • BLOCK }o--|| BLOCK_TYPE : instance of

    Many blocks share one type. The type's schema column describes content.

  • MEDIA ||--o{ BLOCK : used in

    Optional. A block such as rich text may use no media row. The edge does not model a gallery of several assets; that would be a join table.

Variations and ways to customize it

Move the slug onto the version

If each locale has its own URL, slug cannot live only on PAGE. Put slug on PAGE_VERSION and keep a stable page id for the group of translations.

PAGE_VERSION {
    uuid id PK
    uuid page_id FK
    string slug
    string locale
}

Model a block that references several media rows

Replace the direct MEDIA to BLOCK edge with BLOCK_MEDIA. Sort order on the join preserves gallery order, which sort_order on BLOCK cannot do for assets inside one block.

BLOCK ||--o{ BLOCK_MEDIA : includes
MEDIA ||--o{ BLOCK_MEDIA : "used as"

Add a scheduled publish

PAGE_VERSION has no publish_at. Add it, and let the live pointer move when that timestamp passes. status on PAGE then becomes a cache of draft, scheduled, or published.

Diagram type

ER Diagram

Tags

CMScontent modelheadlesspublishingversioning
Open in Editor

Frequently asked questions

How does this CMS schema know which version is live?

PAGE.published_version_id points at one PAGE_VERSION. Other versions remain as history. status on the page is a coarser flag. Read the foreign key when you need the exact row to render.

Where is localization stored?

PAGE_VERSION.locale. The site has a default_locale. Versions of one page can differ by locale and by version_number. The page slug is shared unless you move slug onto the version.

What is the difference between BLOCK and BLOCK_TYPE?

BLOCK_TYPE is the definition: name, slug, and a JSON schema. BLOCK is one instance on a page: the type id, the JSON content, and sort_order.

Can one media asset appear in many blocks?

The relationship MEDIA ||--o{ BLOCK says one media row links to many blocks, and each block has a single media edge. A gallery inside one block needs a join table. This template does not have one.

Related templates and guides

All Database Design templates