{
  "name": "RoomBook",
  "status": "illustrative architecture",
  "assumptions": [
    "Employees reserve one room for one fixed 30-minute slot.",
    "Workplace Identity and Email Delivery are separately operated software systems.",
    "The application owns the Web app, Booking API, Booking database and Notification worker.",
    "A database uniqueness constraint on (room_id, slot_start) rejects concurrent duplicate reservations.",
    "The booking and outbox records are written in one shared database transaction.",
    "Outbox delivery is at least once; duplicate emails remain possible unless the email provider supports a suitable deduplication contract."
  ],
  "views": [
    {
      "id": "context",
      "title": "System context \u00b7 RoomBook",
      "scope": "RoomBook",
      "nodes": [
        {
          "id": "employee",
          "name": "Employee",
          "type": "Person",
          "responsibility": "Finds and reserves a room"
        },
        {
          "id": "roombook",
          "name": "RoomBook",
          "type": "Software system",
          "responsibility": "Manages room availability and reservations"
        },
        {
          "id": "identity",
          "name": "Workplace Identity",
          "type": "External software system",
          "responsibility": "Authenticates employees and publishes signing keys"
        },
        {
          "id": "email",
          "name": "Email Delivery",
          "type": "External software system",
          "responsibility": "Delivers reservation messages"
        }
      ],
      "relationships": [
        {
          "source": "employee",
          "target": "roombook",
          "label": "Finds rooms and manages reservations"
        },
        {
          "source": "roombook",
          "target": "identity",
          "label": "Uses employee identity and signing keys"
        },
        {
          "source": "roombook",
          "target": "email",
          "label": "Requests confirmation delivery"
        }
      ],
      "scopeId": "roombook"
    },
    {
      "id": "container",
      "title": "Containers \u00b7 RoomBook",
      "scope": "RoomBook",
      "nodes": [
        {
          "id": "employee",
          "name": "Employee",
          "type": "Person",
          "responsibility": "Reserves meeting rooms"
        },
        {
          "id": "web",
          "name": "Web app",
          "type": "Container: TypeScript SPA",
          "responsibility": "Displays rooms and reservation status"
        },
        {
          "id": "api",
          "name": "Booking API",
          "type": "Container: Python / FastAPI",
          "responsibility": "Authorizes and records reservations"
        },
        {
          "id": "db",
          "name": "Booking database",
          "type": "Container: PostgreSQL",
          "responsibility": "Stores rooms, reservations and outbox"
        },
        {
          "id": "worker",
          "name": "Notification worker",
          "type": "Container: Python process",
          "responsibility": "Delivers queued confirmations"
        },
        {
          "id": "identity",
          "name": "Workplace Identity",
          "type": "External software system",
          "responsibility": "Issues tokens and publishes signing keys"
        },
        {
          "id": "email",
          "name": "Email Delivery",
          "type": "External software system",
          "responsibility": "Accepts outbound email requests"
        }
      ],
      "relationships": [
        {
          "source": "employee",
          "target": "web",
          "label": "Uses [HTTPS]"
        },
        {
          "source": "web",
          "target": "identity",
          "label": "Signs in [OIDC / HTTPS]"
        },
        {
          "source": "web",
          "target": "api",
          "label": "Requests rooms and bookings [JSON / HTTPS]"
        },
        {
          "source": "api",
          "target": "identity",
          "label": "Fetches signing keys [JWKS / HTTPS]"
        },
        {
          "source": "api",
          "target": "db",
          "label": "Reads rooms; commits booking + outbox [SQL / TLS]"
        },
        {
          "source": "worker",
          "target": "db",
          "label": "Claims outbox; records delivery [SQL / TLS]"
        },
        {
          "source": "worker",
          "target": "email",
          "label": "Submits confirmation [HTTPS API]"
        }
      ],
      "scopeId": "roombook"
    },
    {
      "id": "component",
      "title": "Components \u00b7 Booking API",
      "scope": "Booking API",
      "nodes": [
        {
          "id": "web",
          "name": "Web app",
          "type": "Supporting container",
          "responsibility": "Sends authenticated booking requests"
        },
        {
          "id": "controller",
          "name": "BookingController",
          "type": "Component: Python / FastAPI",
          "responsibility": "Parses requests and maps responses"
        },
        {
          "id": "policy",
          "name": "AccessPolicy",
          "type": "Component: Python module",
          "responsibility": "Validates identity and room access"
        },
        {
          "id": "identity",
          "name": "Workplace Identity",
          "type": "External software system",
          "responsibility": "Publishes signing keys"
        },
        {
          "id": "service",
          "name": "BookingService",
          "type": "Component: Python module",
          "responsibility": "Coordinates one booking transaction"
        },
        {
          "id": "repository",
          "name": "BookingRepository",
          "type": "Component: Python module",
          "responsibility": "Reads availability; stores reservation"
        },
        {
          "id": "outbox",
          "name": "OutboxWriter",
          "type": "Component: Python module",
          "responsibility": "Stores a confirmation event in the same transaction"
        },
        {
          "id": "db",
          "name": "Booking database",
          "type": "Supporting container: PostgreSQL",
          "responsibility": "Persists reservation and pending message"
        }
      ],
      "relationships": [
        {
          "source": "web",
          "target": "controller",
          "label": "POST /bookings [JSON / HTTPS]"
        },
        {
          "source": "controller",
          "target": "policy",
          "label": "Checks identity and room permission [in-process]"
        },
        {
          "source": "policy",
          "target": "identity",
          "label": "Refreshes signing keys [JWKS / HTTPS]"
        },
        {
          "source": "controller",
          "target": "service",
          "label": "Requests reservation [in-process]"
        },
        {
          "source": "service",
          "target": "repository",
          "label": "Reads and writes within shared transaction [in-process]"
        },
        {
          "source": "service",
          "target": "outbox",
          "label": "Adds notification within shared transaction [in-process]"
        },
        {
          "source": "repository",
          "target": "db",
          "label": "Reads slots; inserts booking [SQL / TLS]"
        },
        {
          "source": "outbox",
          "target": "db",
          "label": "Inserts outbox record [SQL / TLS]"
        }
      ],
      "scopeId": "api"
    }
  ]
}
