Skip to main content

Welcome to Blackjack API

Blackjack API is a production-ready reactive REST API that implements a complete Blackjack card game. Built with Spring Boot WebFlux, it demonstrates advanced architectural patterns including Hexagonal Architecture and Domain-Driven Design while leveraging dual-database persistence with MongoDB and MySQL.

Quickstart

Get up and running with your first game in under 5 minutes

API Reference

Explore all available endpoints and data models

Architecture

Learn about the hexagonal architecture and DDD principles

Deploy with Docker

Deploy the application using Docker and Docker Compose

Key Features

Reactive Programming

Built with Spring WebFlux for non-blocking, reactive request handling with high throughput and scalability

Hexagonal Architecture

Clean separation between domain logic and infrastructure using ports and adapters pattern

Dual Database Persistence

MongoDB for game state management and MySQL for player statistics and rankings

Domain-Driven Design

Rich domain models with encapsulated business logic and clear aggregate boundaries

Complete Game Logic

Full Blackjack implementation with HIT, STAND, bust detection, and blackjack scoring

Player Rankings

Persistent player statistics tracking wins, losses, and competitive rankings

OpenAPI Documentation

Interactive Swagger UI for exploring and testing API endpoints

Production Ready

Comprehensive test coverage, Docker support, and cloud deployment configuration

Quick Example

Create a new game and play your first move:
curl -X POST http://localhost:8080/game/new \
  -H "Content-Type: application/json" \
  -d '{"playerName": "Alice"}'

Technology Stack

  • Java 21 - Modern Java with latest language features
  • Spring Boot 3.5 - Enterprise-grade application framework
  • Spring WebFlux - Reactive web framework for non-blocking I/O
  • MongoDB - Document database for game state persistence
  • MySQL with R2DBC - Reactive relational database for player data
  • Flyway - Database migration management
  • OpenAPI 3 - API documentation and specification
  • Docker - Containerization for deployment

What You’ll Learn

This documentation will guide you through:
  1. Getting Started - Installation, configuration, and running your first game
  2. Architecture - Understanding hexagonal architecture, DDD, and reactive patterns
  3. Game Operations - Creating games, playing moves, and managing game state
  4. Player Management - Handling player data and viewing rankings
  5. Database Configuration - Setting up MongoDB and MySQL persistence layers
  6. Deployment - Deploying with Docker, Docker Compose, and cloud platforms
  7. API Reference - Complete endpoint documentation with request/response schemas
This project serves as both a functional Blackjack game API and a reference implementation for reactive Spring Boot applications using hexagonal architecture.

Ready to Start?

Jump into the Quickstart

Follow our step-by-step guide to create and play your first Blackjack game

Build docs developers (and LLMs) love