|
1 |
| -# Code Rating Engine |
| 1 | +# :gear: Code Rating Engine |
2 | 2 |
|
3 |
| -Engine used to rate the different open source codes using ELO Rating System |
| 3 | +Backend Engine that is used in [codemash](https://github.com/GauravWalia19/codemash) project for rating the open-source code |
4 | 4 |
|
5 |
| -## Useful info |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
6 | 9 |
|
7 |
| -1. Mongo token deletion time: 5 minutes |
8 |
| -2. Rate limiting time: 10 requests per minute |
9 |
| -3. Caching time: 30 seconds |
| 10 | +## Features |
| 11 | + |
| 12 | +- Developed the rating mechanism using ELO Rating Algorithm |
| 13 | +- Implemented in memory caching (30 seconds) |
| 14 | +- Secured the update and the searching routes with token mechanism (Token expiry maintained as 5 minutes) |
| 15 | +- Implemented rate limiting (10 requests per minute) |
| 16 | + |
| 17 | +## System Architecture |
| 18 | + |
| 19 | +As system architecture contains sensitive information so please email us [here ](mailto:[email protected]) |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +### Prerequisites |
| 24 | + |
| 25 | +- node js v20 |
| 26 | +- yarn v1 |
| 27 | +- vercel CLI (only required for deployments) |
| 28 | +- MongoDB in local desktop or in MongoDB Atlas |
| 29 | + |
| 30 | +### Installation |
| 31 | + |
| 32 | +- Clone the repository using the below command |
| 33 | + |
| 34 | +```bash |
| 35 | +git clone [email protected]:TECHOUS/coderatingengine.git |
| 36 | +``` |
| 37 | + |
| 38 | +- Run the below command in the project folder and install all the dependencies |
| 39 | + |
| 40 | +```bash |
| 41 | +yarn run build |
| 42 | +``` |
| 43 | + |
| 44 | +- Create `.env` file in the project folder and add the properties mentioned in the [Environment Variables](#environment-variables) section |
| 45 | +- After all this setup we are good to run the APIs from local |
| 46 | +- Follow the [Scripts](#scripts) section for the scripts you can run in your local |
| 47 | + |
| 48 | +### Environment Variables |
| 49 | + |
| 50 | +#### `MONGODB_URI` |
| 51 | + |
| 52 | +Add the mongo db URI from the local desktop or from Mongo DB Atlas account, for example |
| 53 | + |
| 54 | +```bash |
| 55 | +mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]] |
| 56 | +``` |
| 57 | +
|
| 58 | +#### `RATE_LIMIT_MINUTES` |
| 59 | +
|
| 60 | +- how long to remember requests for, in minutes |
| 61 | +- configure a number as 1 or greater than 1 |
| 62 | +
|
| 63 | +#### `RATE_LIMIT_MAX_REQUEST` |
| 64 | +
|
| 65 | +- how many requests to allow |
| 66 | +- configure a number greater than 1 per your choice |
| 67 | +
|
| 68 | +#### `CACHE_STORAGE_SECONDS` |
| 69 | +
|
| 70 | +- For how long you can have to return the data from in memory cache |
| 71 | +- This property is applicable for randomCodes and searchUser API |
| 72 | +
|
| 73 | +### Scripts |
| 74 | +
|
| 75 | +#### `yarn run build` |
| 76 | +
|
| 77 | +Build and install the required nodejs dependencies and devDependencies from `package.json` for running this project |
| 78 | +
|
| 79 | +#### `yarn run test` |
| 80 | +
|
| 81 | +You can run the tests with this script and verify if the APIs are working fine or not |
| 82 | +
|
| 83 | +#### `yarn run start` |
| 84 | +
|
| 85 | +- Start the nodejs server in production mode |
| 86 | +- Server will be stopped if any issues came up |
| 87 | +
|
| 88 | +#### `yarn run dev` |
| 89 | +
|
| 90 | +- Start the nodejs server in development mode |
| 91 | +- Server will be restarted if any issues came up |
| 92 | +
|
| 93 | +## API Documentation |
| 94 | +
|
| 95 | +For API Endpoints and Documentation follow [this link](https://coderatingengine.vercel.app/) |
| 96 | +
|
| 97 | + |
| 98 | +
|
| 99 | +## Related Projects |
| 100 | +
|
| 101 | +[codemash](https://github.com/GauravWalia19/codemash) |
0 commit comments