A Go-based event ticketing system demonstrating event-driven architecture patterns including CQRS, Event Sourcing, and the Outbox Pattern.
- Application: https://tickets.previewhub.app/
- Container Logs: https://dozzle.previewhub.app/
- Jaeger Dashboard: https://jaeger.previewhub.app/
- Ticket Management - Create, track, and manage event tickets
- Show Management - Configure shows with external provider integration (Dead Nation)
- Booking System - Book tickets for shows with confirmation workflows
- Refund Processing - Handle ticket cancellations with receipt voiding and payment refunds
- Event-Driven Architecture - Loosely coupled components communicating via events and commands
- Observability - Distributed tracing, metrics, and health checks
Create and manage shows with Dead Nation integration
Book tickets for available shows
Monitor bookings and operations with detailed reporting
- CQRS (Command Query Responsibility Segregation) - Separate command and event buses
- Event Sourcing - Events as the source of truth for state changes
- Outbox Pattern - Reliable event publishing with PostgreSQL-based outbox
- Read Models - Denormalized views for efficient queries (e.g., ops bookings)
- Dead Nation API - External ticket booking provider
- Receipts Service - Issue and void receipts
- Payments Service - Process refunds
- Files API - Upload ticket files
- Spreadsheets API - Track tickets for printing/refunding
| Component | Technology |
|---|---|
| Language | Go 1.25.5 |
| HTTP Framework | Echo v4 |
| Event Bus | Watermill |
| Message Broker | Redis Streams |
| Database | PostgreSQL |
| Cache | Redis |
| Tracing | OpenTelemetry + Jaeger |
| Metrics | Prometheus |
tickets/
├── cmd/server/ # Application entrypoint
├── adapters/ # External service adapters (Dead Nation, Payments, Receipts, Files)
├── db/ # Database repositories and migrations
├── entities/ # Domain entities, events, and commands
├── http/ # HTTP handlers and routing
├── message/
│ ├── command/ # Command bus configuration and handlers
│ ├── event/ # Event bus configuration and handlers
│ └── outbox/ # Outbox pattern implementation
├── observability/ # Tracing and metrics configuration
├── service/ # Service composition and startup
├── tests/ # Component and integration tests
└── docker/ # Docker configuration (Prometheus)
- Go 1.25.5+
- Docker & Docker Compose
Create .env.local for development:
POSTGRES_URL=postgres://user:password@localhost:5432/db?sslmode=disable
REDIS_URL=localhost:6379
GATEWAY_URL=http://localhost:8888
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318Create .env.test for testing with similar configuration.
# Start all dependencies (PostgreSQL, Redis, Prometheus, Jaeger)
make docker-up
# Stop and remove volumes
make docker-down# Run the server
make dev
# Run tests
make test
# Run tests with verbose output
make test-verbose
# Run linter
make lint| Method | Endpoint | Description |
|---|---|---|
| GET | /api/tickets |
List all tickets |
| POST | /api/tickets-status |
Update ticket status |
| PUT | /api/ticket-refund/:ticket_id |
Initiate ticket refund |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/shows |
Create a new show |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/book-tickets |
Book tickets for a show |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/ops/bookings |
List all bookings (with optional date filter) |
| GET | /api/ops/bookings/:id |
Get booking by ID |
| GET | /health |
Health check |
| GET | /metrics |
Prometheus metrics |
The system publishes and handles the following events:
TicketBookingConfirmed_v1- Ticket booking confirmedTicketBookingCanceled_v1- Ticket booking canceledTicketPrinted_v1- Ticket file generatedTicketReceiptIssued_v1- Receipt issued for ticketTicketRefunded_v1- Ticket refund completedBookingMade_v1- Booking created for a show
RefundTicket- Initiates the ticket refund process
# Run all tests
make test
# Run with verbose output
make test-verboseTests cover:
- Component integration tests
- Ticket booking workflows
- Show booking workflows
- Ticket cancellation flows
- Refund processing
- Local: Access the Jaeger UI at
http://localhost:16686to view distributed traces - Live Demo: https://jaeger.previewhub.app/
Access Prometheus at http://localhost:9090. Metrics are exposed at /metrics.
| Service | Port | Description | Live Demo |
|---|---|---|---|
| Application | 8080 | Main application | tickets.previewhub.app |
| Gateway | 8888 | Event-driven gateway | - |
| PostgreSQL | 5432 | Database | - |
| Redis | 6379 | Message broker & cache | - |
| Prometheus | 9090 | Metrics collection | - |
| Jaeger | 16686 | Tracing UI | jaeger.previewhub.app |
| Jaeger OTLP | 4318 | OTLP collector | - |
| Dozzle | - | Container logs viewer | dozzle.previewhub.app |
