[{"data":1,"prerenderedAt":504},["ShallowReactive",2],{"page-\u002Fv1\u002Fcore\u002Fdecision-tree":3},{"id":4,"title":5,"body":6,"description":497,"extension":498,"meta":499,"navigation":55,"path":500,"seo":501,"stem":502,"__hash__":503},"content\u002Fv1\u002Fcore\u002Fdecision-tree.md","Decision tree",{"type":7,"value":8,"toc":491},"minimark",[9,13,21,26,185,189,347,351,428,432,474,487],[10,11,5],"h1",{"id":12},"decision-tree",[14,15,16,20],"p",{},[17,18,19],"strong",{},"Purpose:"," pick the correct path before writing code.",[22,23,25],"h2",{"id":24},"master-flowchart","Master flowchart",[27,28,33],"pre",{"className":29,"code":30,"language":31,"meta":32,"style":32},"language-mermaid shiki shiki-themes github-light github-dark","flowchart TD\n    START([New behaviour needed]) --> SAME{Is everything inside\u003Cbr\u002F>this one module?}\n\n    SAME -->|Yes| GF[Golden Flow only\u003Cbr\u002F>UI → Use Case → Domain → Port → Infra]\n    GF --> PERSIST{Need database I\u002FO?}\n    PERSIST -->|Yes| REPO[Domain port + persistence adapter]\n    PERSIST -->|No — pure calculation| DOM[Domain Entity \u002F Domain Service]\n\n    SAME -->|No — another module involved| PEER{Need peer answer\u003Cbr\u002F>in this request?}\n\n    PEER -->|Yes| ACL[Sync ACL\u003Cbr\u002F>local Port + AclAdapter\u003Cbr\u002F>→ thin peer ModuleInterface]\n    PEER -->|No| STEPS{Multiple steps \u002F compensations\u003Cbr\u002F>across modules?}\n\n    STEPS -->|No| EV[Async Domain Event\u003Cbr\u002F>→ translation listener\u003Cbr\u002F>→ inbound Use Case]\n    STEPS -->|Yes| ORCH[Orchestration \u002F saga-lite\u003Cbr\u002F>still ACL + Events only]\n\n    ACL --> TEST{Replace peer with HTTP:\u003Cbr\u002F>do Application\u002FDomain still compile?}\n    EV --> TEST\n    ORCH --> TEST\n    REPO --> TEST2{Application free of ORM?}\n    DOM --> DONE([Implement + boundary tests])\n    TEST -->|Yes| DONE\n    TEST -->|No| FIX1[Move foreign types into ACL adapter]\n    TEST2 -->|Yes| DONE\n    TEST2 -->|No| FIX2[Map in repository; return Entities]\n","mermaid","",[34,35,36,44,50,57,63,69,75,81,86,92,97,103,109,114,120,126,131,137,143,149,155,161,167,173,179],"code",{"__ignoreMap":32},[37,38,41],"span",{"class":39,"line":40},"line",1,[37,42,43],{},"flowchart TD\n",[37,45,47],{"class":39,"line":46},2,[37,48,49],{},"    START([New behaviour needed]) --> SAME{Is everything inside\u003Cbr\u002F>this one module?}\n",[37,51,53],{"class":39,"line":52},3,[37,54,56],{"emptyLinePlaceholder":55},true,"\n",[37,58,60],{"class":39,"line":59},4,[37,61,62],{},"    SAME -->|Yes| GF[Golden Flow only\u003Cbr\u002F>UI → Use Case → Domain → Port → Infra]\n",[37,64,66],{"class":39,"line":65},5,[37,67,68],{},"    GF --> PERSIST{Need database I\u002FO?}\n",[37,70,72],{"class":39,"line":71},6,[37,73,74],{},"    PERSIST -->|Yes| REPO[Domain port + persistence adapter]\n",[37,76,78],{"class":39,"line":77},7,[37,79,80],{},"    PERSIST -->|No — pure calculation| DOM[Domain Entity \u002F Domain Service]\n",[37,82,84],{"class":39,"line":83},8,[37,85,56],{"emptyLinePlaceholder":55},[37,87,89],{"class":39,"line":88},9,[37,90,91],{},"    SAME -->|No — another module involved| PEER{Need peer answer\u003Cbr\u002F>in this request?}\n",[37,93,95],{"class":39,"line":94},10,[37,96,56],{"emptyLinePlaceholder":55},[37,98,100],{"class":39,"line":99},11,[37,101,102],{},"    PEER -->|Yes| ACL[Sync ACL\u003Cbr\u002F>local Port + AclAdapter\u003Cbr\u002F>→ thin peer ModuleInterface]\n",[37,104,106],{"class":39,"line":105},12,[37,107,108],{},"    PEER -->|No| STEPS{Multiple steps \u002F compensations\u003Cbr\u002F>across modules?}\n",[37,110,112],{"class":39,"line":111},13,[37,113,56],{"emptyLinePlaceholder":55},[37,115,117],{"class":39,"line":116},14,[37,118,119],{},"    STEPS -->|No| EV[Async Domain Event\u003Cbr\u002F>→ translation listener\u003Cbr\u002F>→ inbound Use Case]\n",[37,121,123],{"class":39,"line":122},15,[37,124,125],{},"    STEPS -->|Yes| ORCH[Orchestration \u002F saga-lite\u003Cbr\u002F>still ACL + Events only]\n",[37,127,129],{"class":39,"line":128},16,[37,130,56],{"emptyLinePlaceholder":55},[37,132,134],{"class":39,"line":133},17,[37,135,136],{},"    ACL --> TEST{Replace peer with HTTP:\u003Cbr\u002F>do Application\u002FDomain still compile?}\n",[37,138,140],{"class":39,"line":139},18,[37,141,142],{},"    EV --> TEST\n",[37,144,146],{"class":39,"line":145},19,[37,147,148],{},"    ORCH --> TEST\n",[37,150,152],{"class":39,"line":151},20,[37,153,154],{},"    REPO --> TEST2{Application free of ORM?}\n",[37,156,158],{"class":39,"line":157},21,[37,159,160],{},"    DOM --> DONE([Implement + boundary tests])\n",[37,162,164],{"class":39,"line":163},22,[37,165,166],{},"    TEST -->|Yes| DONE\n",[37,168,170],{"class":39,"line":169},23,[37,171,172],{},"    TEST -->|No| FIX1[Move foreign types into ACL adapter]\n",[37,174,176],{"class":39,"line":175},24,[37,177,178],{},"    TEST2 -->|Yes| DONE\n",[37,180,182],{"class":39,"line":181},25,[37,183,184],{},"    TEST2 -->|No| FIX2[Map in repository; return Entities]\n",[22,186,188],{"id":187},"decision-table","Decision table",[190,191,192,208],"table",{},[193,194,195],"thead",{},[196,197,198,202,205],"tr",{},[199,200,201],"th",{},"Question",[199,203,204],{},"If yes →",[199,206,207],{},"Docs",[209,210,211,232,250,268,282,296,314,333],"tbody",{},[196,212,213,217,220],{},[214,215,216],"td",{},"Only this module’s data and rules?",[214,218,219],{},"Golden Flow + optional repository port",[214,221,222,227,228],{},[223,224,226],"a",{"href":225},"\u002Fv1\u002Fcore\u002Fgolden-flow","Golden flow",", ",[223,229,231],{"href":230},"\u002Fv1\u002Fcore\u002Fports-and-persistence","Ports",[196,233,234,237,240],{},[214,235,236],{},"Need peer data\u002Fvalidation before continuing?",[214,238,239],{},"Sync ACL",[214,241,242,227,246],{},[223,243,245],{"href":244},"\u002Fv1\u002Fcore\u002Fcross-module-acl","ACL",[223,247,249],{"href":248},"\u002Fv1\u002Fcore\u002Ftransactions-and-failures","Transactions",[196,251,252,255,258],{},[214,253,254],{},"Peer should react after we finish (no return needed)?",[214,256,257],{},"Domain Event",[214,259,260,227,264],{},[223,261,263],{"href":262},"\u002Fv1\u002Fcore\u002Fcross-module-events","Events",[223,265,267],{"href":266},"\u002Fv1\u002Fcore\u002Fevent-delivery","Delivery",[196,269,270,273,276],{},[214,271,272],{},"Multi-step cross-module with compensations?",[214,274,275],{},"Orchestration (saga-lite)",[214,277,278],{},[223,279,281],{"href":280},"\u002Fv1\u002Fcore\u002Forchestration","Orchestration",[196,283,284,287,290],{},[214,285,286],{},"Cross-context list\u002Fdashboard?",[214,288,289],{},"Projection or ACL read — not ORM joins",[214,291,292],{},[223,293,295],{"href":294},"\u002Fv1\u002Fcore\u002Freads-and-reporting","Reads",[196,297,298,305,308],{},[214,299,300,301,304],{},"Same ",[17,302,303],{},"technical"," helper already needed by a second module?",[214,306,307],{},"Promote to Shared",[214,309,310],{},[223,311,313],{"href":312},"\u002Fv1\u002Fcore\u002Fshared-kernel","Shared kernel",[196,315,316,322,329],{},[214,317,300,318,321],{},[17,319,320],{},"business"," concept needed by a second module?",[214,323,324,325,328],{},"ACL \u002F Events — ",[17,326,327],{},"never"," Shared",[214,330,331],{},[223,332,245],{"href":244},[196,334,335,338,341],{},[214,336,337],{},"Evolving a façade or event?",[214,339,340],{},"Treat as published contract",[214,342,343],{},[223,344,346],{"href":345},"\u002Fv1\u002Fcore\u002Fcross-module-contracts","Contracts",[22,348,350],{"id":349},"illustrative-examples","Illustrative examples",[190,352,353,366],{},[193,354,355],{},[196,356,357,360,363],{},[199,358,359],{},"Feature",[199,361,362],{},"Bridge",[199,364,365],{},"Why",[209,367,368,379,393,406,417],{},[196,369,370,373,376],{},[214,371,372],{},"Create Ordering draft",[214,374,375],{},"Local + repository",[214,377,378],{},"No peer required for core write",[196,380,381,384,387],{},[214,382,383],{},"Ordering checks stock",[214,385,386],{},"ACL to Warehouse",[214,388,389,390],{},"Need availability ",[17,391,392],{},"now",[196,394,395,398,401],{},[214,396,397],{},"Ordering validates member tier",[214,399,400],{},"ACL to Directory",[214,402,403,404],{},"Need eligibility ",[17,405,392],{},[196,407,408,411,414],{},[214,409,410],{},"After fulfilled, finalize stock",[214,412,413],{},"Event to Warehouse",[214,415,416],{},"Side effect after success",[196,418,419,422,425],{},[214,420,421],{},"Transaction wrapper used by many modules",[214,423,424],{},"Shared port",[214,426,427],{},"Technical, multi-module",[22,429,431],{"id":430},"implementation-order-practical","Implementation order (practical)",[433,434,435,443,450,457,464,471],"ol",{},[436,437,438,439,442],"li",{},"Write the ",[17,440,441],{},"Use Case + Application DTO"," for the owning module.",[436,444,445,446,449],{},"If I\u002FO needed → add ",[17,447,448],{},"port + fake\u002Fin-memory"," in tests, then persistence adapter.",[436,451,452,453,456],{},"If peer needed sync → add ",[17,454,455],{},"local ACL port"," first (Use Case compiles), then adapter.",[436,458,459,460,463],{},"If peer needed async → define ",[17,461,462],{},"Domain event payload",", dispatch via Shared dispatcher, write consumer listener + inbound Use Case.",[436,465,466,467,470],{},"For events: add ",[34,468,469],{},"eventId"," + idempotent consumer handling.",[436,472,473],{},"Run architecture boundary tests and feature tests on the host.",[14,475,476,477,481,482,486],{},"Next: ",[223,478,480],{"href":479},"\u002Fv1\u002Fcore\u002Fanti-patterns","anti-patterns"," · ",[223,483,485],{"href":484},"\u002Fv1\u002Fcookbook\u002Fordering-warehouse","cookbook",".",[488,489,490],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":32,"searchDepth":46,"depth":46,"links":492},[493,494,495,496],{"id":24,"depth":46,"text":25},{"id":187,"depth":46,"text":188},{"id":349,"depth":46,"text":350},{"id":430,"depth":46,"text":431},"Choose local Golden Flow, repository port, sync ACL, Domain Event, or Shared promotion.","md",{},"\u002Fv1\u002Fcore\u002Fdecision-tree",{"title":5,"description":497},"v1\u002Fcore\u002Fdecision-tree","giBYo9RXtqMlIZRaCLObU_QJlAvzkutP61vIdEw-bYs",1786241412473]