๐๐ผ๐ฐ๐ฎ๐น ๐๐ต๐ฒ๐๐ ๐๐ป๐ฎ๐น๐๐๐ถ๐ ๐ช๐ถ๐๐ต ๐ช๐ฒ๐ฏ๐๐๐๐ฒ๐บ๐ฏ๐น๐
I built a Chrome extension. It runs Stockfish locally. It needs no backend. It needs no API calls.
I wanted to test browser limits. I tested if a chess engine works in a browser. I tested WebAssembly for heavy CPU work.
Three parts make the system:
- Stockfish compiled to WebAssembly.
- Chrome Extension Manifest V3.
- Message passing between parts.
WebAssembly gives near native speed for heavy tasks. The extension uses a background service worker, content scripts, and a UI popup.
I faced some problems:
- Service workers stop randomly.
- Stockfish takes time to start.
- Heavy tasks block the UI.
The design relies on messages:
- UI to background.
- Background to engine.
- Engine to UI.
Key takeaways:
- WebAssembly works for heavy CPU tasks.
- Architecture matters more than speed.
- Manifest V3 limits your design.
- Logic is harder than the engine.
This was an experiment. It shows what modern browsers do.
Source: https://dev.to/physicalaff/how-i-built-a-chrome-extension-that-runs-stockfish-using-webassembly-fully-local-chess-analysis-5gkp Optional learning community: https://github.com/physicalaff/Knight-Chess-Helper