Modular-Monolith-diagram.excalidraw

==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠==

Modular Monolith — Enforced Module Boundaries with Public API Surfaces

Text Elements

Single Deployable Unit -- Monolith Process ^monolith-label

Orders Module ^orders-label Public API (OrderService interface) ^orders-api Internal Domain ^orders-domain Internal Persistence ^orders-persistence

Inventory Module ^inventory-label Public API (InventoryService interface) ^inventory-api Internal Domain ^inventory-domain Internal Persistence ^inventory-persistence

Billing Module ^billing-label Public API (BillingService interface) ^billing-api Internal Domain ^billing-domain Internal Persistence ^billing-persistence

via interface ^arrow1-label via interface ^arrow2-label

dependency-cruiser / ArchUnit ^tooling-label ENFORCES: no direct access to internal packages ^enforces-label

Valid end-state -- NOT a stepping stone to microservices ^endstate-label

%%

Drawing

{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "id": "monolith-outer",
      "type": "rectangle",
      "x": 20,
      "y": 20,
      "width": 860,
      "height": 440,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#f8f9fa",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "strokeStyle": "dashed",
      "opacity": 100
    },
    {
      "id": "monolith-label",
      "type": "text",
      "x": 30,
      "y": 30,
      "width": 380,
      "height": 24,
      "text": "Single Deployable Unit -- Monolith Process",
      "fontSize": 15,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-module",
      "type": "rectangle",
      "x": 50,
      "y": 70,
      "width": 240,
      "height": 360,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d3f9d8",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-label",
      "type": "text",
      "x": 100,
      "y": 82,
      "width": 140,
      "height": 24,
      "text": "Orders Module",
      "fontSize": 15,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-api-box",
      "type": "rectangle",
      "x": 60,
      "y": 116,
      "width": 220,
      "height": 80,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#b2f2bb",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-api-text",
      "type": "text",
      "x": 70,
      "y": 136,
      "width": 200,
      "height": 40,
      "text": "Public API\n(OrderService interface)",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-domain-box",
      "type": "rectangle",
      "x": 60,
      "y": 210,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d3f9d8",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-domain-text",
      "type": "text",
      "x": 70,
      "y": 240,
      "width": 200,
      "height": 32,
      "text": "Internal Domain\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-persist-box",
      "type": "rectangle",
      "x": 60,
      "y": 314,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d3f9d8",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "orders-persist-text",
      "type": "text",
      "x": 70,
      "y": 344,
      "width": 200,
      "height": 32,
      "text": "Internal Persistence\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-module",
      "type": "rectangle",
      "x": 330,
      "y": 70,
      "width": 240,
      "height": 360,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-label",
      "type": "text",
      "x": 370,
      "y": 82,
      "width": 160,
      "height": 24,
      "text": "Inventory Module",
      "fontSize": 15,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-api-box",
      "type": "rectangle",
      "x": 340,
      "y": 116,
      "width": 220,
      "height": 80,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#a5d8ff",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-api-text",
      "type": "text",
      "x": 350,
      "y": 136,
      "width": 200,
      "height": 40,
      "text": "Public API\n(InventoryService interface)",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-domain-box",
      "type": "rectangle",
      "x": 340,
      "y": 210,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-domain-text",
      "type": "text",
      "x": 350,
      "y": 240,
      "width": 200,
      "height": 32,
      "text": "Internal Domain\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-persist-box",
      "type": "rectangle",
      "x": 340,
      "y": 314,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "inventory-persist-text",
      "type": "text",
      "x": 350,
      "y": 344,
      "width": 200,
      "height": 32,
      "text": "Internal Persistence\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-module",
      "type": "rectangle",
      "x": 610,
      "y": 70,
      "width": 240,
      "height": 360,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#ffe8cc",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-label",
      "type": "text",
      "x": 660,
      "y": 82,
      "width": 140,
      "height": 24,
      "text": "Billing Module",
      "fontSize": 15,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-api-box",
      "type": "rectangle",
      "x": 620,
      "y": 116,
      "width": 220,
      "height": 80,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#ffd8a8",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-api-text",
      "type": "text",
      "x": 630,
      "y": 136,
      "width": 200,
      "height": 40,
      "text": "Public API\n(BillingService interface)",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-domain-box",
      "type": "rectangle",
      "x": 620,
      "y": 210,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#ffe8cc",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-domain-text",
      "type": "text",
      "x": 630,
      "y": 240,
      "width": 200,
      "height": 32,
      "text": "Internal Domain\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-persist-box",
      "type": "rectangle",
      "x": 620,
      "y": 314,
      "width": 220,
      "height": 90,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#ffe8cc",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "billing-persist-text",
      "type": "text",
      "x": 630,
      "y": 344,
      "width": 200,
      "height": 32,
      "text": "Internal Persistence\n[internal]",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#495057",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-orders-inventory",
      "type": "arrow",
      "x": 282,
      "y": 156,
      "width": 56,
      "height": 0,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [56, 0]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "via interface",
        "fontSize": 11,
        "strokeColor": "#1e1e1e"
      }
    },
    {
      "id": "arrow-orders-billing",
      "type": "arrow",
      "x": 282,
      "y": 170,
      "width": 336,
      "height": 0,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [336, 0]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "via interface",
        "fontSize": 11,
        "strokeColor": "#1e1e1e"
      }
    },
    {
      "id": "tooling-box",
      "type": "rectangle",
      "x": 240,
      "y": 480,
      "width": 420,
      "height": 50,
      "strokeColor": "#e03131",
      "backgroundColor": "#fff5f5",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "tooling-text",
      "type": "text",
      "x": 260,
      "y": 497,
      "width": 380,
      "height": 20,
      "text": "dependency-cruiser / ArchUnit",
      "fontSize": 14,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "enforce-arrow",
      "type": "arrow",
      "x": 450,
      "y": 460,
      "width": 0,
      "height": -18,
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [0, -18]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "enforces-text",
      "type": "text",
      "x": 140,
      "y": 542,
      "width": 620,
      "height": 20,
      "text": "ENFORCES: no direct access to internal packages",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "endstate-text",
      "type": "text",
      "x": 140,
      "y": 576,
      "width": 620,
      "height": 20,
      "text": "Valid end-state -- NOT a stepping stone to microservices",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    }
  ],
  "appState": {
    "gridSize": null,
    "viewBackgroundColor": "#ffffff"
  },
  "files": {}
}

%%