HyperionDocs
Templates

ERD Template

Template for Entity Relationship Diagrams documenting database schema

Use this template for Entity Relationship Diagrams (ERD) to document database schema.

When to Use

Create an ERD when:

  • Designing database schema
  • Documenting data model
  • Planning schema migration

Template

@startuml
!include /plantuml/themes/puml-theme-x-light.puml

entity EntityName {
  * id : UUID <<PK>>
  --
  * field_name : Type
  field_name : Type <<nullable>>
  foreign_key_id : UUID <<FK>>
  created_at : DateTime
  updated_at : DateTime
}

entity RelatedEntity {
  * id : UUID <<PK>>
  --
  * name : String
}

EntityName }|--|| RelatedEntity : "relationship"
@enduml

Relationship Cardinality

  • ||--|| : One to one
  • }|--|| : Many to one
  • ||--o{ : One to many
  • }|--o{ : Many to many

Best Practices

  • Primary Keys: Mark with <<PK>>
  • Foreign Keys: Mark with <<FK>>
  • Required Fields: Prefix with *
  • Nullable Fields: Mark with <<nullable>>
  • Timestamps: Include created_at and updated_at when applicable
  • Relationship Notation: Use PlantUML relationship syntax
  • Validation: Validate ERD against actual database schema

File Location

Place ERDs in: content/{project}/docs/architecture/erd/

Example: content/billing-system/docs/architecture/erd/payment-schema.mdx