Skip to content

nitheesb/chessgrind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

109 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ™Ÿ๏ธ ChessGrind

A chess.com-quality chess training platform built with Next.js 16

Live Demo Next.js TypeScript React

65+ puzzles ยท 80+ openings ยท 8 AI difficulty levels ยท Full gamification


โœจ Features at a Glance

Category Highlights
๐ŸŽฏ Puzzles 65 tactical puzzles, Puzzle Rush mode, multi-level hints, theme filtering, combo streaks
๐Ÿค– Play vs AI 8 levels (400โ€“2000 ELO), pre-move system, time controls, eval bar, opening detection
๐Ÿ“š Learn 80+ openings with ECO codes, 10 opening traps, interactive move-by-move lessons
๐Ÿ‹๏ธ Training Coordinate trainer, 12 endgame practice positions, blindfold mode
๐Ÿ† Gamification 15 levels, 24+ achievements, daily challenges, weekly missions, XP combos
๐Ÿ“Š Analytics Rating graphs, tactical radar chart, activity heatmap, move quality annotations
๐ŸŽจ Customization 7 board themes, 5 piece styles, dark/light mode, zen mode
๐Ÿ“ฑ Platform Fully responsive mobile + desktop, PWA installable, keyboard shortcuts

๐ŸŽฎ Core Modules

โ™Ÿ๏ธ Play vs AI

Challenge a custom-built chess engine with 8 difficulty levels โ€” from beginner-friendly random play to a depth-6 tactical monster.

  • 8 AI opponents โ€” Beginner Bot (400) โ†’ Stockfish Beast (2000)
  • Engine โ€” Negamax with alpha-beta pruning, quiescence search, piece-square tables, MVV-LVA move ordering, and opening book
  • Time controls โ€” Unlimited, 1/3/5/10 min, or increment (5|3, 10|5)
  • Pre-move system โ€” Queue your next move while AI thinks
  • Evaluation bar โ€” Real-time position assessment beside the board
  • Opening detection โ€” Automatically identifies 66+ openings by ECO code
  • Move quality annotations โ€” Post-game analysis marks moves as !! ! ?! ? ??
  • Keyboard move input โ€” Type moves in SAN (Nf3) or coordinate (e2e4) notation
  • Board controls โ€” Resize (280โ€“600px), flip, coordinates toggle, blindfold mode
  • FEN copy โ€” One-click copy of current position
  • PGN export โ€” Download or copy full game notation
  • Captured pieces โ€” Material balance display
  • Resign โ€” With confirmation dialog

๐ŸŽฏ Tactical Puzzles

65 hand-picked puzzles across multiple themes and difficulty levels with a satisfying progression system.

  • Puzzle categories โ€” Forks, pins, skewers, back-rank mates, discovered attacks, and more
  • Difficulty tiers โ€” Easy, Medium, Hard, Expert with color-coded badges
  • Theme filtering โ€” Filter by tactical motif
  • Multi-level hints โ€” 4 progressive hint levels (highlight piece โ†’ show square โ†’ draw arrow โ†’ reveal answer) at 5 XP each
  • Puzzle Rush โ€” Speed mode: solve as many as possible in 3 or 5 minutes
  • Combo system โ€” Chain correct solves for 2xโ€“3x XP multipliers
  • Perfect solve bonus โ€” Extra XP for solving without hints or mistakes
  • Tactical radar chart โ€” SVG radar visualization of your strengths/weaknesses across puzzle themes
  • Share buttons โ€” Share your solve on social media

๐Ÿ“š Opening Explorer

80+ chess openings with interactive board visualization, move annotations, and win-rate statistics.

  • Categories โ€” King's Pawn (1.e4), Queen's Pawn (1.d4), and Flank openings
  • Interactive lessons โ€” Step through each opening move-by-move with annotations
  • Win rate stats โ€” White/Draw/Black percentages for each opening
  • Key ideas โ€” Strategic concepts explained for every opening
  • Difficulty ratings โ€” Beginner to Advanced
  • ECO classification โ€” Standard Encyclopedia of Chess Openings codes

๐Ÿชค Opening Traps

10 deadly traps with step-by-step explanations to catch opponents off guard.

  • Famous traps โ€” Legal Trap, Fried Liver, Stafford Gambit, and more
  • For both sides โ€” Traps for White and Black
  • Interactive board โ€” Walk through each trap move-by-move
  • Strategic context โ€” Why each trap works and how to set it up

