⚠️ WARNING - Lab Project Only
This project uses self-signed certificates and includes sensitive environment variables directly in thedocker-compose.yamlfile. This approach is NOT suitable for production environments. In real-world projects, use trusted Certificate Authorities (CA) and Key Management Systems (KMS) for secrets management. This configuration is permitted only for educational/lab purposes.
This is a microservices-based elemental card game system developed as a lab project for the Advanced Software Engineering course in the Master's in Computer Science program at the University of Pisa.
The game allows players to collect and battle with elemental cards (Fire, Water, Earth) in a turn-based combat system. The architecture demonstrates modern software engineering practices including microservices, API gateways, containerization, and distributed systems design.
cards-game/
├── services/ # Microservices for game logic, authentication, player management, etc.
├── gateway/ # API Gateway (Nginx) for routing and load balancing
├── docs/ # Documentation including OpenAPI specs, Postman collections, and workflows
└── docker-compose.yaml # Docker Compose configuration for multi-service orchestration
- Docker and Docker Compose installed
- Port 80 available
docker-compose up --buildAll services will start automatically with self-signed certificates generated on first run.
# Check all services are running
docker-compose ps
# Test gateway health
curl -k https://localhost/healthNote: All microservices are internal and accessible only through the API Gateway at https://localhost. Individual services are not directly exposed.
docker-compose down -vUnit tests for individual microservices use Postman collections located in docs/postman/:
# Using Newman (Postman CLI)
npm install -g newman
# Auth Service tests
newman run docs/postman/auth/Auth-Service-Gateway.postman_collection.json \
-e docs/postman/auth/Auth-Service-Gateway.postman_environment.json
# Cards Service tests
newman run docs/postman/cards/Cards-Service-Gateway.postman_collection.json \
-e docs/postman/cards/Cards-Service-Gateway.postman_environment.json
# Player Service tests
newman run docs/postman/player/Player-Service-Gateway.postman_collection.json \
-e docs/postman/player/Player-Service-Gateway.postman_environment.jsonOr import the individual service collections into Postman Desktop and run them interactively.
Integration tests validate the complete game workflow using the full game flow collection:
Workflow tested:
- Create and authenticate 2 users
- Create a lobby and join it
- Start the draft process
- Play a full match
- Retrieve match history
- Check leaderboard status
# Run complete workflow integration test
newman run docs/postman/card_game_gameflow_collection.json \
-e docs/postman/card_game_environment.jsonOr import card_game_gameflow_collection.json into Postman Desktop for interactive testing.
📊 Note: Performance testing with Locust is currently limited due to rate limiting implemented on the API Gateway (to prevent DoS and brute force attacks). For performance test results, see the pre-rate-limiting test run available in
docs/performance/.
Performance tests use Locust for load testing:
cd docs/performance
# Install Locust
pip install locust
# Run performance tests (limited by rate limiting)
locust -f locustfile.py --host=https://localhost
# Access Locust web interface at http://localhost:8089Note: The gateway now implements rate limiting for security. See docs/performance/README.md for detailed performance test results from before rate limiting was enabled.
All services are accessible through the API Gateway only:
- Gateway Endpoint - https://localhost
Individual microservices are not directly exposed and communicate internally within the Docker network.
