Backend implementation of the chain reaction game.
Chain reaction is a multiplayer game, in which players are assigned colors and take turns placing cells on the board. As soon as a cell reaches its limit, the cell explodes and spreads into the adjacent cells, changing the cell's color. As soon as the whole board is covered in a single color, the respective player wins.
The project uses Express, Socket.io and MongoDB. It uses JsonWebToken and redis for handling user authentication. Tests for the user and auth routes written using Jest.
-
Clone the backend repository
git clone https://github.com/standmarsh/chain-reaction-backend.git
-
Install the dependencies
npm install
-
Install redis
sudo apt-get install redis-server
Above instructions are for linux only, for other system's refer Redis website
-
Run redis server
redis-server
-
Database setup
Either install and run MongoDB, or set up a cloud database such as MongoDB Atlas.
-
Env file ( sets NODE_ENV to development initially)
MONGO_URI_STRING_TEST = MONGO_URI_STRING_DEV = PORT = NODE_ENV = development ACCESS_TOKEN_SECRET = REFRESH_TOKEN_SECRET =
Add the following fields to .env file in the project root
-
Start server
npm run dev // development npm run start // starts server after transpililing npm test // runs jest
Help in implementing game logic from Sarthak Mittal's Repo
Help in implementing authentication logic from yoursTRULY Youtube Channel