๐Ÿ‹๏ธ Training Tools

Coordinate Trainer

  • 30-second timed challenge โ€” find the named square on the board
  • Score, accuracy, streak, and best streak tracking
  • Visual feedback with color-coded correct/incorrect flashes

Endgame Practice

  • 12 curated positions across Basic, Intermediate, and Advanced categories
  • K+Q vs K, K+R vs K, Lucena Position, Philidor Position, and more
  • Play against AI (depth 4) to practice technique
  • Tips and explanations for each position

Blindfold Mode

  • Toggle in Settings to hide all pieces on the board
  • Train board visualization and memory
  • Works in Play vs AI and practice modes

๐Ÿ† Gamification System

XP & Levels

15 progression levels with unique titles and exponential XP requirements:

Level Title XP Required
1 Pawn 0
2 Knight Initiate 100
3 Bishop's Student 250
5 Queen's Guard 800
8 Expert 2,500
10 Grandmaster 5,000
15 Chess Immortal 17,000

Achievements

24+ achievements across 4 rarity tiers:

  • ๐ŸŸข Common โ€” First Steps, Opening Scholar, Trap Apprentice
  • ๐Ÿ”ต Rare โ€” Tactician (50 puzzles), Rating milestones (1200+)
  • ๐ŸŸฃ Epic โ€” Grandmaster (1600+ rating), 10-game streak
  • ๐ŸŸก Legendary โ€” Chess Master (2000+ rating), 20x combo

Daily & Weekly

  • Daily puzzle โ€” Fresh challenge each day with bonus XP
  • Daily login bonus โ€” 5โ€“50 XP based on streak length
  • Weekly missions โ€” 4โ€“5 rotating challenges (e.g., "Solve 20 puzzles", "Learn 3 openings")
  • Streak tracking โ€” Current and best streak with visual calendar

๐ŸŽจ Customization

Board Themes (7)

Classic Green ยท Wooden Brown ยท Ocean Blue ยท Royal Purple ยท Rose Pink ยท Tournament ยท Deep Sea

Piece Styles (5)

Standard ยท Neo ยท Classic ยท Minimal ยท Rose

App Themes

Dark mode (default) ยท Light mode ยท System auto-detect

Accessibility

  • Zen Mode โ€” Fades away all non-essential UI for distraction-free play
  • Reduced Motion โ€” Respects prefers-reduced-motion; manual toggle available
  • Keyboard shortcuts โ€” Cmd/Ctrl+K command palette, Cmd+1โ€“5 quick nav, H for hint, N for next
  • Sound & haptic toggles โ€” Independent controls for sound effects and vibration

๐Ÿ“Š Analytics & Profile

  • Rating graph โ€” Puzzle rating history with trend indicators
  • Activity heatmap โ€” GitHub-style 52-week contribution calendar
  • Tactical radar โ€” SVG radar chart showing strengths across puzzle themes
  • Move quality analysis โ€” Post-game move annotations with color coding
  • 8 profile stats โ€” Games Played, Puzzles Solved, Openings Learned, Traps Mastered, Current Streak, Best Streak, Puzzle Rating, Total XP
  • Recent games โ€” Last 8 games with W/D/L indicators
  • Areas to improve โ€” Top failed puzzle themes with progress bars

๐Ÿ–ฅ๏ธ Platform & UX

Responsive Design

  • Mobile โ€” Bottom navigation, touch-optimized 44px+ tap targets, swipe-friendly
  • Desktop โ€” Persistent sidebar, command palette (Cmd+K), hover preloading, keyboard shortcuts

Progressive Web App

  • Installable on iOS, Android, and desktop
  • Standalone display mode with custom splash screen
  • App icons at 192px, 512px, and SVG

Performance

  • Lazy-loaded pages with React Suspense and skeleton fallbacks
  • Memoized chessboard rendering (64 squares, piece caching)
  • Code-split routes โ€” only dashboard loads eagerly
  • Turbopack builds in ~5 seconds

UI Polish

  • Glassmorphism card styling with backdrop blur
  • Framer Motion page transitions and micro-interactions
  • XP floating text, level-up celebrations, achievement particle bursts
  • Confetti on puzzle completion, combo fire effects
  • Animated counters, progress rings, and shimmer text

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Framework Next.js 16.1.6 (App Router, Turbopack)
UI React 19.2 + TypeScript
Styling Tailwind CSS 3.4 + custom CSS
Animations Framer Motion 11
Chess Logic chess.js 1.0 + custom engine
Icons Lucide React
Auth JWT (jose) + bcryptjs
Database Upstash Redis
Fonts Inter + Space Grotesk (Google Fonts)
Deployment Vercel

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm
  • Upstash Redis account (optional โ€” works in demo mode without it)

