# cruzambrociogl/box-office architecture

> Architecture diagram of the GitHub repository cruzambrociogl/box-office, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cruzambrociogl/box-office
- Repository: https://github.com/cruzambrociogl/box-office

## Overview

Box office is a ticket-selling application with an organiser setup flow, a buyer purchase and refund flow, and a door check-in flow. The website presents those user experiences and calls the API; the API coordinates event and order rules, PostgreSQL persistence, Stripe payments, and queued ticket and email work. The README documents reminders and organiser webhooks, but their implementation was not sampled, so those capabilities are shown without speculative internal call chains. Relationships are limited to excerpted source and README evidence.

Main entry points: [`web/src/lib/api.ts`](https://github.com/cruzambrociogl/box-office/blob/main/web/src/lib/api.ts) (API client), [`api/src/refunds/refunds.service.ts`](https://github.com/cruzambrociogl/box-office/blob/main/api/src/refunds/refunds.service.ts) (Refund workflow), [`api/src/orders/orders.service.ts`](https://github.com/cruzambrociogl/box-office/blob/main/api/src/orders/orders.service.ts) (Order workflow), [`api/src/payments/payments.service.ts`](https://github.com/cruzambrociogl/box-office/blob/main/api/src/payments/payments.service.ts) (Stripe payments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Website"]
  node_web_pages["Buyer pages<br/>[+page.svelte]"]
  node_event_page["Event page<br/>[+page.svelte]"]
  node_order_page["Order page<br/>[+page.svelte]"]
  node_organiser_page["Organiser page<br/>[+page.svelte]"]
  node_door_page["Door page<br/>[+page.svelte]"]
  node_web_api["API client<br/>[api.ts]"]
end

subgraph group_catalog["Event management"]
  node_organiser_api["Organiser API"]
  node_event_api["Event catalog API<br/>[events.service.ts]"]
  node_ticket_types["Ticket types"]
end

subgraph group_sales["Sales and payments"]
  node_orders["Order workflow<br/>[orders.service.ts]"]
  node_order_store["Order storage"]
  node_payments["Stripe payments"]
  node_refunds["Refund workflow<br/>[refunds.service.ts]"]
  node_refund_store["Refund records"]
end

subgraph group_operations["Ticket operations"]
  node_tickets["Ticket issuance<br/>[tickets.service.ts]"]
  node_ticket_store["Ticket records"]
  node_checkins["Check-in validation"]
  node_checkin_store["Check-in records"]
  node_jobs["Background queue<br/>[jobs.service.ts]"]
  node_mail["Email delivery<br/>[mail.service.ts]"]
  node_reminders["Ticket reminders"]
  node_database["Database connection<br/>[database.module.ts]"]
  node_schema["Domain schema<br/>[schema.ts]"]
end

node_organiser(("Organiser"))
node_buyer(("Buyer"))
node_door_staff(("Door staff"))
node_stripe{{"Stripe"}}
node_smtp{{"SMTP server"}}
node_postgres[("PostgreSQL")]
node_webhook{{"Organiser webhook"}}

node_organiser -->|"manages events"| node_organiser_page
node_buyer -->|"browses events"| node_web_pages
node_buyer -->|"chooses tickets"| node_event_page
node_door_staff -->|"scans codes"| node_door_page
node_web_pages -->|"requests data"| node_web_api
node_event_page -->|"requests event"| node_web_api
node_order_page -->|"requests order"| node_web_api
node_organiser_page -->|"manages events"| node_web_api
node_door_page -->|"submits scan"| node_web_api
node_web_api -->|"calls API"| node_organiser_api
node_web_api -->|"calls API"| node_event_api
node_web_api -->|"calls API"| node_orders
node_web_api -->|"calls API"| node_checkins
node_organiser_api -.->|"persists organisers"| node_postgres
node_event_api -->|"manages ticket types"| node_ticket_types
node_event_api -.->|"persists events"| node_postgres
node_orders -->|"checks availability"| node_ticket_types
node_orders -->|"holds seats"| node_order_store
node_orders -->|"starts checkout"| node_payments
node_payments -->|"creates checkout"| node_stripe
node_stripe -->|"sends webhook"| node_payments
node_payments -->|"confirms payment"| node_orders
node_orders -->|"queues issuance"| node_jobs
node_jobs -.->|"dispatches job"| node_tickets
node_tickets -->|"issues tickets"| node_ticket_store
node_orders -->|"loads order tickets"| node_ticket_store
node_buyer -->|"requests refund"| node_refunds
node_refunds -->|"reads order"| node_order_store
node_refunds -->|"checks event"| node_ticket_types
node_refunds -->|"checks and voids"| node_ticket_store
node_refunds -->|"returns payment"| node_payments
node_refunds -->|"records refund"| node_refund_store
node_refunds -->|"queues confirmation"| node_jobs
node_checkins -->|"validates ticket"| node_ticket_store
node_checkins -->|"records entry"| node_checkin_store
node_jobs -.->|"dispatches job"| node_reminders
node_reminders -->|"finds ticket holders"| node_ticket_store
node_reminders -->|"sends reminders"| node_mail
node_tickets -->|"emails tickets"| node_mail
node_mail -->|"sends email"| node_smtp
node_organiser_api -.->|"notifies sales"| node_webhook
node_database -->|"types database"| node_schema
node_database -->|"connects database"| node_postgres
node_schema -->|"defines tables"| node_postgres

click node_web_pages "https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/%2Bpage.svelte"
click node_event_page "https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/events/%5Bid%5D/%2Bpage.svelte"
click node_order_page "https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/orders/%5Bid%5D/%2Bpage.svelte"
click node_organiser_page "https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/organiser/%2Bpage.svelte"
click node_door_page "https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/door/%2Bpage.svelte"
click node_web_api "https://github.com/cruzambrociogl/box-office/blob/main/web/src/lib/api.ts"
click node_organiser_api "https://github.com/cruzambrociogl/box-office/blob/main/api/src/organisers/organisers.service.ts"
click node_event_api "https://github.com/cruzambrociogl/box-office/blob/main/api/src/events/events.service.ts"
click node_ticket_types "https://github.com/cruzambrociogl/box-office/blob/main/api/src/events/ticket-types.repository.ts"
click node_orders "https://github.com/cruzambrociogl/box-office/blob/main/api/src/orders/orders.service.ts"
click node_order_store "https://github.com/cruzambrociogl/box-office/blob/main/api/src/orders/orders.repository.ts"
click node_payments "https://github.com/cruzambrociogl/box-office/blob/main/api/src/payments/payments.service.ts"
click node_refunds "https://github.com/cruzambrociogl/box-office/blob/main/api/src/refunds/refunds.service.ts"
click node_refund_store "https://github.com/cruzambrociogl/box-office/blob/main/api/src/refunds/refunds.repository.ts"
click node_tickets "https://github.com/cruzambrociogl/box-office/blob/main/api/src/tickets/tickets.service.ts"
click node_ticket_store "https://github.com/cruzambrociogl/box-office/blob/main/api/src/tickets/tickets.repository.ts"
click node_checkins "https://github.com/cruzambrociogl/box-office/blob/main/api/src/check-ins/check-ins.service.ts"
click node_checkin_store "https://github.com/cruzambrociogl/box-office/blob/main/api/src/check-ins/check-ins.repository.ts"
click node_jobs "https://github.com/cruzambrociogl/box-office/blob/main/api/src/jobs/jobs.service.ts"
click node_mail "https://github.com/cruzambrociogl/box-office/blob/main/api/src/mail/mail.service.ts"
click node_reminders "https://github.com/cruzambrociogl/box-office/blob/main/api/src/reminders/reminders.service.ts"
click node_database "https://github.com/cruzambrociogl/box-office/blob/main/api/src/database/database.module.ts"
click node_schema "https://github.com/cruzambrociogl/box-office/blob/main/api/src/database/schema.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_pages,node_event_page,node_order_page,node_organiser_page,node_door_page,node_web_api toneBlue
class node_organiser_api,node_event_api,node_ticket_types,node_postgres toneAmber
class node_orders,node_order_store,node_payments,node_refunds,node_refund_store,node_smtp,node_webhook toneMint
class node_tickets,node_ticket_store,node_checkins,node_checkin_store,node_jobs,node_mail,node_reminders,node_database,node_schema toneRose
class node_organiser,node_buyer,node_door_staff,node_stripe toneIndigo
```

## Components

### Website

- [Buyer pages](https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/%2Bpage.svelte): `web/src/routes/+page.svelte`
- [Event page](https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/events/%5Bid%5D/%2Bpage.svelte): `web/src/routes/events/[id]/+page.svelte`
- [Order page](https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/orders/%5Bid%5D/%2Bpage.svelte): `web/src/routes/orders/[id]/+page.svelte`
- [Organiser page](https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/organiser/%2Bpage.svelte): `web/src/routes/organiser/+page.svelte`
- [Door page](https://github.com/cruzambrociogl/box-office/blob/main/web/src/routes/door/%2Bpage.svelte): `web/src/routes/door/+page.svelte`
- [API client](https://github.com/cruzambrociogl/box-office/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`

### Event management

- [Organiser API](https://github.com/cruzambrociogl/box-office/blob/main/api/src/organisers/organisers.service.ts): `api/src/organisers/organisers.service.ts`
- [Event catalog API](https://github.com/cruzambrociogl/box-office/blob/main/api/src/events/events.service.ts): `api/src/events/events.service.ts`
- [Ticket types](https://github.com/cruzambrociogl/box-office/blob/main/api/src/events/ticket-types.repository.ts): `api/src/events/ticket-types.repository.ts`

### Sales and payments

- [Order workflow](https://github.com/cruzambrociogl/box-office/blob/main/api/src/orders/orders.service.ts): `api/src/orders/orders.service.ts`
- [Order storage](https://github.com/cruzambrociogl/box-office/blob/main/api/src/orders/orders.repository.ts): `api/src/orders/orders.repository.ts`
- [Stripe payments](https://github.com/cruzambrociogl/box-office/blob/main/api/src/payments/payments.service.ts): `api/src/payments/payments.service.ts`
- [Refund workflow](https://github.com/cruzambrociogl/box-office/blob/main/api/src/refunds/refunds.service.ts): `api/src/refunds/refunds.service.ts`
- [Refund records](https://github.com/cruzambrociogl/box-office/blob/main/api/src/refunds/refunds.repository.ts): `api/src/refunds/refunds.repository.ts`

### Ticket operations

- [Ticket issuance](https://github.com/cruzambrociogl/box-office/blob/main/api/src/tickets/tickets.service.ts): `api/src/tickets/tickets.service.ts`
- [Ticket records](https://github.com/cruzambrociogl/box-office/blob/main/api/src/tickets/tickets.repository.ts): `api/src/tickets/tickets.repository.ts`
- [Check-in validation](https://github.com/cruzambrociogl/box-office/blob/main/api/src/check-ins/check-ins.service.ts): `api/src/check-ins/check-ins.service.ts`
- [Check-in records](https://github.com/cruzambrociogl/box-office/blob/main/api/src/check-ins/check-ins.repository.ts): `api/src/check-ins/check-ins.repository.ts`
- [Background queue](https://github.com/cruzambrociogl/box-office/blob/main/api/src/jobs/jobs.service.ts): `api/src/jobs/jobs.service.ts`
- [Email delivery](https://github.com/cruzambrociogl/box-office/blob/main/api/src/mail/mail.service.ts): `api/src/mail/mail.service.ts`
- [Ticket reminders](https://github.com/cruzambrociogl/box-office/blob/main/api/src/reminders/reminders.service.ts): `api/src/reminders/reminders.service.ts`
- [Database connection](https://github.com/cruzambrociogl/box-office/blob/main/api/src/database/database.module.ts): `api/src/database/database.module.ts`
- [Domain schema](https://github.com/cruzambrociogl/box-office/blob/main/api/src/database/schema.ts): `api/src/database/schema.ts`

### Other components

- **Organiser**
- **Buyer**
- **Door staff**
- **Stripe**
- **SMTP server**
- **PostgreSQL**
- **Organiser webhook**

## Connections

- Organiser → Organiser page: manages events
- Buyer → Buyer pages: browses events
- Buyer → Event page: chooses tickets
- Door staff → Door page: scans codes
- Buyer pages → API client: requests data (evidence: `web/src/lib/api.ts`)
- Event page → API client: requests event (evidence: `web/src/lib/api.ts`)
- Order page → API client: requests order (evidence: `web/src/lib/api.ts`)
- Organiser page → API client: manages events (evidence: `web/src/lib/api.ts`)
- Door page → API client: submits scan (evidence: `web/src/lib/api.ts`)
- API client → Organiser API: calls API (evidence: `web/src/lib/api.ts`)
- API client → Event catalog API: calls API (evidence: `web/src/lib/api.ts`)
- API client → Order workflow: calls API (evidence: `web/src/lib/api.ts`)
- API client → Check-in validation: calls API (evidence: `web/src/lib/api.ts`)
- Organiser API → PostgreSQL: persists organisers
- Event catalog API → Ticket types: manages ticket types (evidence: `api/src/events/events.service.ts`)
- Event catalog API → PostgreSQL: persists events
- Order workflow → Ticket types: checks availability (evidence: `api/src/orders/orders.service.ts`)
- Order workflow → Order storage: holds seats (evidence: `api/src/orders/orders.service.ts`)
- Order workflow → Stripe payments: starts checkout (evidence: `api/src/orders/orders.service.ts`)
- Stripe payments → Stripe: creates checkout (evidence: `api/src/payments/payments.service.ts`)
- Stripe → Stripe payments: sends webhook
- Stripe payments → Order workflow: confirms payment (evidence: `api/src/payments/payments.controller.ts`)
- Order workflow → Background queue: queues issuance (evidence: `api/src/orders/orders.service.ts`)
- Background queue → Ticket issuance: dispatches job (evidence: `api/src/tickets/tickets.service.ts`)
- Ticket issuance → Ticket records: issues tickets (evidence: `api/src/tickets/tickets.service.ts`)
- Order workflow → Ticket records: loads order tickets (evidence: `api/src/orders/orders.service.ts`)
- Buyer → Refund workflow: requests refund
- Refund workflow → Order storage: reads order (evidence: `api/src/refunds/refunds.service.ts`)
- Refund workflow → Ticket types: checks event (evidence: `api/src/refunds/refunds.service.ts`)
- Refund workflow → Ticket records: checks and voids (evidence: `api/src/refunds/refunds.service.ts`)
- Refund workflow → Stripe payments: returns payment (evidence: `api/src/refunds/refunds.service.ts`)
- Refund workflow → Refund records: records refund (evidence: `api/src/refunds/refunds.service.ts`)
- Refund workflow → Background queue: queues confirmation (evidence: `api/src/refunds/refunds.service.ts`)
- Check-in validation → Ticket records: validates ticket (evidence: `api/src/check-ins/check-ins.service.ts`)
- Check-in validation → Check-in records: records entry (evidence: `api/src/check-ins/check-ins.service.ts`)
- Background queue → Ticket reminders: dispatches job (evidence: `api/src/reminders/reminders.service.ts`)
- Ticket reminders → Ticket records: finds ticket holders (evidence: `api/src/reminders/reminders.service.ts`)
- Ticket reminders → Email delivery: sends reminders (evidence: `api/src/reminders/reminders.service.ts`)
- Ticket issuance → Email delivery: emails tickets (evidence: `api/src/tickets/tickets.service.ts`)
- Email delivery → SMTP server: sends email (evidence: `api/src/mail/mail.service.ts`)
- Organiser API → Organiser webhook: notifies sales
- Database connection → Domain schema: types database (evidence: `api/src/database/database.module.ts`)
- Database connection → PostgreSQL: connects database (evidence: `api/src/database/database.module.ts`)
- Domain schema → PostgreSQL: defines tables (evidence: `api/src/database/schema.ts`)
