Skip to content

BatuhanBaysal/chess-platform

Repository files navigation

β™ŸοΈ Chess Platform (Full-Stack Monorepo) β™”

A high-performance, real-time chess ecosystem engineered with a focus on Domain-Driven Design (DDD), Clean Architecture, and Enterprise-Grade Infrastructure.


πŸ“‘ Project Status: Full-Stack Observability Operational

Operational Status: The core chess engine is 100% operational, strictly adhering to FIDE rules.

Latest Milestone: Successfully completed Phase 11, implementing the LGTM (Loki, Grafana, Tempo, Prometheus) Stack. The system now features real-time performance monitoring, centralized logging, and distributed tracing, providing deep visibility into the system's internal state through OpenTelemetry.

Board Preview


πŸ› οΈ Technology Stack & Engineering Standards

Backend & Infrastructure: Java 17 Spring Boot 3.4.6 Docker Liquibase PostgreSQL Redis

Observability & Monitoring: Prometheus Grafana Loki Tempo OpenTelemetry

Frontend: React 19 TypeScript Tailwind CSS WebSocket Vite


πŸ›οΈ Project Ecosystem & Governance

This project is architected as a high-cohesion monorepo. Operational processes and architectural decisions are managed through the following modules:

Module / Document Purpose & Brief Location
βš™οΈ Backend Core Chess Engine, API endpoints & Move validation logic ./chess-backend
🎨 Frontend Reactive UI components & Real-time board state management ./chess-frontend
πŸ—οΈ Architecture High-level design choices (Hexagonal, DDD) & Tech patterns ./docs/ARCHITECTURE.md
πŸš€ Setup Guide Comprehensive local environment & Dependency installation ./docs/DEVELOPMENT.md
πŸ“ Git Flow Contribution workflow, Branching strategy & Commit standards ./.github/GIT_GUIDE.md
πŸ“œ Changelog Daily Evolution, version tracking & project milestones ./docs/CHANGELOG.md
πŸ›‘οΈ Security Security policies, safety disclosure & best practices ./docs/SECURITY.md
🀝 Contributing Coding standards, PR guidelines & collaboration rules ./docs/CONTRIBUTING.md

🧠 Engineering Challenges & Solutions

1. Database Versioning & Schema Integrity (Liquibase)

  • The Challenge: Relying on Hibernate's ddl-auto: update in a containerized environment is risky. Schema changes must be traceable, reversible, and consistent across all environments.
  • The Solution: Integrated Liquibase to manage database migrations through versioned SQL changelogs.
  • The Result: Professional, auditable database evolution. Guaranteed 1:1 schema parity between local development and Dockerized production environments.

2. Service Orchestration & Deterministic Startup

  • The Challenge: In Docker Compose, services starting simultaneously can lead to "Connection Refused" errors if the backend tries to connect before the DB or Redis is ready.
  • The Solution: Implemented custom Docker Health-Checks and depends_on: service_healthy conditions.
  • The Result: The backend initializes only after PostgreSQL and Redis are fully "Healthy," ensuring a resilient, zero-fail deployment flow.

3. Simulation & Rollback Pattern

  • The Challenge: Validating King safety (check detection) requires executing a move. This poses a risk of corrupting the live game state during the validation process.
  • The Solution: Developed a Simulation & Rollback mechanism using Java Records. The engine clones the state, simulates the move on a virtual board, and discards it after safety verification.
  • The Result: 100% side-effect-free move validation, ensuring total state integrity.

🎯 Engineering Highlights

🧩 Domain-Driven Design (DDD) & Clean Architecture

The core chess logic is encapsulated in a Pure Java domain layer.

  • Zero Infrastructure Leakage: Move validation is entirely decoupled from Spring Boot, ensuring 100% unit testability.
  • Polymorphic Validation: Each piece (Rook, Bishop, etc.) encapsulates its own logic, eliminating high-cyclomatic complexity from switch-case blocks.

⚑ Robust Rule Engine

  • FIDE Compliance: Full support for Castling, En Passant, and Pawn Promotion.
  • King Safety Simulation: Dry-run execution to detect Check, Checkmate, and Stalemate.
  • Efficient Pathfinding: Optimized vector-based collision detection for sliding pieces to maintain high engine throughput.

πŸ”„ State Synchronization & UX

  • Modern React (v19): Utilizing custom hooks and Tailwind CSS for a high-performance, responsive Board UI.
  • Lobby & Social: Sophisticated Lobby System and persistent User Statistics against players or the Training Bot.

πŸš€ Development Roadmap

Current Status: πŸ“ˆ Phase 12: Quality Assurance & Code Integrity

  • βœ… Phase 1: Foundation πŸ—οΈ - Monorepo scaffolding, environment setup, and Spring Boot/React initialization.
  • βœ… Phase 2: Domain Modeling β™ŸοΈ - Piece-specific logic, board initialization, and DDD-based movement rules.
  • βœ… Phase 3: Rule Engine βš–οΈ - Legal move validation (King safety, check/mate detection) and FIDE standards.
  • βœ… Phase 4: Communication Layer πŸ“‘ - WebSocket infrastructure using STOMP protocol and real-time event mapping.
  • βœ… Phase 5: UI Integration & Local Play πŸ–₯️ - Interactive React 19 board, Pawn Promotion, and Castling UI.
  • βœ… Phase 6: Visual Polish & UX 🎨 - Dark/Light mode, theme support (Classic, Modern, Emerald), and Drag & Drop (dnd-kit).
  • βœ… Phase 7: Identity & Persistence πŸ” - Implemented Spring Security + JWT, User profiles, and PostgreSQL integration.
  • βœ… Phase 8: Server-Side Authority πŸ›‘οΈ - Hardened backend validation for all moves and anti-cheat state management.
  • βœ… Phase 9: Remote Multiplayer & Matchmaking 🀝 - Global session management and real-time player pairing via WebSockets.
  • βœ… Phase 10: Infrastructure & Containerization 🐳 - Orchestrating services with Docker & Docker Compose and implementing Liquibase for DB versioning.
  • βœ… Phase 11: Full-Stack Observability (LGTM) πŸ“ˆ - Implementing Grafana, Loki, and Prometheus for real-time logs, metrics, and system health.
  • ⏳ Phase 12: Quality Assurance & Code Integrity πŸ† - Expanding JUnit 5/Mockito coverage and integrating SonarQube for automated "Zero Technical Debt" reporting.
  • πŸ“… Phase 13: Scalability & Resilience ⚑ - Implementing Resilience4j (Circuit Breaker) and Distributed Locking with Redis.
  • πŸ“… Phase 14: Messaging & Async Logic βœ‰οΈ - Integration of RabbitMQ/Kafka for background processing, notifications, and analytics.
  • πŸ“… Phase 15: Advanced Analytics & AI 🧠 - Integration of Stockfish via UCI protocol for move analysis and "Hint" system.

🐳 Infrastructure & Containerization

The entire application ecosystem is managed using Docker Compose to ensure absolute consistency between development and production environments.

Docker Startup Assets

Infrastructure Note: All services (PostgreSQL, Redis, Spring Boot, and React) include health-check protocols to ensure reliable inter-service communication and deterministic container startup sequences.


πŸ‘¨β€πŸ’» Developed By

Batuhan Baysal - Software Engineer Scalable Software Design, Modern Java, and Backend Architectures.

LinkedIn GitHub