# priyanshuvijay1402/seatlock-event-ticket-booking-system architecture

> Architecture diagram of the GitHub repository priyanshuvijay1402/seatlock-event-ticket-booking-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/priyanshuvijay1402/seatlock-event-ticket-booking-system
- Repository: https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system

## Overview

SeatLock is an event-ticket booking application centered on competing for seats safely: users browse events, hold seats, then confirm payment to create bookings. The API supports direct and queued hold processing, selectable database locking strategies, Redis coordination and real-time seat updates, and background hold expiry. Admins can create seat maps and inspect booking integrity; a ticket-drop simulation exercises the workflow and reports correctness and latency. The graph follows documented capabilities and sampled wiring; unsampled route and worker internals are represented only where the README supports them.

Main entry points: [`frontend/src/App.tsx`](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/App.tsx) (React app), [`backend/src/http/app.ts`](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/app.ts) (Express app), [`backend/src/booking/service.ts`](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/service.ts) (Booking orchestration), [`frontend/src/api.ts`](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React app<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_event_browse["Event browsing<br/>[EventsPage.tsx]"]
  node_seat_selection["Seat selection<br/>[EventPage.tsx]"]
  node_checkout_ui["Checkout<br/>[CheckoutPage.tsx]"]
  node_booking_ui["My bookings<br/>[MyBookingsPage.tsx]"]
  node_admin_ui["Admin console<br/>[AdminPage.tsx]"]
end

subgraph group_api["HTTP API"]
  node_http_app["Express app<br/>[app.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.ts]"]
  node_event_routes["Event routes<br/>[events.ts]"]
  node_hold_routes["Hold routes<br/>[holds.ts]"]
  node_admin_routes["Admin routes<br/>[admin.ts]"]
end

subgraph group_booking["Booking domain"]
  node_booking_service["Booking orchestration<br/>[service.ts]"]
  node_locking["Lock strategies<br/>[pessimistic.ts]"]
  node_payment["Mock payment<br/>[payment.ts]"]
  node_admin_service["Event and integrity service<br/>[adminService.ts]"]
end

subgraph group_state["Coordination and state"]
  node_checkout_queue["Checkout queue<br/>[checkoutQueue.ts]"]
  node_worker["Queue worker and sweeper<br/>[worker.ts]"]
  node_redis_helpers["Redis coordination<br/>[seatEvents.ts]"]
end

subgraph group_operations["Admin and simulation"]
  node_ticket_drop["Ticket-drop simulation<br/>[ticketDrop.ts]"]
  node_cli["Simulation CLI<br/>[ticketDrop.ts]"]
end

node_visitor(("Ticket buyer"))
node_admin_user(("Admin user"))
node_postgres[("PostgreSQL")]
node_redis_store[("Redis")]

node_visitor -->|"uses"| node_app
node_admin_user -->|"uses"| node_app
node_app -->|"routes to"| node_event_browse
node_app -->|"routes to"| node_seat_selection
node_app -->|"routes to"| node_checkout_ui
node_app -->|"routes to"| node_booking_ui
node_app -->|"routes to"| node_admin_ui
node_event_browse -->|"requests events"| node_api_client
node_seat_selection -->|"requests seats"| node_api_client
node_checkout_ui -->|"confirms hold"| node_api_client
node_booking_ui -->|"requests bookings"| node_api_client
node_admin_ui -->|"requests admin"| node_api_client
node_api_client -->|"sends requests"| node_http_app
node_http_app -->|"dispatches auth"| node_auth_routes
node_http_app -->|"dispatches events"| node_event_routes
node_http_app -->|"dispatches holds"| node_hold_routes
node_http_app -->|"dispatches admin"| node_admin_routes
node_auth_routes -->|"reads/writes users"| node_postgres
node_event_routes -->|"reads event data"| node_postgres
node_event_routes -->|"uses seat map updates"| node_redis_helpers
node_hold_routes -->|"invokes booking operations"| node_booking_service
node_hold_routes -->|"enqueues checkout"| node_checkout_queue
node_admin_routes -->|"invokes admin operations"| node_admin_service
node_admin_routes -->|"runs simulation"| node_ticket_drop
node_booking_service -->|"selects strategy"| node_locking
node_booking_service -->|"charges/refunds"| node_payment
node_booking_service -->|"reads/writes bookings"| node_postgres
node_booking_service -->|"publishes seat changes"| node_redis_helpers
node_admin_service -->|"creates/checks records"| node_postgres
node_checkout_queue -->|"stores jobs"| node_redis_store
node_checkout_queue -->|"consumed by"| node_worker
node_worker -->|"expires holds"| node_booking_service
node_worker -->|"sweeps hold state"| node_postgres
node_redis_helpers -->|"caches/publishes"| node_redis_store
node_ticket_drop -->|"drives HTTP workflow"| node_http_app
node_ticket_drop -->|"checks integrity via API"| node_admin_service
node_cli -->|"runs"| node_ticket_drop

click node_app "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/api.ts"
click node_event_browse "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/EventsPage.tsx"
click node_seat_selection "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/EventPage.tsx"
click node_checkout_ui "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/CheckoutPage.tsx"
click node_booking_ui "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/MyBookingsPage.tsx"
click node_admin_ui "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/AdminPage.tsx"
click node_http_app "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/app.ts"
click node_auth_routes "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/auth.ts"
click node_event_routes "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/events.ts"
click node_hold_routes "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/holds.ts"
click node_admin_routes "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/admin.ts"
click node_booking_service "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/service.ts"
click node_locking "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/pessimistic.ts"
click node_payment "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/payment.ts"
click node_admin_service "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/adminService.ts"
click node_checkout_queue "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/queue/checkoutQueue.ts"
click node_worker "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/worker.ts"
click node_redis_helpers "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/redis/seatEvents.ts"
click node_ticket_drop "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/sim/ticketDrop.ts"
click node_cli "https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/scripts/ticketDrop.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_app,node_api_client,node_event_browse,node_seat_selection,node_checkout_ui,node_booking_ui,node_admin_ui,node_admin_user toneBlue
class node_http_app,node_auth_routes,node_event_routes,node_hold_routes,node_admin_routes,node_postgres,node_redis_store toneAmber
class node_booking_service,node_locking,node_payment,node_admin_service toneMint
class node_checkout_queue,node_worker,node_redis_helpers toneRose
class node_ticket_drop,node_cli,node_visitor toneIndigo
```

## Components

### Web client

- [React app](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Event browsing](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/EventsPage.tsx): `frontend/src/pages/EventsPage.tsx`
- [Seat selection](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/EventPage.tsx): `frontend/src/pages/EventPage.tsx`
- [Checkout](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/CheckoutPage.tsx): `frontend/src/pages/CheckoutPage.tsx`
- [My bookings](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/MyBookingsPage.tsx): `frontend/src/pages/MyBookingsPage.tsx`
- [Admin console](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/frontend/src/pages/AdminPage.tsx): `frontend/src/pages/AdminPage.tsx`

### HTTP API

- [Express app](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/app.ts): `backend/src/http/app.ts`
- [Authentication routes](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/auth.ts): `backend/src/http/routes/auth.ts`
- [Event routes](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/events.ts): `backend/src/http/routes/events.ts`
- [Hold routes](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/holds.ts): `backend/src/http/routes/holds.ts`
- [Admin routes](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/http/routes/admin.ts): `backend/src/http/routes/admin.ts`

### Booking domain

- [Booking orchestration](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/service.ts): `backend/src/booking/service.ts`
- [Lock strategies](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/pessimistic.ts): `backend/src/booking/pessimistic.ts`
- [Mock payment](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/payment.ts): `backend/src/booking/payment.ts`
- [Event and integrity service](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/booking/adminService.ts): `backend/src/booking/adminService.ts`

### Coordination and state

- [Checkout queue](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/queue/checkoutQueue.ts): `backend/src/queue/checkoutQueue.ts`
- [Queue worker and sweeper](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/worker.ts): `backend/src/worker.ts`
- [Redis coordination](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/redis/seatEvents.ts): `backend/src/redis/seatEvents.ts`

### Admin and simulation

- [Ticket-drop simulation](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/sim/ticketDrop.ts): `backend/src/sim/ticketDrop.ts`
- [Simulation CLI](https://github.com/priyanshuvijay1402/seatlock-event-ticket-booking-system/blob/main/backend/src/scripts/ticketDrop.ts): `backend/src/scripts/ticketDrop.ts`

### Other components

- **Ticket buyer**
- **Admin user**
- **PostgreSQL**
- **Redis**

## Connections

- Ticket buyer → React app: uses
- Admin user → React app: uses
- React app → Event browsing: routes to
- React app → Seat selection: routes to
- React app → Checkout: routes to
- React app → My bookings: routes to
- React app → Admin console: routes to
- Event browsing → API client: requests events
- Seat selection → API client: requests seats
- Checkout → API client: confirms hold
- My bookings → API client: requests bookings
- Admin console → API client: requests admin
- API client → Express app: sends requests
- Express app → Authentication routes: dispatches auth
- Express app → Event routes: dispatches events
- Express app → Hold routes: dispatches holds
- Express app → Admin routes: dispatches admin
- Authentication routes → PostgreSQL: reads/writes users
- Event routes → PostgreSQL: reads event data
- Event routes → Redis coordination: uses seat map updates
- Hold routes → Booking orchestration: invokes booking operations
- Hold routes → Checkout queue: enqueues checkout
- Admin routes → Event and integrity service: invokes admin operations
- Admin routes → Ticket-drop simulation: runs simulation
- Booking orchestration → Lock strategies: selects strategy
- Booking orchestration → Mock payment: charges/refunds
- Booking orchestration → PostgreSQL: reads/writes bookings
- Booking orchestration → Redis coordination: publishes seat changes
- Event and integrity service → PostgreSQL: creates/checks records
- Checkout queue → Redis: stores jobs
- Checkout queue → Queue worker and sweeper: consumed by
- Queue worker and sweeper → Booking orchestration: expires holds
- Queue worker and sweeper → PostgreSQL: sweeps hold state
- Redis coordination → Redis: caches/publishes
- Ticket-drop simulation → Express app: drives HTTP workflow
- Ticket-drop simulation → Event and integrity service: checks integrity via API
- Simulation CLI → Ticket-drop simulation: runs
