Archived. The chess AI now runs in the browser. See andrewmacheret/chess. The
ChessAILambda, its API Gateway API, andchess.andrewmacheret.comhave been deleted.
Back-end chess AI for andrewmacheret/chess. It runs Stockfish 19 (the lite, single-threaded WebAssembly build) in the Lambda function ChessAI on Node.js 24.
See andrewmacheret/chess-server for the previous version that runs on Docker.
GET https://chess.andrewmacheret.com/moves?fen=<FEN>&depth=<depth>
fenis required.depthdefaults to 10 and is capped at 20. Each search stops after 3 seconds.- Returns something like
{"bestmove":"e2e4","ponder":"c7c5","actualdepth":10,"interrupted":false,"millis":92}.bestmoveis(none)when there are no legal moves.
API Gateway (REST API 64cbac0f1h, stage live) maps the query string to the Lambda event as {"fen": "...", "depth": "..."}.
cd src/lambda
npm install
npm test
Pushing to master runs .github/workflows/deploy.yml, which tests, zips src/lambda with only the Stockfish engine it uses, updates the ChessAI function, and smoke tests the API.
It signs in to AWS with GitHub OIDC using the role in the repo variable AWS_ROLE_ARN.