Welcome to Gambit, an online chess platform where you can play chess with your friends or against a computer while chatting in real-time or watch top games from lichess.org, a popular chess website.
Gambit is built using React on the frontend with react-chessboard to render the chessboard and chess.js to handle chess logic and Node.js with Express and WebSockets on the backend.
To get started with Gambit, simply visit the website at https://gambit.onrender.com.
To run the project locally, follow these steps:
- Clone the repository:
git clone https://github.com/Carbrex/gambit.git
- Install dependencies for both the frontend and the backend:
pnpm install
ornpm install
- Add environment variable to
.env
inbackend
andfrontend
folders:
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
Then replace the values in the .env
files with your own values.
- Install
stockfish
engine:
sudo apt install stockfish
Or follow the instructions on the Stockfish website.
- Build the frontend using
cd frontend && npm run build
. - Start the backend server:
cd ../backend && node app.js
- Then navigate to http://localhost:5000/ in your browser.
To run the project using Docker, follow these steps:
- Clone the repository:
git clone https://github.com/Carbrex/gambit.git
- Add environment variable to
.env
inbackend
andfrontend
folders:
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
Then replace the values in the .env
files with your own values.
- Build the Docker image:
docker build -t gambit .
- Run the Docker container:
docker run -p 5000:5000 gambit
- Then navigate to http://localhost:5000/ in your browser.
Thanks to the Stockfish engine, Gambit allows you to play against a computer. The Stockfish engine is a powerful open-source chess engine that is used by many chess websites and applications. You can find the Stockfish engine at https://stockfishchess.org/.
The docker image used for docker setup can be found on Docker Hub at https://hub.docker.com/r/carbrex/sf-on-node-alpine it has stockfish 14 on top of node:18-alpine image.
We welcome contributions to Gambit! If you find a bug or have a feature request, please open an issue on GitHub. If you would like to contribute code, please fork the repository and submit a pull request.