# schulczistvanjr/ticketing architecture

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

- Interactive diagram: https://gitdiagram.com/schulczistvanjr/ticketing
- Repository: https://github.com/schulczistvanjr/ticketing

## Overview

Ticketing is a web marketplace where users browse tickets, authenticate, place orders, and pay; tickets and orders also change through expiry and payment events. The map follows the sampled service startup and routing code plus event and route names in the tree; several route and listener implementations were not sampled, so uncertain call wiring is omitted.

Main entry points: [`client/api/build-client.js`](https://github.com/schulczistvanjr/ticketing/blob/main/client/api/build-client.js) (HTTP client), [`orders/src/app.ts`](https://github.com/schulczistvanjr/ticketing/blob/main/orders/src/app.ts) (Orders API), [`auth/src/app.ts`](https://github.com/schulczistvanjr/ticketing/blob/main/auth/src/app.ts) (Auth API), [`tickets/src/app.ts`](https://github.com/schulczistvanjr/ticketing/blob/main/tickets/src/app.ts) (Tickets API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_client["Web pages"]
  node_client_api["HTTP client<br/>[build-client.js]"]
end

subgraph group_identity["Identity"]
  node_auth_app["Auth API<br/>[app.ts]"]
  node_auth_routes["Auth routes"]
  node_user_model["User model<br/>[user.ts]"]
end

subgraph group_catalog["Ticket catalog"]
  node_tickets_app["Tickets API<br/>[app.ts]"]
  node_ticket_routes["Ticket routes"]
  node_ticket_model["Ticket model<br/>[ticket.ts]"]
end

subgraph group_commerce["Orders and payments"]
  node_orders_app["Orders API<br/>[app.ts]"]
  node_order_routes["Order routes"]
  node_order_model["Order model<br/>[order.ts]"]
  node_payments_app["Payments API<br/>[app.ts]"]
  node_payment_route["Charge route<br/>[new.ts]"]
  node_payment_model["Payment model<br/>[payment.ts]"]
  node_stripe_adapter["Stripe adapter<br/>[stripe.ts]"]
end

subgraph group_async["Event processing"]
  node_expiration_worker["Expiry worker<br/>[index.ts]"]
  node_expiration_listener["Order-created listener"]
  node_expiration_queue["Expiry queue"]
  node_ticket_events["Ticket event handlers"]
  node_order_events["Order event handlers"]
  node_payment_events["Payment event handlers"]
  node_expiration_publisher["Expiry publisher"]
  node_ticket_publishers["Ticket publishers"]
  node_order_publishers["Order publishers"]
  node_payment_publisher["Payment publisher"]
end

node_buyer(("User"))
node_mongo[("MongoDB")]
node_redis[("Redis")]
node_nats["NATS Streaming"]
node_stripe["Stripe"]

node_buyer -->|"uses"| node_client
node_client -->|"requests"| node_client_api
node_client_api -->|"fetches tickets"| node_tickets_app
node_client_api -->|"auth requests"| node_auth_app
node_client_api -->|"order requests"| node_orders_app
node_client_api -->|"payment requests"| node_payments_app
node_auth_app -->|"dispatches"| node_auth_routes
node_auth_routes -->|"reads/writes"| node_user_model
node_tickets_app -->|"dispatches"| node_ticket_routes
node_ticket_routes -->|"reads/writes"| node_ticket_model
node_orders_app -->|"dispatches"| node_order_routes
node_order_routes -->|"reads/writes"| node_order_model
node_orders_app -->|"uses"| node_ticket_model
node_payments_app -->|"dispatches"| node_payment_route
node_payment_route -->|"records"| node_payment_model
node_payment_route -->|"charges via"| node_stripe_adapter
node_stripe_adapter -->|"charges"| node_stripe
node_auth_app -->|"persists users"| node_mongo
node_tickets_app -->|"persists tickets"| node_mongo
node_orders_app -->|"persists orders"| node_mongo
node_payments_app -->|"persists payments"| node_mongo
node_expiration_worker -->|"starts listener"| node_expiration_listener
node_expiration_listener -->|"schedules"| node_expiration_queue
node_expiration_queue -->|"stores timers"| node_redis
node_expiration_listener -->|"subscribes"| node_nats
node_ticket_events -->|"subscribes"| node_nats
node_order_events -->|"subscribes"| node_nats
node_payment_events -->|"subscribes"| node_nats
node_ticket_publishers -->|"publishes"| node_nats
node_order_publishers -->|"publishes"| node_nats
node_payment_publisher -->|"publishes"| node_nats
node_expiration_publisher -->|"publishes"| node_nats
node_ticket_events -->|"updates"| node_ticket_model
node_order_events -->|"updates"| node_order_model
node_payment_events -->|"updates"| node_payment_model

click node_client "https://github.com/schulczistvanjr/ticketing/tree/main/client/pages"
click node_client_api "https://github.com/schulczistvanjr/ticketing/blob/main/client/api/build-client.js"
click node_auth_app "https://github.com/schulczistvanjr/ticketing/blob/main/auth/src/app.ts"
click node_auth_routes "https://github.com/schulczistvanjr/ticketing/tree/main/auth/src/routes"
click node_user_model "https://github.com/schulczistvanjr/ticketing/blob/main/auth/src/models/user.ts"
click node_tickets_app "https://github.com/schulczistvanjr/ticketing/blob/main/tickets/src/app.ts"
click node_ticket_routes "https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/routes"
click node_ticket_model "https://github.com/schulczistvanjr/ticketing/blob/main/tickets/src/models/ticket.ts"
click node_orders_app "https://github.com/schulczistvanjr/ticketing/blob/main/orders/src/app.ts"
click node_order_routes "https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/routes"
click node_order_model "https://github.com/schulczistvanjr/ticketing/blob/main/orders/src/models/order.ts"
click node_payments_app "https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/app.ts"
click node_payment_route "https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/routes/new.ts"
click node_payment_model "https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/models/payment.ts"
click node_stripe_adapter "https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/stripe.ts"
click node_expiration_worker "https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/index.ts"
click node_expiration_listener "https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/events/listeners/order-created-listener.ts"
click node_expiration_queue "https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/queues/expiration-queue.ts"
click node_ticket_events "https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/events/listeners"
click node_order_events "https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/events/listeners"
click node_payment_events "https://github.com/schulczistvanjr/ticketing/tree/main/payments/src/events/listeners"
click node_expiration_publisher "https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/events/publishers/expiration-complete-publisher.ts"
click node_ticket_publishers "https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/events/publishers"
click node_order_publishers "https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/events/publishers"
click node_payment_publisher "https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/events/publishers/payment-created-publisher.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_client,node_client_api,node_buyer toneBlue
class node_auth_app,node_auth_routes,node_user_model,node_mongo,node_redis toneAmber
class node_tickets_app,node_ticket_routes,node_ticket_model toneMint
class node_orders_app,node_order_routes,node_order_model,node_payments_app,node_payment_route,node_payment_model,node_stripe_adapter toneRose
class node_expiration_worker,node_expiration_listener,node_expiration_queue,node_ticket_events,node_order_events,node_payment_events,node_expiration_publisher,node_ticket_publishers,node_order_publishers,node_payment_publisher,node_nats,node_stripe toneIndigo
```

## Components

### Web client

- [Web pages](https://github.com/schulczistvanjr/ticketing/tree/main/client/pages): `client/pages`
- [HTTP client](https://github.com/schulczistvanjr/ticketing/blob/main/client/api/build-client.js): `client/api/build-client.js`

### Identity

- [Auth API](https://github.com/schulczistvanjr/ticketing/blob/main/auth/src/app.ts): `auth/src/app.ts`
- [Auth routes](https://github.com/schulczistvanjr/ticketing/tree/main/auth/src/routes): `auth/src/routes`
- [User model](https://github.com/schulczistvanjr/ticketing/blob/main/auth/src/models/user.ts): `auth/src/models/user.ts`

### Ticket catalog

- [Tickets API](https://github.com/schulczistvanjr/ticketing/blob/main/tickets/src/app.ts): `tickets/src/app.ts`
- [Ticket routes](https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/routes): `tickets/src/routes`
- [Ticket model](https://github.com/schulczistvanjr/ticketing/blob/main/tickets/src/models/ticket.ts): `tickets/src/models/ticket.ts`

### Orders and payments

- [Orders API](https://github.com/schulczistvanjr/ticketing/blob/main/orders/src/app.ts): `orders/src/app.ts`
- [Order routes](https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/routes): `orders/src/routes`
- [Order model](https://github.com/schulczistvanjr/ticketing/blob/main/orders/src/models/order.ts): `orders/src/models/order.ts`
- [Payments API](https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/app.ts): `payments/src/app.ts`
- [Charge route](https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/routes/new.ts): `payments/src/routes/new.ts`
- [Payment model](https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/models/payment.ts): `payments/src/models/payment.ts`
- [Stripe adapter](https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/stripe.ts): `payments/src/stripe.ts`

### Event processing

- [Expiry worker](https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/index.ts): `expiration/src/index.ts`
- [Order-created listener](https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/events/listeners/order-created-listener.ts): `expiration/src/events/listeners/order-created-listener.ts`
- [Expiry queue](https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/queues/expiration-queue.ts): `expiration/src/queues/expiration-queue.ts`
- [Ticket event handlers](https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/events/listeners): `tickets/src/events/listeners`
- [Order event handlers](https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/events/listeners): `orders/src/events/listeners`
- [Payment event handlers](https://github.com/schulczistvanjr/ticketing/tree/main/payments/src/events/listeners): `payments/src/events/listeners`
- [Expiry publisher](https://github.com/schulczistvanjr/ticketing/blob/main/expiration/src/events/publishers/expiration-complete-publisher.ts): `expiration/src/events/publishers/expiration-complete-publisher.ts`
- [Ticket publishers](https://github.com/schulczistvanjr/ticketing/tree/main/tickets/src/events/publishers): `tickets/src/events/publishers`
- [Order publishers](https://github.com/schulczistvanjr/ticketing/tree/main/orders/src/events/publishers): `orders/src/events/publishers`
- [Payment publisher](https://github.com/schulczistvanjr/ticketing/blob/main/payments/src/events/publishers/payment-created-publisher.ts): `payments/src/events/publishers/payment-created-publisher.ts`

### Other components

- **User**
- **MongoDB**
- **Redis**
- **NATS Streaming**
- **Stripe**

## Connections

- User → Web pages: uses
- Web pages → HTTP client: requests
- HTTP client → Tickets API: fetches tickets
- HTTP client → Auth API: auth requests
- HTTP client → Orders API: order requests
- HTTP client → Payments API: payment requests
- Auth API → Auth routes: dispatches
- Auth routes → User model: reads/writes
- Tickets API → Ticket routes: dispatches
- Ticket routes → Ticket model: reads/writes
- Orders API → Order routes: dispatches
- Order routes → Order model: reads/writes
- Orders API → Ticket model: uses
- Payments API → Charge route: dispatches
- Charge route → Payment model: records
- Charge route → Stripe adapter: charges via
- Stripe adapter → Stripe: charges
- Auth API → MongoDB: persists users
- Tickets API → MongoDB: persists tickets
- Orders API → MongoDB: persists orders
- Payments API → MongoDB: persists payments
- Expiry worker → Order-created listener: starts listener
- Order-created listener → Expiry queue: schedules
- Expiry queue → Redis: stores timers
- Order-created listener → NATS Streaming: subscribes
- Ticket event handlers → NATS Streaming: subscribes
- Order event handlers → NATS Streaming: subscribes
- Payment event handlers → NATS Streaming: subscribes
- Ticket publishers → NATS Streaming: publishes
- Order publishers → NATS Streaming: publishes
- Payment publisher → NATS Streaming: publishes
- Expiry publisher → NATS Streaming: publishes
- Ticket event handlers → Ticket model: updates
- Order event handlers → Order model: updates
- Payment event handlers → Payment model: updates
