Skip to content

codecollab-co/MyChessCoach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyChessCoach

MyChessCoach

Play. Learn. Improve.

A chess platform that teaches you techniques used by grandmasters through interactive lessons, adaptive practice games, and post-game analysis.

FeaturesQuick StartTech StackArchitectureContributingLicense


Features

Play

  • vs Computer — Play against Stockfish (WASM) at Beginner, Intermediate, or Advanced difficulty
  • vs Player — Real-time PvP with matchmaking, game clock (Bullet/Blitz/Rapid), and friend invite links
  • Hints & Undo — Get Stockfish-powered hints highlighted on the board with explanations, and undo moves

Learn

  • 52 Techniques — Openings, tactics, midgame strategy, and endgame mastery
  • Interactive Lessons — Step-by-step walkthroughs with annotated board positions
  • Practice Games — Play from realistic mid-game positions where the technique applies

Improve

  • Post-Game Analysis — Move accuracy graph, evaluation bar, and key moment highlights
  • Practice Queue — Puzzles generated from your mistakes with Practice Now / Save for Later / Dismiss
  • Adaptive Difficulty — Engine difficulty adjusts based on your performance
  • Glicko Rating — Separate rating pools for Bullet, Blitz, and Rapid

Platform

  • Firebase Authentication — Sign in with Google
  • Responsive Design — Works on desktop and mobile
  • Guest Access — Try the platform before signing in (one free game vs computer, technique browsing)

Quick Start

Prerequisites

1. Clone the repository

git clone https://github.com/codecollab-co/MyChessCoach.git
cd MyChessCoach

2. Set up the database

# Create the database
createdb mychesscoach

# Push the schema
cd backend
npm install
npx drizzle-kit push

# Seed 52 chess techniques
npm run seed:techniques

3. Configure environment variables

Backend (backend/.env):

PORT=4000
DATABASE_URL=postgres://localhost:5432/mychesscoach
REDIS_HOST=localhost
REDIS_PORT=6379
FIREBASE_PROJECT_ID=your-firebase-project-id
FIREBASE_SERVICE_ACCOUNT_PATH=./firebase-service-account.json
STOCKFISH_PATH=stockfish
STOCKFISH_MAX_INSTANCES=4

Frontend (frontend/.env):

VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id

4. Start the servers

# Terminal 1 — Backend
cd backend
npm run start:dev

# Terminal 2 — Frontend
cd frontend
npm install
npm run dev

Open http://localhost:3000 in your browser.

Tech Stack

Frontend

Technology Purpose
React + Vite SPA framework
TypeScript Type safety
Tailwind CSS Styling
Zustand State management
react-chessboard Chess board UI
chess.js Move validation, FEN/PGN
Stockfish WASM In-browser chess engine
Socket.IO Real-time multiplayer
Recharts Analysis graphs
Lucide React Icons
Firebase SDK Google authentication

Backend

Technology Purpose
NestJS Modular monolith framework
TypeScript Type safety
Drizzle ORM Database queries + migrations
PostgreSQL Primary database
Redis Cache, job queue, WebSocket adapter
BullMQ Async analysis jobs
Socket.IO Real-time game communication
Stockfish (native) Server-side deep analysis
Firebase Admin Token verification
Passport.js Auth guards

Architecture

┌──────────────────────────────────────────────┐
│              Frontend (SPA)                   │
│  React + Vite │ Stockfish WASM (Web Worker)  │
│       ↕ Socket.IO        ↕ REST API          │
└──────────────────────────────────────────────┘
                      │
┌──────────────────────────────────────────────┐
│           Backend (Modular Monolith)          │
│  ┌──────┐ ┌──────┐ ┌────────┐ ┌──────────┐  │
│  │ Auth │ │ Game │ │Training│ │ Analysis │  │
│  └──────┘ └──────┘ └────────┘ └──────────┘  │
│  ┌──────┐ ┌──────┐ ┌────────┐ ┌──────────┐  │
│  │Rating│ │Social│ │ Puzzle │ │  Engine  │  │
│  └──────┘ └──────┘ └────────┘ └──────────┘  │
└──────────────────────────────────────────────┘
       │            │            │
  PostgreSQL      Redis     Stockfish

Each backend module is self-contained and can be extracted into a microservice by replacing direct imports with message-based communication (BullMQ/Redis pub-sub).

Key Design Decisions

Decision Rationale
Hybrid Stockfish (WASM + native) Zero server cost for gameplay; native binary for deep analysis
Modular monolith Simple to start, ready for microservices when needed
Firebase for auth only Handles OAuth complexity; all data stays in PostgreSQL
Glicko v1 rating Simple, proven, used by Chess.com
Lichess data sources 4M+ puzzles and comprehensive opening database — free and open

Project Structure

MyChessCoach/
├── frontend/               # React + Vite SPA
│   ├── src/
│   │   ├── components/     # Reusable UI components
│   │   ├── pages/          # Route pages
│   │   ├── stores/         # Zustand state stores
│   │   ├── hooks/          # Custom hooks (useStockfish)
│   │   ├── services/       # API client, socket, auth
│   │   └── types/          # Shared TypeScript types
│   └── public/             # Static assets
├── backend/                # NestJS server
│   ├── src/
│   │   ├── modules/        # Feature modules (auth, game, training, etc.)
│   │   ├── database/       # Drizzle schema + seeds
│   │   ├── config/         # App configuration
│   │   └── common/         # Shared utilities
│   └── drizzle/            # DB migrations
└── docs/                   # Project documentation
    ├── PROJECT_REQUIREMENTS.md
    └── TECH_STACK.md

Available Scripts

Frontend

npm run dev          # Start dev server (port 3000)
npm run build        # Production build
npm run preview      # Preview production build

Backend

npm run start:dev    # Dev server with hot reload (port 4000)
npm run build        # Compile TypeScript
npm run start:prod   # Production server
npm run seed:techniques  # Seed 52 chess techniques
npx drizzle-kit push    # Push schema to database
npx drizzle-kit generate  # Generate migrations

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License — see the LICENSE file for details.


Built with ♟ by CodeCollab

About

A chess platform that teaches techniques through interactive lessons, adaptive practice games, and post-game analysis. Play. Learn. Improve.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages