Chronos is the backend engine for a multiplayer online card game inspired by mythology and classic battle card mechanics (inspired by Dracomania). This service handles all game rules, player logic, turn rotation, card resolution, and battle flow.
- NestJS – backend framework (TypeScript)
- REST API + Swagger for testing
- Future support: WebSocket for real-time interaction
- Deployment: GitHub Codespaces / Docker-ready
- Create and manage a match between 2 players
- Track game state, logs, turns, HP, and player hands
- Each player draws a random hand of 5 cards
- Only cards in hand can be played
- REST endpoints for game actions
- Swagger docs available at
/api
- Open this repo in GitHub Codespaces
- Run the NestJS app:
npm run start:dev
- Make port
3000
public in Codespaces
You can test everything directly from the terminal using the commands below.
curl -k https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/game/test
curl -k -X POST https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/game/start
⚠️ The player must have the card in hand! Check/game/state
first.
curl -k -X POST https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/game/play-card \
-H "Content-Type: application/json" \
-d '{"gameId": "550e8400-e29b-41d4-a716-446655440000", "player": "A", "card": "fireball"}'
curl -k https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/game/state/550e8400-e29b-41d4-a716-446655440000
curl -k https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/game/result/550e8400-e29b-41d4-a716-446655440000
Accessible at:
https://animated-bassoon-jqq44xj75qwfqw4g-3000.app.github.dev/api
GameModule
→ Handles all match logicGameService
→ Controls state and rulesGameController
→ Exposes REST endpoints for actionsPlayCardDto
→ DTO for incoming move commandsGameState
→ Tracks players, turn, logs, HP, and hands