A multi-service card game platform for two players, featuring authentication, deck building, game engine, and history tracking. All services are containerized and orchestrated via Docker Compose.
- Prerequisites
- Quick Start
- Running the Client
- Running Tests
- Service Documentation
- Game Rules
- Useful Commands
- Troubleshooting
- Docker
- Docker Compose
- Node.js & Newman (for running tests via CLI:
npm install -g newman) - Postman (optional, for manual testing)
- Locust (for performance tests)
git clone https://github.com/ashleyspagnoli/ASE_project.git
cd ASE_project/srcdocker compose up --buildThis will start all microservices, accessible through the API Gateway on https://localhost:8443
docker compose downThe project includes a Python-based Command Line Interface (CLI) client located in the /client directory. This client serves as the frontend for the game, communicating with the backend services via the API Gateway. It uses the rich and questionary libraries to provide an interactive terminal experience.
To run the client using Docker, execute the following command (Linux):
cd client/
docker build -t ase-client . --no-cache
docker run -it --rm \
--add-host=host.docker.internal:host-gateway \
-e API_GATEWAY_URL="https://host.docker.internal:8443/" \
-e GATEWAY_CERT_PATH="./gateway_cert.pem" \
ase-clientEnsure that the backend services are running before starting the client.
Unit tests verify individual microservice functionality in isolation using mocked dependencies.
They are executed using newman (Postman CLI) against the test containers.
# 1. Build and run the test container
cd src
docker build -f collection/Dockerfile_test -t collection-test .
docker run -d -p 5000:5000 --name collection-test collection-test
# 2. Run the tests
newman run ../docs/tests/collection_ut.postman_collection.json --insecure
# 3. Cleanup
docker stop collection-test
docker rm collection-test# 1. Build and run the test container
cd src
docker build -f game_history/Dockerfile_test -t history-test .
docker run -d -p 5000:5000 --name history-test history-test
# 2. Run the tests
newman run ../docs/tests/game_history_ut.postman_collection.json --insecure
# 3. Cleanup
docker stop history-test
docker rm history-test# 1. Build and run the test container
cd src
docker build -f user-manager/Dockerfile_test -t user-manager-test .
docker run -d -p 5004:5000 --name user-manager-test user-manager-test
# 2. Run the tests
newman run ../docs/tests/user_manager_ut.postman_collection.json --insecure
# 3. Cleanup
docker stop user-manager-test
docker rm user-manager-testIntegration tests verify the complete workflow across all microservices.
Ensure all services are running:
cd src
docker compose up --build -d# From the project root directory:
newman run docs/tests/integration.postman_collection.json --insecureThe integration test suite covers:
- IT-001: Complete Game Workflow - Happy Path
- IT-002: Authentication & Authorization Tests
- IT-003: Deck Validation Tests
- IT-004: Game History & Leaderboard Tests
- IT-005: Cross-Service Data Consistency Tests
- IT-007: Error Handling & Edge Cases
- IT-008: User Editor Integration
- IT-009: Complete Game Playthrough
- IT-010: Complete Game Until Winner
- IT-011: Leaderboard and Statistics
Alternatively, run a complete game simulation:
# From the project root directory:
python docs/tests/test_match.pyThis script will:
- Register two random users
- Create decks for both
- Match them together
- Play a complete game
- Display comprehensive game statistics
Performance tests use Locust to simulate multiple concurrent users and measure system behavior under load.
# Install Locust if not already installed
pip install locust# 1. Ensure all services are running
cd src
docker compose up --build -d
# 2. Start Locust (from project root)
locust -f docs/locustfile.py
# 3. Open browser to http://localhost:8089
# 4. Configure the test:
# - Number of users (e.g., 50)
# - Spawn rate (e.g., 4 users/second)
# - Host: https://localhost:8443
# 5. Click "Start"The performance test simulates realistic user behavior:
- User Registration - Creates new user accounts
- Authentication - Login and JWT token generation
- Deck Creation - Valid deck building
- Matchmaking - Queue joining and matching
- Gameplay - Complete game sessions
- History Access - Match history and leaderboard queries
Federico Fornaciari, Filippo Morelli, Marco Pernisco, Ashley Spagnoli