A backend-centric movie ticket booking system โ handles concurrent seat reservations, async email notifications, Redis-based caching, and fully automated deployments on AWS EKS via CI/CD pipelines.
| Feature | Description |
|---|---|
| ๐๏ธ Concurrent Ticket Booking | Redis-based seat reservation locks (6 min TTL) prevent double-booking across concurrent requests |
| ๐ง Async Email Notifications | RabbitMQ-powered email service with concurrent workers โ checkout API returns instantly |
| ๐๏ธ Theater & Movie Listings | Query theaters and movies by city with optimized, cached responses |
| โก Redis Caching | Frequently accessed, low-write endpoints cached in Redis to reduce DB load |
| ๐ณ Multi-Stage Docker Builds | Minimized image size for faster deployments and reduced CI/CD pipeline duration |
| โธ๏ธ AWS EKS Deployment | Kubernetes StatefulSets for PostgreSQL and RabbitMQ ensure data persistence on EKS |
| ๐ CI/CD Pipeline | Fully automated deployments to AWS EKS via GitHub Actions |
| ๐พ Storage Persistence | StatefulSet objects for PostgreSQL and RabbitMQ prevent data loss across pod restarts |
๐ค User
โ
โผ
โก Spring Boot API
/ \
Browse / Search Checkout / Book
/ \
โผ โผ
๐ฌ Movie & Theater ๐ Seat Reservation
Listings API โ
โ โผ
โผ ๐ด Redis Lock
โก Redis Cache (6 min TTL per seat)
(low-write endpoints) โ
โผ
๐ PostgreSQL
(Confirm Booking)
โ
โผ
๐จ RabbitMQ Queue
โ
โผ
๐ง Async Email Workers
(Booking Confirmation Email)
The core challenge: two users booking the same seat at the same time.
Solution: Redis TTL-based seat lock
User A requests Seat 12A
โ
โผ
SET seat:12A:lock "userA" EX 360 โ Redis lock (6 min TTL)
โ
Lock acquired?
/ \
YES NO
โ โ
โผ โผ
Proceed Return "Seat
to checkout unavailable"
โ
โผ
Payment confirmed โ Write to PostgreSQL โ Release lock
โ
โผ
Push to RabbitMQ โ Email worker โ Send confirmation
If the user abandons checkout, the Redis lock expires automatically after 6 minutes, freeing the seat for others โ no manual cleanup required.
Booking confirmation emails are fully decoupled from the checkout flow via RabbitMQ.
POST /checkout
โ
โผ
Confirm booking in DB
โ
โผ
Publish message to RabbitMQ โโโ Return 200 immediately to user
โ
โผ (async)
Email Worker (concurrent consumers)
โ
โผ
Send confirmation email to user
Why this matters: The checkout API response time is not blocked by email delivery. Even if the email service is slow or temporarily down, the booking is confirmed and the message stays in the queue.
| Layer | Technology |
|---|---|
| API | Spring Boot ยท REST |
| Concurrency | Redis (TTL-based seat locks) |
| Caching | Redis Cache |
| Async Messaging | RabbitMQ |
| Database | PostgreSQL |
| Containerization | Docker (Multi-Stage Builds) |
| Orchestration | Kubernetes (AWS EKS) |
| Persistence | Kubernetes StatefulSets |
| CI/CD | GitHub Actions |
| Cloud | AWS EKS |
| Method | Endpoint | Description |
|---|---|---|
GET |
/cities |
List all available cities |
GET |
/cities/{cityId}/theaters |
Get theaters in a city |
GET |
/theaters/{theaterId}/movies |
Get movies showing at a theater |
GET |
/movies/{movieId}/shows |
Get show timings for a movie |
| Method | Endpoint | Description |
|---|---|---|
POST |
/shows/{showId}/reserve |
Reserve seats (Redis lock, 6 min TTL) |
POST |
/bookings/checkout |
Confirm booking + trigger async email |
GET |
/bookings/{bookingId} |
Get booking details |
DELETE |
/bookings/{bookingId} |
Cancel booking + release seat lock |
PostgreSQL and RabbitMQ are deployed as StatefulSets inside the same AWS EKS cluster to ensure:
- Stable network identity โ pods get consistent DNS names
- Persistent storage โ data survives pod restarts via PersistentVolumeClaims
- Ordered deployment โ guaranteed startup sequence
AWS EKS Cluster
โโโ Deployment: movieNow-api (Spring Boot โ scalable, stateless)
โโโ StatefulSet: postgresql (persistent volume for booking data)
โโโ StatefulSet: rabbitmq (persistent volume for message queue)
โโโ CI/CD: GitHub Actions (auto-deploy on push to main)
Push to main
โ
โผ
GitHub Actions triggered
โ
โโโ Build multi-stage Docker image
โโโ Push to container registry
โโโ Deploy to AWS EKS
โ
โผ
Rolling update
(zero downtime deployment)
Multi-stage Docker builds keep the final image lean by separating the build environment from the runtime environment โ resulting in significantly smaller image sizes and faster pull times during deployment.
cities
โโโ theaters
โโโ movies
โโโ shows
โโโ bookings
โโโ booked_seats
users
โโโ bookings (userId ยท showId ยท status ยท createdAt)
โโโ booked_seats (seatId ยท bookingId)
shows (movieId ยท theaterId ยท showTime ยท totalSeats ยท availableSeats)
seats (showId ยท seatNumber ยท type ยท price)
- Java 17+
- Docker
- kubectl + AWS CLI (for EKS deployment)
docker compose up -d # Starts PostgreSQL + RabbitMQ + Redis./mvnw spring-boot:run
# API available at http://localhost:8080# Apply Kubernetes manifests
kubectl apply -f k8s/postgresql-statefulset.yaml
kubectl apply -f k8s/rabbitmq-statefulset.yaml
kubectl apply -f k8s/movieNow-deployment.yamlOr simply push to main โ GitHub Actions handles the rest.
# Database
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/movienow
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=...
# Redis
SPRING_REDIS_HOST=localhost
SPRING_REDIS_PORT=6379
# RabbitMQ
SPRING_RABBITMQ_HOST=localhost
SPRING_RABBITMQ_PORT=5672
SPRING_RABBITMQ_USERNAME=guest
SPRING_RABBITMQ_PASSWORD=guest
# Email
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=...
MAIL_PASSWORD=...- Race condition handling without DB locks โ Redis TTL-based seat reservation is lighter and faster than pessimistic DB locking, and self-heals on abandoned checkouts.
- Checkout API latency is email-independent โ RabbitMQ decoupling means a slow email provider never degrades the booking experience.
- Production-grade infra โ StatefulSets, PVCs, rolling deployments, and CI/CD from day one, not bolted on later.
- Multi-stage Docker โ build artifacts stay out of the final image, keeping it lean for faster EKS pull times.
- Full API Caching โ Extend Redis caching to remaining read-heavy endpoints while maintaining consistency
- API Documentation โ Swagger/OpenAPI integration for full endpoint documentation
- Bean Validation โ Spring Validation annotations on all request objects for consistent input integrity
Built with Spring Boot ยท Redis ยท RabbitMQ ยท PostgreSQL ยท Docker ยท AWS EKS ยท GitHub Actions