Installation

# Clone the repository
git clone https://github.com/nitheesb/chessmind.git
cd chessmind

# Install dependencies
pnpm install

# Set up environment variables
cp .env.example .env.local

Edit .env.local:

UPSTASH_REDIS_REST_URL=https://your-redis-url.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-redis-token
JWT_SECRET=your-secure-random-string-min-32-chars
# Start development server
pnpm dev

Open http://localhost:3000 to view the app.

Demo Mode

No Redis credentials? No problem. The app runs fully in demo mode:

  • All features work using localStorage
  • Progress persists per browser
  • No authentication required

๐ŸŒ Deployment

Vercel (Recommended)

# Option 1: CLI
npm i -g vercel
vercel

# Option 2: Git integration
# Push to GitHub โ†’ Connect to Vercel โ†’ Auto-deploy on push

Add environment variables in Vercel dashboard:

Variable Description
UPSTASH_REDIS_REST_URL Upstash Redis REST URL
UPSTASH_REDIS_REST_TOKEN Upstash Redis REST token
JWT_SECRET Secret key for JWT signing (min 32 chars)

Setting Up Upstash Redis

  1. Go to console.upstash.com
  2. Create a new Redis database
  3. Select a region close to your Vercel deployment
  4. Copy the REST URL and Token to your environment variables

๐Ÿ“ Project Structure

chessgrind/
โ”œโ”€โ”€ app/                          # Next.js App Router
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ auth/                 # Login, register, logout, session
โ”‚   โ”‚   โ””โ”€โ”€ user/                 # Progress sync & updates
โ”‚   โ”œโ”€โ”€ learn/                    # SEO-friendly learning pages
โ”‚   โ”œโ”€โ”€ layout.tsx                # Root layout with SEO metadata
โ”‚   โ””โ”€โ”€ page.tsx                  # Entry point
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ chess/                    # Chessboard, eval bar, coordinate trainer
โ”‚   โ”œโ”€โ”€ desktop/                  # Desktop-specific page variants
โ”‚   โ”œโ”€โ”€ pages/                    # Mobile-first page components
โ”‚   โ”œโ”€โ”€ shell/                    # App shell (mobile + desktop)
โ”‚   โ””โ”€โ”€ ui/                       # Shared UI (radar, heatmap, animations, etc.)
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ chess-engine.ts           # Custom AI engine (negamax, alpha-beta, PSTs)
โ”‚   โ”œโ”€โ”€ chess-data/               # Openings, puzzles, traps datasets
โ”‚   โ”œโ”€โ”€ opening-detection.ts      # ECO opening book (66 entries)
โ”‚   โ”œโ”€โ”€ endgame-positions.ts      # 12 curated endgame positions
โ”‚   โ”œโ”€โ”€ move-quality.ts           # Post-game move annotation analyzer
โ”‚   โ”œโ”€โ”€ game-context.tsx          # Global game state (React Context)
โ”‚   โ”œโ”€โ”€ settings-context.tsx      # App settings (theme, sound, etc.)
โ”‚   โ””โ”€โ”€ chess-store.ts            # Levels, achievements, XP calculations
โ”œโ”€โ”€ styles/globals.css            # Tailwind + custom styles
โ”œโ”€โ”€ public/manifest.json          # PWA manifest
โ””โ”€โ”€ vercel.json                   # Vercel configuration

๐Ÿ“ก API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Create new account
POST /api/auth/login Sign in
POST /api/auth/logout Sign out
GET /api/auth/session Check session status

User Progress

Method Endpoint Description
GET /api/user/sync Fetch user progress
POST /api/user/sync Sync progress to server
POST /api/user/progress Update specific progress fields

๐Ÿ“ฑ Install as App

iPhone / iPad

  1. Open chessgrind.vercel.app in Safari
  2. Tap the Share button
  3. Select Add to Home Screen

Android

  1. Open in Chrome
  2. Tap โ‹ฎ menu โ†’ Install app

Desktop

  1. Open in Chrome/Edge
  2. Click the install icon in the address bar

๐Ÿ“„ License

MIT

๐Ÿค Contributing

Contributions are welcome! Please open an issue or submit a pull request.

About

Gamified Chess trainer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors