Skip to content
MeowDev1011Public

About

Small widget easy to integrate into web pages with customizable chess puzzles with various parameters and guides on Wikis under MIT license

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ™Ÿ๏ธ ChessBox ๐Ÿ†

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 ๐Ÿง 

License: MIT Made with JavaScript GitHub stars GitHub forks Repo size Last commit


๐Ÿ“š Documentation & Wiki ๐Ÿ”—

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

๐Ÿ‘ค Author ๐ŸŒŸ


โšก Quick start ๐Ÿš€

  1. ๐Ÿ“ฅ Download or clone this repository.
  2. ๐Ÿ–ฑ๏ธ Open index.html in your browser. That's it. โœจ

To serve it locally ๐Ÿ–ฅ๏ธ:

npx serve .
# or
python -m http.server 8000

To 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>

โœจ What is ChessBox? ๐Ÿงฉ

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. ๐Ÿ“„


๐ŸŽ Features ๐Ÿ’Ž

๐ŸŽฎ Gameplay

  • ๐Ÿงฉ 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.

๐Ÿ’ก Helper tools

  • ๐Ÿ’ก 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.

๐ŸŽจ Visual customization

  • ๐ŸŽจ 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.

๐ŸŒ Localization

  • ๐ŸŒ 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.

๐Ÿ”Š Audio

  • ๐ŸŽต 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.

๐Ÿ“ค Export

  • ๐Ÿ“„ 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 / prompt anywhere.

๐Ÿ“ฑ Responsive design

  • ๐Ÿ“ 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 โ€” H hint, S solution, R reset, N next, E expand, Esc close.

๐Ÿ› ๏ธ Developer friendly

  • ๐Ÿ“„ 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.

๐ŸŽฎ How a puzzle works ๐Ÿง 

  1. ๐Ÿ“ก The widget fetches a puzzle from the Lichess public API.
  2. โ™Ÿ๏ธ It loads the PGN and identifies which side you play.
  3. ๐Ÿค– The opponent's first move is played automatically.
  4. ๐ŸŽฏ It becomes your turn โ€” you see the position after the opponent's move.
  5. ๐Ÿ–ฑ๏ธ You drag or tap a piece to a legal square.
  6. โœ… If the move is correct, the puzzle continues.
  7. โŒ If the move is wrong, the piece snaps back and a red banner explains why.
  8. ๐ŸŽ‰ When you complete the sequence, a green banner congratulates you.
  9. โžก๏ธ Press Next to load another puzzle, or Reset to retry.

๐ŸŽ›๏ธ Panel controls ๐ŸŽš๏ธ

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. 1500 or 15).
  • ๐Ÿ” 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. ๐ŸŽฏ


๐Ÿงฐ Tech stack ๐Ÿ› ๏ธ

๐Ÿงฑ 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 support ๐ŸŒ

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).


๐Ÿ“‚ Project structure ๐Ÿ—‚๏ธ

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. โœ…


๐Ÿค Contributing ๐Ÿ’ฌ

Found a bug ๐Ÿ› or want to add a feature โœจ? Open an issue or send a pull request ๐ŸŽ‰.

When reporting a bug, please include:

  1. ๐Ÿ”— The URL you used (with its parameters).
  2. ๐ŸŒ Your browser and version.
  3. ๐ŸŽฏ What you expected vs. what happened.
  4. ๐Ÿ–ฅ๏ธ The console output (F12 โ†’ Console), if there is an error.

๐Ÿ“œ License โš–๏ธ

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 ๐Ÿ“.


๐Ÿ™ Acknowledgements ๐Ÿ’–

  • ๐Ÿด 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.

๐ŸŒŸ Support the project ๐Ÿ’ซ

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 โ™Ÿ๏ธ

๐Ÿ”— Quick links ๐Ÿš€

๐Ÿ”– 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

๐ŸŽฏ Roadmap ๐Ÿ—บ๏ธ

  • โœ… 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! ๐Ÿงฉ

About

Small widget easy to integrate into web pages with customizable chess puzzles with various parameters and guides on Wikis under MIT license

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages