A multiplayer online card game inspired by the classic Chinese board game 三國殺, set in the Three Kingdoms era. Players take on the roles of iconic historical generals, using strategy, deception, and combat cards to outwit their opponents.
3–8 players | Role-based hidden identity | Turn-based strategy
The project follows Clean Architecture with a multi-module Maven structure:
LegendsOfTheThreeKingdoms/
├── domain/ # Core business logic, game rules, card behaviors
├── app/ # Application layer (use cases)
└── spring/ # Infrastructure: REST API, WebSocket, MongoDB
- Domain-Driven Design — Game rules live in a framework-agnostic domain layer
- Behavior Stack — Card effects are modeled as stackable behaviors (e.g., Ward can interrupt any scroll card)
- Test-Driven Development — Domain tests first, then E2E integration tests (ATDD)
- Event-Driven Updates — Real-time game state pushed to all players via WebSocket
| Layer | Technology |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 3 |
| Build | Maven (multi-module) |
| Database | MongoDB |
| Real-time | WebSocket (STOMP) |
| Testing | JUnit 5, Testcontainers, MockMvc |
| CI/CD | GitHub Actions, Docker, AWS ECR/EC2 |
- JDK 17
- Docker (for MongoDB via Testcontainers)
# Start MongoDB
docker-compose up -d
# Build and run
./mvnw clean install
./mvnw spring-boot:run -pl spring# All tests
./mvnw verify
# Domain tests only
./mvnw test -pl domain
# Specific test class
./mvnw test -Dtest=ClassNameThis project is built following a rigorous software craftsmanship approach:
- Event Storming — Align team understanding of game flows
- Example Mapping — Break down rules into concrete scenarios
- OOAD / UML — Design domain models before coding
- Walking Skeleton — Ship a minimal viable product first
- ATDD — Write E2E acceptance tests from the user's perspective
- TDD — Red-Green-Refactor at the domain level
This project is licensed under the MIT License.
