# ansifar88/ticketing-microservices architecture

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

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

## Overview

This repository implements a ticket marketplace as a browser client and separate authentication, ticket, order, payment, and expiration services, with event messaging between services. The principal workflow is signing in, creating and reserving an order for a ticket, paying for it, and handling expiration or cancellation. The graph includes the documented source-level calls and references; several client pages and service listeners were not sampled, so their connections are omitted rather than inferred.

Main entry points: [`orders/src/routes`](https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/routes) (Order routes), [`payments/src/callback/stripe-callback.ts`](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/callback/stripe-callback.ts) (Stripe callback), [`orders/src/app.ts`](https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/app.ts) (Order HTTP app), [`client/pages`](https://github.com/ansifar88/ticketing-microservices/tree/master/client/pages) (Marketplace pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_client_pages["Marketplace pages"]
  node_client_requests["API request hook<br/>[use-request.js]"]
  node_client_header["Navigation header<br/>[header.js]"]
end

subgraph group_identity["Identity"]
  node_auth_app["Auth HTTP app<br/>[app.ts]"]
  node_auth_routes["Sign-in and account routes"]
  node_user_model[("User model<br/>[user.ts]")]
  node_auth_metrics["Auth metrics<br/>[metrics.ts]"]
end

subgraph group_commerce["Tickets and orders"]
  node_ticket_app["Ticket HTTP app<br/>[app.ts]"]
  node_ticket_routes["Ticket routes"]
  node_ticket_model[("Ticket model<br/>[ticket.ts]")]
  node_order_app["Order HTTP app<br/>[app.ts]"]
  node_order_routes["Order routes"]
  node_order_model[("Order model<br/>[order.ts]")]
  node_order_ticket_model[("Order ticket model<br/>[ticket.ts]")]
  node_order_listeners["Order event listeners"]
  node_order_publishers["Order event publishers"]
end

subgraph group_payments["Payments and expiration"]
  node_payment_app["Payment HTTP app<br/>[app.ts]"]
  node_payment_route["Create payment<br/>[new.ts]"]
  node_payment_callback["Stripe callback<br/>[stripe-callback.ts]"]
  node_payment_model[("Payment model<br/>[payment.ts]")]
  node_payment_order_model[("Payment order model<br/>[order.ts]")]
  node_payment_publisher["Payment event publisher"]
  node_expiration_listener["Order-created listener"]
  node_expiration_queue["Expiration queue"]
  node_expiration_publisher["Expiration event publisher"]
end

subgraph group_messaging["Event messaging"]
  node_nats["NATS Streaming"]
end

node_browser_user(("Marketplace user"))
node_stripe["Stripe"]
node_metrics["Service metrics<br/>[metrics.ts]"]

node_browser_user -.->|"uses"| node_client_pages
node_client_pages -.->|"submits requests"| node_client_requests
node_client_pages -.->|"renders"| node_client_header
node_auth_app -->|"registers routes"| node_auth_routes
node_auth_app -->|"uses metrics"| node_auth_metrics
node_auth_routes -->|"uses"| node_user_model
node_ticket_app -->|"registers routes"| node_ticket_routes
node_ticket_app -->|"uses metrics"| node_metrics
node_order_app -->|"registers routes"| node_order_routes
node_order_app -->|"uses metrics"| node_metrics
node_order_routes -->|"reads ticket"| node_order_ticket_model
node_order_routes -->|"creates order"| node_order_model
node_order_routes -->|"publishes order event"| node_order_publishers
node_order_app -->|"registers listeners"| node_order_listeners
node_order_listeners -->|"updates order"| node_order_model
node_payment_app -->|"registers route"| node_payment_route
node_payment_app -->|"registers callback"| node_payment_callback
node_payment_route -->|"reads order"| node_payment_order_model
node_payment_route -->|"creates intent"| node_stripe
node_payment_callback -->|"uses"| node_stripe
node_payment_callback -->|"uses"| node_payment_model
node_payment_callback -->|"publishes payment"| node_payment_publisher
node_expiration_listener -->|"enqueues expiration"| node_expiration_queue
node_order_publishers -.->|"publishes events"| node_nats
node_order_listeners -.->|"consumes events"| node_nats
node_payment_publisher -.->|"publishes event"| node_nats
node_expiration_listener -.->|"consumes event"| node_nats
node_expiration_publisher -.->|"publishes event"| node_nats

click node_client_pages "https://github.com/ansifar88/ticketing-microservices/tree/master/client/pages"
click node_client_requests "https://github.com/ansifar88/ticketing-microservices/blob/master/client/hooks/use-request.js"
click node_client_header "https://github.com/ansifar88/ticketing-microservices/blob/master/client/components/header.js"
click node_auth_app "https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/app.ts"
click node_auth_routes "https://github.com/ansifar88/ticketing-microservices/tree/master/auth/src/routes"
click node_user_model "https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/models/user.ts"
click node_auth_metrics "https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/metrics/metrics.ts"
click node_ticket_app "https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/app.ts"
click node_ticket_routes "https://github.com/ansifar88/ticketing-microservices/tree/master/tickets/src/routes"
click node_ticket_model "https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/model/ticket.ts"
click node_order_app "https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/app.ts"
click node_order_routes "https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/routes"
click node_order_model "https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/models/order.ts"
click node_order_ticket_model "https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/models/ticket.ts"
click node_order_listeners "https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/events/listeners"
click node_order_publishers "https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/events/publishers"
click node_payment_app "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/app.ts"
click node_payment_route "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/routes/new.ts"
click node_payment_callback "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/callback/stripe-callback.ts"
click node_payment_model "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/models/payment.ts"
click node_payment_order_model "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/models/order.ts"
click node_payment_publisher "https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/events/publishers/payment-created-publisher.ts"
click node_expiration_listener "https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/events/listeners/order-created-listener.ts"
click node_expiration_queue "https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/queues/expiration-queue.ts"
click node_expiration_publisher "https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/events/publishers/expiration-complete-publisher.ts"
click node_metrics "https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/metrics/metrics.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_pages,node_client_requests,node_client_header,node_browser_user toneBlue
class node_auth_app,node_auth_routes,node_user_model,node_auth_metrics toneAmber
class node_ticket_app,node_ticket_routes,node_ticket_model,node_order_app,node_order_routes,node_order_model,node_order_ticket_model,node_order_listeners,node_order_publishers toneMint
class node_payment_app,node_payment_route,node_payment_callback,node_payment_model,node_payment_order_model,node_payment_publisher,node_expiration_listener,node_expiration_queue,node_expiration_publisher toneRose
class node_nats,node_stripe toneIndigo
class node_metrics toneTeal
```

## Components

### Web client

- [Marketplace pages](https://github.com/ansifar88/ticketing-microservices/tree/master/client/pages): `client/pages`
- [API request hook](https://github.com/ansifar88/ticketing-microservices/blob/master/client/hooks/use-request.js): `client/hooks/use-request.js`
- [Navigation header](https://github.com/ansifar88/ticketing-microservices/blob/master/client/components/header.js): `client/components/header.js`

### Identity

- [Auth HTTP app](https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/app.ts): `auth/src/app.ts`
- [Sign-in and account routes](https://github.com/ansifar88/ticketing-microservices/tree/master/auth/src/routes): `auth/src/routes`
- [User model](https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/models/user.ts): `auth/src/models/user.ts`
- [Auth metrics](https://github.com/ansifar88/ticketing-microservices/blob/master/auth/src/metrics/metrics.ts): `auth/src/metrics/metrics.ts`

### Tickets and orders

- [Ticket HTTP app](https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/app.ts): `tickets/src/app.ts`
- [Ticket routes](https://github.com/ansifar88/ticketing-microservices/tree/master/tickets/src/routes): `tickets/src/routes`
- [Ticket model](https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/model/ticket.ts): `tickets/src/model/ticket.ts`
- [Order HTTP app](https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/app.ts): `orders/src/app.ts`
- [Order routes](https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/routes): `orders/src/routes`
- [Order model](https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/models/order.ts): `orders/src/models/order.ts`
- [Order ticket model](https://github.com/ansifar88/ticketing-microservices/blob/master/orders/src/models/ticket.ts): `orders/src/models/ticket.ts`
- [Order event listeners](https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/events/listeners): `orders/src/events/listeners`
- [Order event publishers](https://github.com/ansifar88/ticketing-microservices/tree/master/orders/src/events/publishers): `orders/src/events/publishers`

### Payments and expiration

- [Payment HTTP app](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/app.ts): `payments/src/app.ts`
- [Create payment](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/routes/new.ts): `payments/src/routes/new.ts`
- [Stripe callback](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/callback/stripe-callback.ts): `payments/src/callback/stripe-callback.ts`
- [Payment model](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/models/payment.ts): `payments/src/models/payment.ts`
- [Payment order model](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/models/order.ts): `payments/src/models/order.ts`
- [Payment event publisher](https://github.com/ansifar88/ticketing-microservices/blob/master/payments/src/events/publishers/payment-created-publisher.ts): `payments/src/events/publishers/payment-created-publisher.ts`
- [Order-created listener](https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/events/listeners/order-created-listener.ts): `expiration/src/events/listeners/order-created-listener.ts`
- [Expiration queue](https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/queues/expiration-queue.ts): `expiration/src/queues/expiration-queue.ts`
- [Expiration event publisher](https://github.com/ansifar88/ticketing-microservices/blob/master/expiration/src/events/publishers/expiration-complete-publisher.ts): `expiration/src/events/publishers/expiration-complete-publisher.ts`

### Event messaging

- **NATS Streaming**

### Other components

- **Marketplace user**
- **Stripe**
- [Service metrics](https://github.com/ansifar88/ticketing-microservices/blob/master/tickets/src/metrics/metrics.ts): `tickets/src/metrics/metrics.ts`

## Connections

- Marketplace user → Marketplace pages: uses
- Marketplace pages → API request hook: submits requests (evidence: `client/pages/tickets/new.js`)
- Marketplace pages → Navigation header: renders
- Auth HTTP app → Sign-in and account routes: registers routes (evidence: `auth/src/app.ts`)
- Auth HTTP app → Auth metrics: uses metrics (evidence: `auth/src/app.ts`)
- Sign-in and account routes → User model: uses (evidence: `auth/src/routes/signin.ts`)
- Ticket HTTP app → Ticket routes: registers routes (evidence: `tickets/src/app.ts`)
- Ticket HTTP app → Service metrics: uses metrics (evidence: `tickets/src/app.ts`)
- Order HTTP app → Order routes: registers routes (evidence: `orders/src/app.ts`)
- Order HTTP app → Service metrics: uses metrics (evidence: `orders/src/app.ts`)
- Order routes → Order ticket model: reads ticket (evidence: `orders/src/routes/new.ts`)
- Order routes → Order model: creates order (evidence: `orders/src/routes/new.ts`)
- Order routes → Order event publishers: publishes order event (evidence: `orders/src/routes/new.ts`)
- Order HTTP app → Order event listeners: registers listeners (evidence: `orders/src/index.ts`)
- Order event listeners → Order model: updates order (evidence: `orders/src/events/listeners/expiration-complete-listener.ts`)
- Payment HTTP app → Create payment: registers route (evidence: `payments/src/app.ts`)
- Payment HTTP app → Stripe callback: registers callback (evidence: `payments/src/app.ts`)
- Create payment → Payment order model: reads order (evidence: `payments/src/routes/new.ts`)
- Create payment → Stripe: creates intent (evidence: `payments/src/routes/new.ts`)
- Stripe callback → Stripe: uses (evidence: `payments/src/callback/stripe-callback.ts`)
- Stripe callback → Payment model: uses (evidence: `payments/src/callback/stripe-callback.ts`)
- Stripe callback → Payment event publisher: publishes payment (evidence: `payments/src/callback/stripe-callback.ts`)
- Order-created listener → Expiration queue: enqueues expiration (evidence: `expiration/src/events/listeners/order-created-listener.ts`)
- Order event publishers → NATS Streaming: publishes events
- Order event listeners → NATS Streaming: consumes events
- Payment event publisher → NATS Streaming: publishes event
- Order-created listener → NATS Streaming: consumes event
- Expiration event publisher → NATS Streaming: publishes event
