Diagram Examples

Copy-paste examples for common diagram use cases in ChapterWise codex files.

Three-Act Story Structure

content:
  - key: three-act
    name: "Three-Act Structure"
    type: diagram
    width: 1/1
    value: |
      graph LR
        subgraph "Act I - Setup"
          A[Ordinary World] --> B[Inciting Incident]
          B --> C[First Plot Point]
        end
        subgraph "Act II - Confrontation"
          C --> D[Rising Action]
          D --> E[Midpoint]
          E --> F[Second Plot Point]
        end
        subgraph "Act III - Resolution"
          F --> G[Climax]
          G --> H[Falling Action]
          H --> I[Resolution]
        end

Character Relationship Map

content:
  - key: relationships
    name: "Character Relationships"
    type: diagram
    width: 1/1
    value: |
      graph TD
        A["Elena (Protagonist)"]
        B["Marcus (Mentor)"]
        C["Viktor (Antagonist)"]
        D["Sasha (Ally)"]
        E["The Council"]
        A -->|"trusts"| B
        A -->|"loves"| D
        A -->|"opposes"| C
        B -->|"guides"| A
        B -.->|"secret past"| C
        C -->|"controls"| E
        D -->|"loyal to"| A
        E -->|"hunts"| A

Production Schedule

content:
  - key: production
    name: "Production Timeline"
    type: diagram
    width: 1/1
    value: |
      gantt
        title Book Production Schedule
        dateFormat YYYY-MM-DD
        section Draft
        Outline           :a1, 2026-01-01, 14d
        First Draft        :a2, after a1, 90d
        section Revision
        Beta Readers       :b1, after a2, 21d
        Second Draft       :b2, after b1, 45d
        section Editing
        Developmental Edit :c1, after b2, 21d
        Copy Edit          :c2, after c1, 14d
        Proofreading       :c3, after c2, 7d
        section Production
        Cover Design       :d1, after b2, 30d
        Layout             :d2, after c3, 14d
        Print              :d3, after d2, 21d

World Hierarchy

content:
  - key: world
    name: "World Structure"
    type: diagram
    width: 1/1
    value: |
      mindmap
        root((The Realm))
          Northern Kingdoms
            Frosthold
              Ice Citadel
              Frozen Docks
            Windmere
              Sky Temple
          Southern Empire
            Sunspire
              Imperial Palace
              Grand Bazaar
            Ashlands
              Volcanic Forge
          The Wilds
            Dark Forest
            Crystal Caves

API Sequence

content:
  - key: api-sequence
    name: "Upload Flow"
    type: diagram
    width: 1/1
    value: |
      sequenceDiagram
        actor User
        participant App as ChapterWise
        participant Store as Storage
        participant AI as AI Worker
        User->>App: Upload manuscript
        App->>Store: Save file
        Store-->>App: File path
        App->>AI: Queue analysis
        AI-->>App: Analysis complete
        App-->>User: Results ready

Side-by-Side Diagrams

Use width: 1/2 to place diagrams next to each other:

content:
  - key: genre-split
    name: "Genre Distribution"
    type: diagram
    width: 1/2
    value: |
      pie title Genres
        "Fantasy" : 35
        "Sci-Fi" : 25
        "Mystery" : 20
        "Romance" : 15
        "Other" : 5
  - key: word-count
    name: "Word Count by Act"
    type: diagram
    width: 1/2
    value: |
      pie title Word Count
        "Act I" : 25000
        "Act II" : 50000
        "Act III" : 25000

Database Schema

content:
  - key: database
    name: "Data Model"
    type: diagram
    width: 1/1
    value: |
      erDiagram
        USER ||--o{ PROJECT : creates
        USER ||--o{ MANUSCRIPT : uploads
        PROJECT ||--|{ CODEX : contains
        MANUSCRIPT ||--|{ CHAPTER : has
        CHAPTER ||--o{ ANALYSIS : analyzed_by
        CODEX ||--o{ NODE : has
        NODE ||--o{ CONTENT : displays

External File Include

Create a .mermaid file in your project:

/diagrams/architecture.mermaid:

graph TB
  subgraph Frontend
    Browser --> Tailwind
    Browser --> Alpine.js
  end
  subgraph Backend
    Flask --> PostgreSQL
    Flask --> Redis
  end
  Browser --> Flask

Reference in your codex:

content:
  - key: arch
    name: "System Architecture"
    type: diagram
    width: 1/1
    include: /diagrams/architecture.mermaid