尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Chess drawn on an HTML5 canvas: play Stockfish at 8 levels or a friend in real time.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Canvas chess against Stockfish or a friend, running on AWS.
Home · Client · Server · Data service · Deploy · Terraform · Setup & fixes
A chess game drawn on an HTML5 canvas: sprite pieces with shadows and reflections on a wooden table, sliding moves and move sounds. Play Stockfish at 8 levels or a friend by username or challenge link.
Every move is checked three times: by chess.js in the browser, by the Express server, and by the private data service, the only code that can touch DynamoDB, which plays the move on the stored board itself.
Built with: vanilla JavaScript, HTML5 Canvas, Webpack 5, Express 5, Socket.IO, chess.js, and Stockfish through chess-engine-api (with js-chess-engine as backup). AWS: two EC2 instances, DynamoDB, S3 + CloudFront, all in Terraform (Deploy). Deploy commands and fixes: SETUP.md.
| Canvas | Board, table and pieces are layered sprites (reflection, shadow, piece). Pieces face the way they last moved, and knights hop. |
| Moving | Drag and drop or click to move, with legal moves and check highlighted, or press / and type a move like e4, choosing from the legal moves it lists. Promote by clicking one of your captured pieces. Touch and a TV remote mode (TV_DEV in client/src/js/pages/play/index.js) work too. |
| Play the AI | 8 levels with approximate Elo (AI levels) and a color (Alternate, the default: random at first, then switching each game; Random, White, Black). The server picks and saves the AI's moves. Forfeit ends an unfinished game after a second press, then Restart starts a new game with the same level and color. One open AI game per player. |
| Play a friend | Invite by username with your color. They Accept or Decline on Home, and moves arrive live over Socket.IO. One sent invite and one open friend game at a time; starting another forfeits after a second press. Forfeit asks first. |
| Set positions | An optional FEN in Start position. The server refuses broken or finished positions with the reason, and Restart and Rematch keep it. |
| Game over | Checkmate, stalemate, insufficient material, the fifty-move rule, threefold repetition, a forfeit, a draw by agreement or running out of time (timeout). Both boards show the result. |
| Hints | In AI games, Hint in the game menu highlights a good move from the engine, and Turn Eval Bar shows who's winning in a bar beside the board. Finished games can show the bar too. Friend games that are still going show neither. |
| Takebacks | Takeback in the game menu. AI games, guests too: your last move and the AI's reply go back, with no limit per game. Friend games: your opponent can accept or decline, once per move, and the next move cancels it. Accepted, your last move goes back, and their reply if they made one, up to 3 per game. The invite can turn them off. |
| Draw offers | Offer Draw in the game menu, once per player per move. Your opponent can accept or decline, and the offer ends with the next move. The AI always accepts until both sides have made their first move, then only when it isn't ahead. |
GUEST_GAME_ID) and is also their
player id; a signed guest_game cookie keeps it to that browser.renderCanvas() loads every sprite, then GET /api/chess/game/:gameId
(board, your color, the opponent). A guest without a game gets one first.PUT /api/chess/game/:gameId
{ move: [from, to], promotion }. A refusal puts the board back. A move that
ends the game returns state: "CLOSED", winner and reason.POST /api/chess/game/:gameId/ai-move: the server asks Stockfish
at the saved level, checks and saves the move, and returns it. Asking again
returns the same move.move to the game's Socket.IO room, and
the other client fetches the game and animates prev_move. After a
reconnect it fetches once in case it missed something.Requires Node 24+ (the server).
Install, then fill in the .env files (client, server, data service).
The copy below skips a .env that already exists, so it won't wipe your secrets.
npm ci # client (Webpack)
(cd server && npm ci && { [ -f .env ] || cp .env.example .env; }) # chess server
(cd data-service && npm ci && { [ -f .env ] || cp .env.example .env; })
Before starting, in the .env files:
CLIENT_URL=http://localhost:3002/ in server/.env, or login and logout
are refused as coming from another site.DATA_SERVICE_SECRET in server/.env and data-service/.env
(the command to make one is in data-service/.env.example).SESSION_PRIVATE_KEY in data-service/.env,
SESSION_PUBLIC_KEY in server/.env
(Making the session keys).
With the placeholders, both processes exit on start.Then run the three processes in separate terminals and open http://localhost:3002.
cd data-service && npm run dev # terminal 1: data service on http://127.0.0.1:8090
cd server && npm start # terminal 2: chess server on http://localhost:3001
npm run dev # terminal 3: client on http://localhost:3002
npm ci installs the versions in the committed package-lock.json; add a
package with npm install in its folder and commit the lock file with it.
| README | What's in it |
|---|---|
| client/ | client/.env, the images and audio on S3, the run commands, every page, the Socket.IO client |
| server/ | server/.env, the server tests, auth, the chess API, Socket.IO events, the AI levels |
| data-service/ | Request signing, every data service route, the session keys, stored data, the data service tests |
| deploy/ | The AWS deploy, step by step, and updating it |
| terraform/ | The AWS resources, restoring a table, the data service instance and its upkeep windows |
| SETUP.md | Deploy commands and a fix for each error |
| CONTRIBUTING.md, SECURITY.md, ACCESSIBILITY.md | Contributing, reporting security problems and the session key rules, accessibility |
client/ The browser game: pages, canvas gameplay, Socket.IO client (client/README.md)
server/ Express + Socket.IO: pages, auth, the chess API, the AI (server/README.md)
data-service/ The only code that reads and writes DynamoDB, on a private instance (data-service/README.md)
deploy/ The deploy script, systemd units and the nginx site (deploy/README.md)
terraform/ The AWS resources (terraform/README.md)
.github/
workflows/ci.yml GitHub Actions: server tests (with the data service), data service tests, the client build, ESLint and npm audit on every pull request
workflows/codeql.yml CodeQL scan of the JavaScript on every pull request and weekly
dependabot.yml Weekly update PRs for the npm packages and the pinned GitHub Actions
eslint.config.js ESLint flat config for the whole repo (npm run lint); rules are warnings for now
Proprietary, all rights reserved: see LICENSE. To contribute, see CONTRIBUTING.md, and report security problems as described in SECURITY.md. Third-party packages keep their own licenses, and Stockfish isn't included in this repo (see below).
The AI plays with Stockfish, free software by the Stockfish developers, distributed under the GNU General Public License version 3 (GPL v3). Whenever Stockfish is distributed, the license and the full source code (or a link to it) for that exact binary have to go with it, and any changes to its source have to be released under GPL v3 too.
sf_19 source
(see the Stockfish license section in its README).Copying.txt and a link to the sf_19 source have to go with it.stockfish/ folder (the unmodified Stockfish 17.1 source and
the build used to measure the AI levels) is in .gitignore,
so it's never committed. If you share it, or a binary built from it, keep
its Copying.txt and source with it.Home · Client · Server · Data service · Deploy · Terraform · Setup & fixes
| Rematch | Both players press within 5 minutes and a new game loads on both boards. The first sees "Waiting for " with Cancel, and hears if the other player leaves. "Can't rematch" when either is in another friend game, or that rematch expired. |
| Ratings | Elo from 1500. Only finished friend games (both sides moved, not from a set position) count. Shown on Home and in a friend game's menu. |
| Usernames | 3 to 20 letters, numbers, _ or -, unique in any capitals, some reserved. Picked on Settings after the first sign-in. |
| Friends | Home's Friends box: send, accept, decline and cancel friend requests by username, see who's online, and Challenge (fills in the invite) or Remove each friend. |
| Settings | /settings: username, account, default start settings, and Delete my account (deletes your Auth0 login, forfeits your games, deletes your row, frees your username and anonymizes your finished friend games). /privacy and /terms hold the policies. |
| Guests | Play the AI without an account: one game, kept to the browser that made it. |
| Mobile | Portrait and landscape layouts, and iOS audio unlocks on the first tap. |