Small widget easy to integrate into web pages with customizable chess puzzles, various parameters, and guides on the Wiki โ under the MIT license. ๐งฉ๐๐
๐ฏ An embeddable, fully customizable chess puzzle widget powered by Lichess โ and Chessground ๐ง
Everything you need to use, customize, and embed ChessBox lives in the ChessBox Wiki ๐โจ.
| ๐ Page | ๐ฏ What you'll find |
|---|---|
| ๐ Getting Started | Download, run locally, deploy to GitHub Pages, embed with an iframe |
| ๐ง URL Parameters Reference | Every parameter, its values, defaults, and examples |
| ๐จ Customization Guide | Add piece sets, board themes, and languages |
| ๐ผ๏ธ Examples Gallery | Ready-to-copy URLs and embedding snippets |
| โ FAQ & Troubleshooting | Blank board, CORS, iframe issues, and more |
- ๐ GitHub: @MeowDev1011
- โ๏ธ Lichess: @GatoChess89
- ๐ฅ Download or clone this repository.
- ๐ฑ๏ธ Open
index.htmlin your browser. That's it. โจ
To serve it locally ๐ฅ๏ธ:
npx serve .
# or
python -m http.server 8000To embed it anywhere ๐, upload it to any static host (GitHub Pages, Netlify, Vercel, Cloudflare Pages) and drop it into an iframe ๐ผ๏ธ:
<iframe
src="https://meowdev1011.github.io/Chess-Box/"
width="460"
height="640"
style="border:none;"
loading="lazy">
</iframe>ChessBox is a self-contained widget that turns any web page into an interactive chess puzzle trainer. It pulls puzzles directly from the official Lichess puzzle API, so you always get fresh, high-quality positions curated by the Lichess community. ๐
No installation. No npm. No bundler. Just drop the folder and open index.html. ๐
- ๐งฉ Real Lichess puzzles โ daily puzzles, themed puzzles, or difficulty-filtered puzzles, pulled live.
- โ๏ธ Play the winning side โ the widget detects whether you're playing as White or Black automatically.
- ๐ค Automatic opponent's first move โ the position is set up exactly as Lichess presents it.
- ๐ฑ๏ธ Drag-and-drop or tap-to-move โ both interaction modes work, on desktop and mobile.
- โ
Full legal move validation โ powered by
chess.js, so illegal moves are impossible to play. - ๐ Snap-back on wrong moves โ if you play an incorrect move, the piece returns to its square.
- ๐ฏ Move-by-move feedback โ every correct move advances the puzzle; every wrong move is explained.
- ๐ก Hint button โ animates the next solution move on the board for half a second and shows the notation.
- ๐๏ธ Solution button โ displays the full remaining sequence in a modal and replays it move by move.
- ๐ Reset button โ restores the starting position of the current puzzle instantly.
- โก๏ธ Next button โ fetches a brand-new puzzle using the current theme and difficulty.
- ๐ Magnifier button โ shows a 3-second info card with your color, rating, theme, board, and orientation.
- ๐ง Clean / Zen mode โ pure board, no distractions.
- ๐ Move history โ toggle a panel that lists every move played in algebraic notation.
- ๐ Local stats โ puzzles solved, current streak, best streak, attempts, and time played.
- ๐๏ธ 3-tap corner gesture โ tap 3 times in any of the 4 corners to toggle the control panel.
- ๐ฅ๏ธ Expand mode โ one-click board enlargement for a bigger view.
- ๐จ 16 2D piece sets โ Horsey (default), Cburnett, Merida, Alpha, Chessnut, Fantasy, Spatial, Staunty, Pirouetti, Chess7, Reillycraig, Companion, Riohacha, Kosal, Leipzig, Celtic.
- ๐ช 3 3D piece sets โ 3D Staunty, 3D Cburnett, 3D Merida (CSS perspective, no extra assets).
- ๐จ 12 board themes โ Blue (Lichess), Green, Brown, Gray, Dark, Light, Wood, Marble, Purple, plus three 3D variants.
- ๐ Custom hex colors โ pick any light/dark square pair you want.
- ๐ผ๏ธ Widget background control โ transparent, black, white, or any hex color.
- ๐ค Coordinate font size โ small, normal, large.
- ๐ King indicator โ the turn indicator shows the King sprite from the currently selected piece set.
- ๐ผ๏ธ Live previews โ 2ร2 board preview and knight preview inside the settings panel.
- ๐ 20 languages โ English ๐ฌ๐ง, Spanish ๐ช๐ธ, French ๐ซ๐ท, German ๐ฉ๐ช, Portuguese ๐ต๐น, Italian ๐ฎ๐น, Russian ๐ท๐บ, Chinese ๐จ๐ณ, Japanese ๐ฏ๐ต, Korean ๐ฐ๐ท, Arabic ๐ธ๐ฆ, Hindi ๐ฎ๐ณ, Dutch ๐ณ๐ฑ, Polish ๐ต๐ฑ, Turkish ๐น๐ท, Swedish ๐ธ๐ช, Danish ๐ฉ๐ฐ, Norwegian ๐ณ๐ด, Finnish ๐ซ๐ฎ, Czech ๐จ๐ฟ.
- ๐ Auto-detected โ the widget picks your browser language automatically. No selector needed.
- ๐ Full coverage โ buttons, banners, error messages, hints, solutions, tooltips, everything.
- ๐ต Move sound โ subtle tone when a piece moves.
- ๐ฅ Capture sound โ deeper tone when a piece is captured.
- โ๏ธ Check sound โ distinct tone when the king is put in check.
- ๐ Success sound โ celebratory tone when the puzzle is solved.
- โ Error sound โ low buzz for illegal or incorrect moves.
- ๐ No audio files โ everything generated live with the Web Audio API.
- ๐ PGN export โ copy the current game in PGN format via a custom modal.
- ๐งฉ FEN export โ copy the current position in FEN format via a custom modal.
- ๐ช Custom modals โ no browser
alert/confirm/promptanywhere.
- ๐ Fluid board โ scales to any screen width without breaking.
- ๐ฅ๏ธ Max width 440px โ stays crisp on desktop.
- ๐ฑ Mobile-optimized โ touch-action rules prevent accidental scrolling.
- ๐ Orientation aware โ recalculates on device rotation.
- ๐น Keyboard shortcuts โ
Hhint,Ssolution,Rreset,Nnext,Eexpand,Escclose.
- ๐ Modular โ clean separation between state, config, UI, board, puzzle logic, and controls.
- ๐ฆ Zero npm dependencies โ libraries load from stable CDNs.
- ๐งฉ Modern ES modules โ
<script type="module">everywhere. - ๐ฏ No backend required โ talks directly to the Lichess public API.
- ๐งผ No tracking, no analytics โ completely private.
- ๐ Fully URL-configurable โ see the URL Parameters Reference in the wiki.
- ๐ Well documented โ full wiki with guides and examples.
- ๐ก The widget fetches a puzzle from the Lichess public API.
- โ๏ธ It loads the PGN and identifies which side you play.
- ๐ค The opponent's first move is played automatically.
- ๐ฏ It becomes your turn โ you see the position after the opponent's move.
- ๐ฑ๏ธ You drag or tap a piece to a legal square.
- โ If the move is correct, the puzzle continues.
- โ If the move is wrong, the piece snaps back and a red banner explains why.
- ๐ When you complete the sequence, a green banner congratulates you.
- โก๏ธ Press Next to load another puzzle, or Reset to retry.
The control panel below the board lets you change everything on the fly, no URL editing required:
- ๐งฉ Puzzle theme selector (Mate in 1/2/3, Fork, Pin, Skewer, Sacrifice, Endgame, Opening, and many more).
- ๐ Level selector (Baby, Sprout, Sapling, Tree, Forest).
- ๐ Optional rating override (any number, e.g.
1500or15). - ๐ Free-text theme search.
- ๐จ Board color selector with live 2ร2 preview.
- ๐ Custom light/dark hex color pickers.
- โ๏ธ Piece set selector with live knight preview.
- ๐ผ๏ธ Widget background selector.
- ๐งญ Board orientation selector (auto, white, black).
- ๐ค PGN and FEN export buttons.
The panel is open by default. Three quick taps in any corner hide or show it. ๐ฏ
| ๐งฑ Layer | ๐ฆ Library / Source |
|---|---|
| ๐จ Board rendering | Chessground 10.1.1 |
| ๐ง Game logic | chess.js 1.4.0 |
| ๐งฉ Puzzles | Lichess API |
| โ๏ธ Piece sprites | https://lichess1.org/assets/piece/* |
| ๐ Audio | Web Audio API (no files) |
| ๐จ Styling | Pure CSS, CSS variables |
| Browser | Minimum version |
|---|---|
| ๐ข Chrome / Edge | 89+ |
| ๐ฆ Firefox | 89+ |
| ๐งญ Safari | 15+ |
| ๐ฑ iOS Safari | 15+ |
| ๐ค Chrome Android | 89+ |
Requires: ES modules, URLSearchParams, Fetch API, CSS aspect-ratio, Web Audio API (optional, for sound), localStorage (optional, for stats).
Chess-Box/
โโโ index.html # The widget shell
โโโ LICENSE # MIT license
โโโ README.md # This file
โโโ css/
โ โโโ README.md
โ โโโ styles.css # The full stylesheet
โโโ js/
โ โโโ README.md
โ โโโ main.js # Entry point
โ โโโ state.js # Shared mutable state
โ โโโ config.js # Static data
โ โโโ i18n.js # Translations + language detection
โ โโโ audio.js # Web Audio tones
โ โโโ storage.js # localStorage stats
โ โโโ modal.js # Custom modal
โ โโโ ui.js # Banners, toasts, previews
โ โโโ board.js # Chessground wrapper
โ โโโ puzzle.js # Lichess API + game logic
โ โโโ controls.js # All UI listeners
โโโ assets/
โโโ README.md
โโโ pieces_2d.js # 2D piece set definitions
โโโ pieces_3d.js # 3D piece set definitions
No package.json. No node_modules. No dist/. No build scripts. โ
Found a bug ๐ or want to add a feature โจ? Open an issue or send a pull request ๐.
When reporting a bug, please include:
- ๐ The URL you used (with its parameters).
- ๐ Your browser and version.
- ๐ฏ What you expected vs. what happened.
- ๐ฅ๏ธ The console output (F12 โ Console), if there is an error.
Released under the MIT License โ .
You are free to use, modify, embed, and redistribute ChessBox โ commercial or personal ๐ โ as long as you keep the copyright notice ๐.
- ๐ด The Lichess team, for the open puzzle API and the Chessground library.
- โ The chess.js authors, for a clean, rules-only engine.
- ๐จ Everyone who contributed piece sets to the Lichess piece library.
- ๐ The open-source chess community, for keeping the game free.
If you like ChessBox, consider:
- โญ Starring the repository
- ๐ Reporting bugs on the issue tracker
- ๐ Contributing with a pull request
- ๐ฌ Sharing it with your chess friends โ๏ธ
| ๐ Resource | ๐ URL |
|---|---|
| ๐ฆ Repository | https://github.com/MeowDev1011/Chess-Box |
| ๐ Wiki | https://github.com/MeowDev1011/Chess-Box/wiki |
| ๐ License (MIT) | https://github.com/MeowDev1011/Chess-Box/blob/main/LICENSE |
| ๐ฎ Live demo | https://meowdev1011.github.io/Chess-Box/ |
| ๐ Issues | https://github.com/MeowDev1011/Chess-Box/issues |
| ๐ Pull requests | https://github.com/MeowDev1011/Chess-Box/pulls |
| โญ Stars | https://github.com/MeowDev1011/Chess-Box/stargazers |
- โ Real Lichess puzzles
- โ 16 2D piece sets + 3 3D sets
- โ 12 board themes + custom colors
- โ 20 languages, auto-detected
- โ Full URL parameter API
- โ Hint and solution playback
- โ Web Audio sounds
- โ Responsive design
- โ Clean / Zen mode
- โ Move history
- โ Local stats (localStorage)
- โ PGN / FEN export
- โ Custom modal
- โ Keyboard shortcuts
- โ Expand mode
- ๐ Puzzle history and progress tracking per theme
- ๐ Local storage for user preferences
- ๐ More piece sets
- ๐ Theme packs (download / upload)
โ๏ธ Made with โค๏ธ by MeowDev1011 โ๏ธ
โญ If you like this project, don't forget to star it! โญ
๐ Happy puzzling! ๐งฉ