# m-b-a-s/ticketing-platform architecture

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

- Interactive diagram: https://gitdiagram.com/m-b-a-s/ticketing-platform
- Repository: https://github.com/m-b-a-s/ticketing-platform

## Overview

This Go modular monolith exposes event and ticket-type management through an HTTP API, with authentication and event-level access control. Organizers create and publish events and configure ticket types; public users can browse them. The README also describes a purchase-to-payment-to-ticket/check-in workflow and asynchronous worker capabilities, but the corresponding source directories are placeholders in this tree, so those branches are shown as documented subsystems rather than inspected implementations. Edges reflect sampled wiring or README statements; unsampled connections are omitted.

Main entry points: [`cmd/api/main.go`](https://github.com/m-b-a-s/ticketing-platform/blob/main/cmd/api/main.go) (HTTP API), [`internal/httpapi/router.go`](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/httpapi/router.go) (HTTP router), [`internal/platform/database/db/db.go`](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/database/db/db.go) (PostgreSQL), [`internal/events/handler.go`](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/handler.go) (Event endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_api["HTTP API<br/>[main.go]"]
  node_router["HTTP router<br/>[router.go]"]
  node_worker["Background worker<br/>[main.go]"]
end

subgraph group_access["Identity and access"]
  node_auth["Authentication<br/>[service.go]"]
  node_auth_handler["Auth endpoints<br/>[handler.go]"]
  node_event_access["Event access guard<br/>[event_access.go]"]
  node_rate_limit["Rate limiting<br/>[ratelimit.go]"]
end

subgraph group_catalog["Event catalog"]
  node_events_handler["Event endpoints<br/>[handler.go]"]
  node_events_service["Event lifecycle<br/>[service.go]"]
  node_events_domain["Event rules<br/>[domain.go]"]
  node_tickets_handler["Ticket type endpoints<br/>[handler.go]"]
  node_tickets_service["Ticket type rules<br/>[service.go]"]
  node_tickets_domain["Ticket type validation<br/>[domain.go]"]
end

subgraph group_purchase["Purchase fulfillment"]
  node_orders["Orders and reservations"]
  node_inventory["Inventory control"]
  node_payments["Payments and webhooks"]
  node_tickets_issued["Issued tickets"]
  node_checkin["Door check-in"]
  node_outbox["Transactional outbox"]
  node_jobs["Worker jobs"]
  node_notifications["Notifications"]
end

subgraph group_platform["Persistence and platform"]
  node_database[("PostgreSQL<br/>[db.go]")]
  node_health["Health endpoint<br/>[health.go]"]
end

node_customers(("Customers and staff"))
node_paystack["Paystack"]
node_email["Email provider"]

node_customers -->|"make requests"| node_api
node_api -->|"opens pool"| node_database
node_api -->|"builds service"| node_auth
node_api -->|"serves routes"| node_router
node_api -->|"constructs"| node_events_handler
node_api -->|"constructs"| node_tickets_handler
node_api -->|"configures"| node_health
node_api -->|"configures"| node_rate_limit
node_router -->|"mounts public routes"| node_auth_handler
node_router -->|"mounts routes"| node_events_handler
node_router -->|"mounts routes"| node_tickets_handler
node_router -->|"authenticates manage routes"| node_auth
node_router -->|"wraps API routes"| node_rate_limit
node_auth_handler -->|"handles identity"| node_auth
node_events_handler -->|"calls"| node_events_service
node_events_service -->|"validates transitions"| node_events_domain
node_events_service -->|"reads and writes"| node_database
node_events_handler -->|"guards management routes"| node_event_access
node_event_access -->|"checks event access"| node_database
node_tickets_handler -->|"calls"| node_tickets_service
node_tickets_service -->|"validates ticket types"| node_tickets_domain
node_tickets_service -->|"reads and writes"| node_database
node_tickets_handler -->|"guards management routes"| node_event_access
node_worker -->|"uses persistent state"| node_database
node_worker -.->|"relays events"| node_outbox
node_worker -.->|"runs jobs"| node_jobs
node_jobs -.->|"expires reservations"| node_orders
node_jobs -.->|"dispatches email"| node_notifications
node_customers -.->|"reserve tickets"| node_orders
node_orders -.->|"reserves stock"| node_inventory
node_orders -.->|"initiates payment"| node_payments
node_payments -.->|"processes payment"| node_paystack
node_paystack -.->|"sends webhooks"| node_payments
node_payments -.->|"fulfills paid orders"| node_tickets_issued
node_tickets_issued -.->|"validates at door"| node_checkin
node_notifications -.->|"sends messages"| node_email

click node_api "https://github.com/m-b-a-s/ticketing-platform/blob/main/cmd/api/main.go"
click node_router "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/httpapi/router.go"
click node_worker "https://github.com/m-b-a-s/ticketing-platform/blob/main/cmd/worker/main.go"
click node_auth "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/service.go"
click node_auth_handler "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/handler.go"
click node_event_access "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/event_access.go"
click node_rate_limit "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/middleware/ratelimit.go"
click node_events_handler "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/handler.go"
click node_events_service "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/service.go"
click node_events_domain "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/domain.go"
click node_tickets_handler "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/handler.go"
click node_tickets_service "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/service.go"
click node_tickets_domain "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/domain.go"
click node_orders "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/orders"
click node_inventory "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/inventory"
click node_payments "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/payments"
click node_tickets_issued "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/tickets"
click node_checkin "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/checkin"
click node_outbox "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/outbox"
click node_jobs "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/jobs"
click node_notifications "https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/notifications"
click node_database "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/database/db/db.go"
click node_health "https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/health/health.go"

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_api,node_router,node_worker toneBlue
class node_auth,node_auth_handler,node_event_access,node_rate_limit toneAmber
class node_events_handler,node_events_service,node_events_domain,node_tickets_handler,node_tickets_service,node_tickets_domain toneMint
class node_orders,node_inventory,node_payments,node_tickets_issued,node_checkin,node_outbox,node_jobs,node_notifications toneRose
class node_database,node_health,node_customers,node_paystack,node_email toneIndigo
```

## Components

### Application entry

- [HTTP API](https://github.com/m-b-a-s/ticketing-platform/blob/main/cmd/api/main.go): `cmd/api/main.go`
- [HTTP router](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/httpapi/router.go): `internal/httpapi/router.go`
- [Background worker](https://github.com/m-b-a-s/ticketing-platform/blob/main/cmd/worker/main.go): `cmd/worker/main.go`

### Identity and access

- [Authentication](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/service.go): `internal/auth/service.go`
- [Auth endpoints](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/handler.go): `internal/auth/handler.go`
- [Event access guard](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/auth/event_access.go): `internal/auth/event_access.go`
- [Rate limiting](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/middleware/ratelimit.go): `internal/platform/middleware/ratelimit.go`

### Event catalog

- [Event endpoints](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/handler.go): `internal/events/handler.go`
- [Event lifecycle](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/service.go): `internal/events/service.go`
- [Event rules](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/events/domain.go): `internal/events/domain.go`
- [Ticket type endpoints](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/handler.go): `internal/tickets/handler.go`
- [Ticket type rules](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/service.go): `internal/tickets/service.go`
- [Ticket type validation](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/tickets/domain.go): `internal/tickets/domain.go`

### Purchase fulfillment

- [Orders and reservations](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/orders): `internal/orders`
- [Inventory control](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/inventory): `internal/inventory`
- [Payments and webhooks](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/payments): `internal/payments`
- [Issued tickets](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/tickets): `internal/tickets`
- [Door check-in](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/checkin): `internal/checkin`
- [Transactional outbox](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/outbox): `internal/outbox`
- [Worker jobs](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/jobs): `internal/jobs`
- [Notifications](https://github.com/m-b-a-s/ticketing-platform/tree/main/internal/notifications): `internal/notifications`

### Persistence and platform

- [PostgreSQL](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/database/db/db.go): `internal/platform/database/db/db.go`
- [Health endpoint](https://github.com/m-b-a-s/ticketing-platform/blob/main/internal/platform/health/health.go): `internal/platform/health/health.go`

### Other components

- **Customers and staff**
- **Paystack**
- **Email provider**

## Connections

- Customers and staff → HTTP API: make requests (evidence: `README.md`)
- HTTP API → PostgreSQL: opens pool (evidence: `cmd/api/main.go`)
- HTTP API → Authentication: builds service (evidence: `cmd/api/main.go`)
- HTTP API → HTTP router: serves routes (evidence: `cmd/api/main.go`)
- HTTP API → Event endpoints: constructs (evidence: `cmd/api/main.go`)
- HTTP API → Ticket type endpoints: constructs (evidence: `cmd/api/main.go`)
- HTTP API → Health endpoint: configures (evidence: `cmd/api/main.go`)
- HTTP API → Rate limiting: configures (evidence: `cmd/api/main.go`)
- HTTP router → Auth endpoints: mounts public routes (evidence: `internal/httpapi/router.go`)
- HTTP router → Event endpoints: mounts routes (evidence: `internal/httpapi/router.go`)
- HTTP router → Ticket type endpoints: mounts routes (evidence: `internal/httpapi/router.go`)
- HTTP router → Authentication: authenticates manage routes (evidence: `internal/httpapi/router.go`)
- HTTP router → Rate limiting: wraps API routes (evidence: `internal/httpapi/router.go`)
- Auth endpoints → Authentication: handles identity
- Event endpoints → Event lifecycle: calls (evidence: `internal/events/handler.go`)
- Event lifecycle → Event rules: validates transitions (evidence: `internal/events/service.go`)
- Event lifecycle → PostgreSQL: reads and writes (evidence: `internal/events/service.go`)
- Event endpoints → Event access guard: guards management routes (evidence: `internal/events/handler.go`)
- Event access guard → PostgreSQL: checks event access (evidence: `internal/auth/event_access.go`)
- Ticket type endpoints → Ticket type rules: calls (evidence: `internal/tickets/handler.go`)
- Ticket type rules → Ticket type validation: validates ticket types (evidence: `internal/tickets/service.go`)
- Ticket type rules → PostgreSQL: reads and writes (evidence: `internal/tickets/service.go`)
- Ticket type endpoints → Event access guard: guards management routes (evidence: `internal/tickets/handler.go`)
- Background worker → PostgreSQL: uses persistent state (evidence: `README.md`)
- Background worker → Transactional outbox: relays events (evidence: `README.md`)
- Background worker → Worker jobs: runs jobs (evidence: `README.md`)
- Worker jobs → Orders and reservations: expires reservations (evidence: `README.md`)
- Worker jobs → Notifications: dispatches email (evidence: `README.md`)
- Customers and staff → Orders and reservations: reserve tickets (evidence: `README.md`)
- Orders and reservations → Inventory control: reserves stock (evidence: `README.md`)
- Orders and reservations → Payments and webhooks: initiates payment (evidence: `README.md`)
- Payments and webhooks → Paystack: processes payment (evidence: `README.md`)
- Paystack → Payments and webhooks: sends webhooks (evidence: `README.md`)
- Payments and webhooks → Issued tickets: fulfills paid orders (evidence: `README.md`)
- Issued tickets → Door check-in: validates at door (evidence: `README.md`)
- Notifications → Email provider: sends messages (evidence: `README.md`)
