Skip to content
This repository was archived by the owner on Nov 26, 2026. It is now read-only.
andrewmacheretPublic archive

About

An AWS lambda function wrapper around the stockfish chess engine to find the best move given a chess position in FEN notation and the requested move depth.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Chess AI using Node.js, Stockfish, and AWS Lambda

Archived. The chess AI now runs in the browser. See andrewmacheret/chess. The ChessAI Lambda, its API Gateway API, and chess.andrewmacheret.com have been deleted.

License

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.

API

GET https://chess.andrewmacheret.com/moves?fen=<FEN>&depth=<depth>

  • fen is required. depth defaults 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}. bestmove is (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": "..."}.

Develop

cd src/lambda
npm install
npm test

Deploy

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.

About

An AWS lambda function wrapper around the stockfish chess engine to find the best move given a chess position in FEN notation and the requested move depth.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages