Skip to content

khemssharma/Chess

Repository files navigation

Features

  1. Play chess with a computer or with a friend online.
  2. This app also features Stockfish Game Anaysis.
  3. Games are saved in Redis until they're being played.
  4. Users and Games (after termination) are saved permanently in PostgreSQL.
  5. App is written completely in TypeScript.

Screenshots

Game Analysis History Timeout

Deployment

DEPLOY_RENDER.md contains deployment instructions.

Contribution

(We welcome contributions! Please follow these steps to contribute to this project:)

How to Contribute

  1. Fork the repository

    • Click the "Fork" button at the top right of this page to create your own copy.
  2. Clone your fork

    • git clone https://github.com/your-username/Chess.git
    • Replace your-username with your GitHub username.
  3. Create a new branch

    • git checkout -b feature/your-feature-name
  4. Make your changes

    • Add your feature or fix a bug. Please follow the existing code style.
  5. Test your changes

    • Make sure all tests pass and your code works as expected.
  6. Commit and push

    • git add .
    • git commit -m "Add your message here"
    • git push origin feature/your-feature-name
  7. Open a Pull Request

    • Go to your fork on GitHub and click "Compare & pull request".
    • Describe your changes clearly and reference any related issues.
  8. Code Review

    • Wait for a maintainer to review your PR. Make changes if requested.
  9. Merge

    • Once approved, your PR will be merged.

Guidelines

  • Follow the existing code style and structure.
  • Write clear commit messages.
  • Add tests for new features or bug fixes.
  • Update documentation if needed.

Thank you for contributing!

Glicko-2 Ratings & Puzzles (lichess-style)

Glicko-2 Rating System

Every player has a rating (default 1500), rating deviation (uncertainty), and volatility — updated after each rated PvP game using the full Glicko-2 algorithm (backend/src/services/glicko2.ts), the same system lichess.org uses. Implementation is verified against the worked example in Glickman's paper (glicko.net/glicko/glicko2.pdf). Computer games and guest games are unrated. Rating snapshots (before/after) are stored on each Game record.

  • GET /api/leaderboard?type=game|puzzle — top 50 players (public)
  • Frontend: /leaderboard (Game and Puzzle tabs, provisional "?" badge when RD > 110)

Puzzles

Rating-matched tactics training (/puzzles, login required):

  • Puzzles are served within ±300 of your puzzle rating (tracked separately from game rating)
  • Each attempt is a Glicko-2 match between you and the puzzle — puzzles gain/lose rating too, so difficulty self-calibrates over time (exactly the lichess model)
  • Solves are verified server-side by replaying your moves against the stored solution (any legal checkmate is accepted on the final move), so ratings can't be farmed
  • Stats: rating, accuracy %, and current solve streak

Seeding puzzles (30 built-in, machine-verified mate-in-1/mate-in-2):

cd backend
npm run db:migrate          # applies the ratings + puzzles migration
npm run db:seed:puzzles     # seeds the built-in verified set

Optionally import from the lichess open puzzle database (CC0, https://database.lichess.org/#puzzles):

node prisma/seedPuzzles.js lichess_db_puzzle.csv 500

About

Online Multiplayer Chess server with computer mode (play with Stockfish), Stockfish online Post Game Analysis with GenAI Explainer

Topics

Resources

Stars

26 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors