A distributed Airbnb-style booking platform built for a Distributed Systems course project, covering containerization, event-driven architecture, polyglot persistence, state management, and load testing.
Co-built with Savitha Vijayarangan — both contributors worked across the full stack. Commit history below reflects collaborative development on Kafka integration, MongoDB sessions, Redux state management, Docker/Kubernetes deployment, and JMeter performance testing.
docker-compose up -d
docker-compose ps
docker-compose logs -f backendAccess Points:
| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:4000 |
| Backend Health | http://localhost:4000/health |
| API Docs | http://localhost:4000/api/docs |
| Kafka UI | http://localhost:8080 |
| MongoDB | localhost:27017 |
| MySQL | localhost:3306 |
kubectl apply -f k8s/
kubectl get all -n airbnb
kubectl wait --for=condition=ready pod --all -n airbnb --timeout=300s
kubectl port-forward service/frontend-service 3000:80 -n airbnb &
kubectl port-forward service/backend-service 4000:4000 -n airbnb &docker-compose -f docker-compose.kafka.yml up -d
cd backend && npm start┌─────────────────────────────────────────────────────────┐
│ Kubernetes Cluster │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ Frontend │ │ Backend │ │ MySQL │ │ MongoDB │ │
│ │ (2-5) │ │ (2-5) │ │ (1) │ │ (1) │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬────┘ │
│ │ │ │ │ │
│ └─────────────┴─────────────┴─────────────┘ │
│ │ │
│ ┌─────────────┴──────────────┐ │
│ │ │ │
│ ┌────┴─────┐ ┌───────┴────┐ │
│ │Zookeeper │ │ Kafka │ │
│ │ (1) │ │ (1) │ │
│ └──────────┘ └────────────┘ │
└─────────────────────────────────────────────────────────┘
│ │
▼ ▼
LoadBalancer Kafka Producer/Consumer
- All services containerized (Backend, Frontend, MySQL, MongoDB, Kafka, Zookeeper)
- Production-ready Dockerfiles with multi-stage builds
- Complete
docker-compose.ymlwith 7 services - 8 Kubernetes deployments with proper configurations
- Horizontal Pod Autoscaler (2–5 replicas, CPU/Memory based)
- Persistent Volumes for databases
- Health checks and resource limits
- Service discovery and networking
Key files: backend/Dockerfile, frontend/Dockerfile, docker-compose.yml, k8s/*.yaml (8 configs)
- Kafka producer for booking events
- Two Kafka consumers (Owner & Traveler services)
- Topics:
booking-request,booking-status-update - Asynchronous message flow:
- Traveler creates booking → Kafka → Owner receives
- Owner accepts/cancels → Kafka → Traveler receives
- Graceful error handling
- Kafka UI for monitoring
Key files: backend/config/kafka.js, backend/kafka/consumers.js, backend/controllers/bookingController.js
Test it:
docker-compose up -d kafka zookeeper
curl -X POST http://localhost:4000/api/bookings/request \
-H "Content-Type: application/json" \
-d '{"propertyId":1,"startDate":"2025-12-01","endDate":"2025-12-05","guests":2}'
# Check http://localhost:8080 for the message- MongoDB 7.0 for session storage
- Sessions persist in MongoDB, not in memory
- Password encryption with bcrypt (salt rounds: 10)
- Hybrid database architecture:
- MySQL — application data (users, properties, bookings)
- MongoDB — session storage
- Deployed in both Docker and Kubernetes
Key files: backend/server.js, k8s/07-mongodb-deployment.yaml
Test it:
docker exec -it airbnb-mongodb mongosh
use airbnb_sessions
db.sessions.find().pretty()- Redux Toolkit (
@reduxjs/toolkit@^2.9.0) - React-Redux (
react-redux@^9.2.0) - Redux Persist for state persistence
- 4 Redux slices:
| Slice | Purpose |
|---|---|
travelerSlice |
Traveler authentication & profile |
OwnerSlice |
Owner authentication & profile |
propertySlice |
Property search, fetch, details |
bookingSlice |
Booking creation, status, favorites |
- Async thunks for API calls, with loading and error states
Key files: frontend/src/app/store.js, frontend/src/features/{traveler,owner,property,booking}/*Slice.js
- 3 comprehensive test plans (
.jmx) - Tests at 100, 200, 300, 400, 500 concurrent users
- Automated test execution script
- Metrics collected: response times (avg, median, percentiles), throughput, error rates
- HTML reports with graphs, CSV data for analysis
Key files: jmeter/test-plans/01-authentication-test.jmx, 02-property-search-test.jmx, 03-booking-process-test.jmx, jmeter/run-all-tests.sh
curl http://localhost:4000/health
cd jmeter && ./run-all-tests.sh
open results/authentication-100-users-report/index.html| Layer | Technology |
|---|---|
| Frontend | React + Redux Toolkit + Redux Persist |
| Backend | Node.js / Express |
| Relational DB | MySQL 8.0 (users, properties, bookings) |
| Document DB | MongoDB 7.0 (session storage) |
| Message queue | Apache Kafka + Zookeeper |
| Session security | bcrypt (10 salt rounds) |
| Containerization | Docker, Docker Compose |
| Orchestration | Kubernetes — Deployments, HPA (2–5 replicas), PVCs |
| Load testing | Apache JMeter |
Lab1_DistributedSystem/
├── backend/ # Node.js Backend
│ ├── config/
│ │ ├── kafka.js # Kafka configuration
│ │ └── database.js
│ ├── kafka/
│ │ └── consumers.js # Kafka consumers
│ ├── controllers/ # Kafka producers
│ ├── Dockerfile
│ └── server.js # MongoDB sessions
│
├── frontend/ # React Frontend
│ ├── src/
│ │ ├── app/
│ │ │ └── store.js # Redux store
│ │ └── features/ # Redux slices
│ └── Dockerfile
│
├── k8s/ # Kubernetes configs (8 files)
│ ├── 00-namespace.yaml
│ ├── 01-configmap.yaml
│ ├── 02-secrets.yaml
│ ├── 03-mysql-deployment.yaml
│ ├── 04-kafka-deployment.yaml
│ ├── 05-backend-deployment.yaml
│ ├── 06-frontend-deployment.yaml
│ └── 07-mongodb-deployment.yaml
│
├── jmeter/ # Performance testing
│ ├── test-plans/ # 3 JMeter test plans
│ ├── run-all-tests.sh
│ └── results/
│
├── docker-compose.yml
├── docker-compose.kafka.yml
│
└── Documentation
├── DOCKER_KUBERNETES_SETUP.md
├── KAFKA_SETUP.md
├── JMETER_SETUP.md
└── LAB2_FINAL_STATUS.md
# MySQL
DB_HOST=mysql
DB_USER=airbnb_user
DB_PASSWORD=password123
DB_NAME=airbnb_db
# MongoDB
MONGO_USER=admin
MONGO_PASSWORD=mongopassword
MONGO_DB=airbnb_sessions
# Kafka
KAFKA_BROKER=kafka:9093
# Session
SESSION_SECRET=your-secret-key-change-in-productionBackend won't start:
lsof -ti:4000
lsof -ti:3306
lsof -ti:27017
docker-compose logs backendKafka issues:
docker-compose restart zookeeper kafka
docker-compose logs kafkaDatabase connection failed:
docker exec -it airbnb-mysql mysql -u root -p
docker exec -it airbnb-mongodb mongosh- Original repo: IamSavitha/Lab1_DistributedSystem
- My GitHub: SunnyJaneH
Co-authors: Savitha Vijayarangan, Jane Heng