Skip to content

Latest commit

 

History

History
168 lines (118 loc) · 5.38 KB

CONTRIBUTING.md

File metadata and controls

168 lines (118 loc) · 5.38 KB

Contribution Guidelines 💚

With your contribution, we can make this project... awesome 🎉. Now, to make a hassle-free workflow, I implore you all to follow these guidelines!

Please note we have a code of conduct, please follow it in all your interactions with the project.

☑️ Prerequisites

  • Node.js (version 12+)
  • npm (version 6+)
  • MongoDB (version 4+)
  • Redis (version 6+)

... and probably a lot of coffee (:coffee:)

⬇️ Clone and Install

  • First, fork this repository 🍴 and follow the given instructions:
# clone the forked repository to your local machine
$ git clone https://github.com/<YOUR-GITHUB-USERNAME>/pbchess.git

# navigate to the project's directory
$ cd pbchess

# install the dependencies for both client and server
$ npm run setup

# install client dependencies
$ cd client && npm install

# install server dependencies
$ cd server && npm install

➕ Include Remote Repo

  • Make sure 🔍 you are in the root of the repository:
# setup the remote repository
$ git remote add upstream https://github.com/fave77/pbchess.git

# always include the latest changes before working on a new issue
$ git checkout develop
$ git pull upstream develop --rebase

🚧 Setup Local Environment

For running this project locally 🚚, you need to setup and define the environment variables for both the client as well as the server.

Create .env files in both client and server folder with the following variables:

  • Client:

    • NODE_ENV=development
    • CI=false
    • REACT_APP_DEV_API_URL=http://localhost:8000/api/
    • REACT_APP_GOOGLE_CLIENT_ID=<your-google-client-id>
  • Server:

    • NODE_ENV=development
    • DEV_CLIENT_URL=http://localhost:3000
    • PUBLIC_KEY=<your-rsa-public-key>
    • PRIVATE_KEY=<your-rsa-private-key>
    • DEV_DATABASE_URL=mongodb://127.0.0.1:27017/pbchess
    • DEV_STORAGE_URL=127.0.0.1:6379
    • DEV_STORAGE_PSWD=<your-redis-instance-pswd>
    • EMAIL=<your-google-oauthplayground-mail-id>
    • GOOGLE_CLIENT_ID=<your-google-client-id>
    • GOOGLE_CLIENT_SECRET=<your-google-client-secret>
    • GOOGLE_REFRESH_TOKEN=<your-google-oauthplayground-refresh-token>
    • DEV_LICHESS_CLIENT_ID=<your-lichess-client-id>
    • DEV_LICHESS_CLIENT_SECRET=<your-lichess-client-secret>

Default Ports:

  • React (or Client) - 3000
  • Node.js (or Server) - 8000
  • MongoDB (or Database) - 27017
  • Redis (or In-memory DS) - 6379

Note: In order to run the client (properly), you need to have the server running at port 8000. Similarly, to run the server (propely), you need both MongoDB and Redis running at default ports 27017 and 6379 respectively.

For authentication using JWT, you must generate your rsa keys seperately and store them in environment variables, like so:

$ node server/src/services/keys.service.js generate

For using Google Sign-In and Lichess Sign-In, do not forget to provide your own credentials like clientId, clientSecret, refreshToken, etc.

🌀 Run the Project

  • Client:
# running locally
$ npm start

# testing locally
$ npm test

# building locally
$ npm run build
  • Server
# running locally
$ npm run dev

# testing locally
$ npm test

📃 Workflow

  • Always raise or claim an issue before making a pull request.

  • While raising an issue, please follow the ISSUE_TEMPLATE.md guidelines.

  • To claim an issue, just leave a comment and you'll be assigned on first come, first serve basis.

  • Follow Airbnb style guide as much as possible.

  • Your editor must support the preferences from the .editorconfig file.

  • Make sure to squash your commits for cleaner commit history.

  • While making a pull request, please follow the PULL_REQUEST_TEMPLATE.md guidelines.

  • In your pull request, never forget to mention the issue you are solving, like so - Fixed #2 (issue number).

  • In this project, we will try to adhere to Gitflow ♻️. So, make sure to create a new feature branch from develop not from master, and also create a pull request to develop not to master, like so:

# include the latest changes (as mentioned before)
$ git checkout develop
$ git pull upstream develop --rebase

# create a feature branch
$ git checkout -b <NEW-BRANCH-NAME>

# make your changes to the codebase
# add your changes
$ git add .

# make your commit
$ git commit -m "<YOUR-COMMIT-MESSAGE>"

# pull any new changes from the “staging” branch (staging branch here is the develop branch) and resolve any conflicts.
# finally, push the branch
$ git push origin <YOUR-GITHUB-USERNAME>/<FEATURE-BRANCH>

Submit a pull request 🚀 from your forked repo (feature branch) to this repo (develop branch) and you are done 🎉

forthebadge forthebadge