Blog CMS ER Diagram
The code
erDiagram
USER ||--o{ POST : authors
USER ||--o{ COMMENT : writes
POST ||--o{ COMMENT : has
POST ||--|{ POST_CATEGORY : tagged
CATEGORY ||--|{ POST_CATEGORY : groups
USER {
string email
string display_name
}
POST {
string title
string slug
date published_at
}
COMMENT {
string body
date created_at
}
CATEGORY {
string name
}
How this template works
A content platform lives or dies by its schema, and this diagram captures the essential shape of one. Users author posts, posts collect comments, and categories organize posts through an explicit join table. If you are building a blog, a knowledge base, or a documentation site, this is the model to start from before any migration is written.
The relationship lines follow crow’s foot notation. USER ||--o{ POST : authors says one user authors zero or more posts, while POST ||--o{ COMMENT : has gives every post its comment thread. The interesting lines are the pair that meet in the middle: POST ||--|{ POST_CATEGORY : tagged and CATEGORY ||--|{ POST_CATEGORY : groups. A post can belong to many categories and a category can hold many posts, and since this template sticks to one-to-many symbols, the join table POST_CATEGORY is where that many-to-many relationship is resolved. Attribute blocks then describe each entity one field per line, for example string slug under POST or date created_at under COMMENT.
The gotcha here is the temptation to draw many-to-many directly. Mermaid does support a many-to-many crow’s foot, but mixing it into a diagram that otherwise uses one-to-many symbols makes the cardinality story harder to read, and it hides the join table where you will eventually store ordering or a primary flag. Model the join table explicitly, as this template does, and the diagram will match the tables you actually create.
Adapting it is straightforward. Add a TAG entity with its own POST_TAG join table for free-form labels, extend USER with a role attribute to separate admins from authors, or add a MEDIA entity for uploaded images. Keep entity names singular and uppercase so the diagram reads like the DDL it will become.
Related templates that pair well: the e-commerce ER diagram for the same one-to-many patterns in a shop, the employee management ER diagram for organizational hierarchies, and the school system ER diagram for another join-table-heavy model. The ER diagram guide is the reference for every symbol used here.
Variations to try
- Add a TAG entity and a POST_TAG join table if posts need free-form labels alongside fixed categories.
- Extend the USER block with a role attribute to distinguish admins from regular authors.
- Add a MEDIA entity and connect it to POST to model uploaded images and attachments.