Diagram catalog
The design doc uses ten diagram types. Here are the rest, so you can see
what each one looks like when Pele draws it. Every figure below is a code
block in content/catalog.md. Nothing on this page is written in TSX.
Structure
Process
Planning
Charts
Maps
Fence props and errors
Props on the opening fence go to the component. {.wide} here adds a class
to the wrapper, which this site uses to let a diagram break out of the text
column:
A block Pele can't draw keeps its source, so a typo never takes the page down:
flowchart LR
A --> B -->
1---2title: Diagram catalog3summary: Every diagram type Pele supports that the design doc does not already use, each one a mermaid code block.4---5 6# Diagram catalog7 8The [design doc](/) uses ten diagram types. Here are the rest, so you can see9what each one looks like when Pele draws it. Every figure below is a code10block in `content/catalog.md`. Nothing on this page is written in TSX.11 12## Structure13 14```mermaid15classDiagram16 class Order {17 +string id18 +Status status19 +total() Money20 +cancel()21 }22 class LineItem {23 +Product product24 +int quantity25 }26 class Payment {27 <<interface>>28 +authorize(Money) Result29 }30 class CardPayment31 class WalletPayment32 Order "1" *-- "many" LineItem33 Order --> Payment34 Payment <|.. CardPayment35 Payment <|.. WalletPayment36```37 38```mermaid39block-beta40 columns 341 web["Web"] mobile["Mobile"] partner["Partner API"]42 gateway["API gateway"]:343 block:services:344 checkout["Checkout"] catalog["Catalog"] accounts["Accounts"]45 end46 db[("Postgres")]:347```48 49```mermaid50C4Context51 title Checkout in context52 Person(customer, "Customer", "Buys things")53 System(shop, "Shop", "Web and mobile storefront")54 System_Ext(psp, "Card network", "Authorizes payments")55 System_Ext(mail, "Email provider", "Sends receipts")56 Rel(customer, shop, "Checks out")57 Rel(shop, psp, "Authorizes cards")58 Rel(shop, mail, "Sends receipts")59```60 61```mermaid62requirementDiagram63 requirement checkout_req {64 id: 165 text: Orders must be payable online.66 risk: high67 verifymethod: test68 }69 functionalRequirement timeout_req {70 id: 1.171 text: A card timeout releases reserved stock.72 risk: medium73 verifymethod: test74 }75 element checkout_api {76 type: service77 }78 checkout_req - contains -> timeout_req79 checkout_api - satisfies -> timeout_req80```81 82## Process83 84```mermaid85swimlane-beta LR86 subgraph Customer87 request[Report a wrong charge]88 receive[Get a refund]89 end90 91 subgraph Support92 triage[Triage]93 refund[Issue refund]94 end95 96 subgraph Payments97 investigate[Check the ledger]98 end99 100 request --> triage101 triage -->|Obvious| refund102 triage -->|Unclear| investigate103 investigate --> refund104 refund --> receive105```106 107```mermaid108agentflow-beta TB109 flow intake["Intake"]110 receive["Receive ticket"]@{ shape: input }111 end112 113 flow triage["Triage"]114 classify["Classify"]@{ shape: task }115 lookup["Look up order"]@{ shape: task }116 classify --> lookup117 end118 119 flow reply["Reply"]120 answer["Draft answer"]@{ shape: action }121 end122 123 receive --> classify124 lookup --> answer125```126 127```mermaid128usecase-beta129direction LR130actor Customer131actor Support132Browse("Browse catalog")133Checkout("Check out")134Refund("Request refund")135Customer --> Browse136Customer --> Checkout137Customer --> Refund138Support --> Refund139```140 141```mermaid142journey143 title Buying a gift144 section Find it145 Search: 4: Customer146 Compare: 3: Customer147 section Pay148 Enter card: 2: Customer149 3-D Secure: 1: Customer, Bank150 section After151 Receipt: 5: Customer152 Delivery: 4: Customer, Courier153```154 155```mermaid156eventmodeling157 158timeframe 01 ui CartUI159timeframe 02 command AddItem [[AddItem01]]160timeframe 03 event ItemAdded [[ItemAdded]]161timeframe 04 command Checkout [[Checkout01]]162timeframe 05 event OrderPlaced [[OrderPlaced]]163 164data AddItem01 {165 sku: 'mug-blue'166 quantity: 2167}168 169data ItemAdded {170 sku: string171 quantity: number172}173 174data Checkout01 {175 card: 'visa-4242'176}177 178data OrderPlaced {179 orderId: string180 total: number181}182```183 184## Planning185 186```mermaid187timeline188 title Checkout over the years189 2019 : v0, a form and a cron job190 2021 : v1 : Card payments : Inventory locks191 2024 : Wallets : Gift cards192 2026 : v2 : Async reservations : Order events193```194 195```mermaid196kanban197 todo[Todo]198 t1[Remove v1 checkout]199 t2[Gift card refunds]@{ priority: 'Low' }200 doing[In progress]201 t3[APAC rollout]@{ assigned: 'platform', priority: 'High' }202 review[Review]203 t4[Receipt templates]@{ assigned: 'growth' }204 done[Done]205 t5[Event stream]206 t6[Async reservations]207```208 209## Charts210 211```mermaid212sankey-beta213 214Visits,Product page,10000215Product page,Cart,4200216Product page,Left,5800217Cart,Checkout,2600218Cart,Left,1600219Checkout,Paid,2300220Checkout,Declined,300221```222 223```mermaid224radar-beta225 title Payment providers226 axis cost["Cost"], speed["Speed"], coverage["Coverage"]227 axis fraud["Fraud tools"], support["Support"]228 229 curve a["Provider A"]{4, 3, 5, 4, 3}230 curve b["Provider B"]{3, 5, 3, 3, 4}231 232 graticule polygon233 max 5234```235 236```mermaid237treemap-beta238"Monthly spend"239 "Compute"240 "App servers": 4210241 "Search": 1880242 "Storage"243 "Postgres": 2340244 "Object store": 610245 "Network"246 "Egress": 1120247```248 249```mermaid250venn-beta251 title Who owns checkout252 set Platform253 set Payments254 set Growth255 union Platform,Payments["Uptime"]256 union Payments,Growth["Conversion"]257 union Platform,Growth["Speed"]258 union Platform,Payments,Growth["Checkout"]259```260 261```mermaid262packet-beta263 title Order event header264 0-7: "Version"265 8-15: "Type"266 16-31: "Flags"267 32-95: "Order id"268 96-127: "Timestamp"269```270 271## Maps272 273```mermaid274mindmap275 root((Checkout))276 Payments277 Cards278 Wallets279 Gift cards280 Inventory281 Reserve282 Release283 Events284 Receipts285 Warehouse286```287 288```mermaid289treeView-beta290 content/291 report.md292 catalog.md293 streaming.md294 src/295 app/296 page.tsx297 comark/298 components.tsx299 package.json300```301 302```mermaid303ishikawa-beta304 Abandoned carts305 Price306 Shipping shown late307 No free tier308 Payment309 3-D Secure fails310 Wallet missing311 Speed312 Slow inventory lock313 Trust314 No reviews315```316 317```mermaid318wardley-beta319title Checkout value chain320 321anchor Customer [0.95, 0.63]322component Checkout [0.79, 0.55]323component Payments [0.60, 0.75]324component Inventory [0.55, 0.45]325component Card network [0.35, 0.88]326component Compute [0.10, 0.85]327 328Customer -> Checkout329Checkout -> Payments330Checkout -> Inventory331Payments -> Card network332Inventory -> Compute333 334evolve Inventory 0.70335```336 337```mermaid338cynefin-beta339 title Checkout incidents340 341 complex342 "Fraud spikes"343 344 complicated345 "Slow card network"346 347 clear348 "Expired certificate"349 350 chaotic351 "Double charges"352 353 chaotic --> complex : "Stopped the bleeding"354 complex --> complicated : "Found the pattern"355 complicated --> clear : "Wrote the runbook"356```357 358```mermaid359railroad-ebnf-beta360title "Coupon code"361 362coupon = prefix "-" digits [ "-" suffix ] ;363prefix = "SAVE" | "GIFT" | "VIP" ;364digits = digit digit digit+ ;365suffix = "EU" | "US" ;366digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;367```368 369## Fence props and errors370 371Props on the opening fence go to the component. `{.wide}` here adds a class372to the wrapper, which this site uses to let a diagram break out of the text373column:374 375```mermaid {.wide}376flowchart LR377 md[".md file"] --> parse["parseMarkdown()"]378 parse --> node["pele node"]379 node --> server["SVG on the server"]380 node --> browser["mount() in the browser"]381 browser --> fit["fits the width"]382 browser --> zoom["zoom when needed"]383```384 385A block Pele can't draw keeps its source, so a typo never takes the page down:386 387```mermaid388flowchart LR389 A --> B -->390```