-
Notifications
You must be signed in to change notification settings - Fork 3
Add PRD and cleanup initial README #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a13ed6a
docs: Add PRD
gazzaar f89cd3c
Add resources for git, nest and docker
gazzaar 5bde5ac
docs: cleanup nest starter README & Write intial one
gazzaar 4f0a020
Add resources for Redis, SOLID, Testing and React
gazzaar ceb40ae
Remove explicit lines
gazzaar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,98 +1,30 @@ | ||
| <p align="center"> | ||
| <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a> | ||
| </p> | ||
| # Real-time Leaderboard | ||
|
|
||
| [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 | ||
| [circleci-url]: https://circleci.com/gh/nestjs/nest | ||
| A full-stack system that provides real-time leaderboard tracking for users across multiple games or activities. The project demonstrates real-time data management, ranking logic, and scalable architecture using modern web technologies. | ||
|
|
||
| <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p> | ||
| <p align="center"> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a> | ||
| <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a> | ||
| <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a> | ||
| <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> | ||
| <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> | ||
| <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a> | ||
| <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a> | ||
| <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a> | ||
| </p> | ||
| <!--[](https://opencollective.com/nest#backer) | ||
| [](https://opencollective.com/nest#sponsor)--> | ||
| ## Table of Contents | ||
|
|
||
| ## Description | ||
| - [Overview](#overview) | ||
| - [Features](#features) | ||
|
|
||
| [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. | ||
| ## Overview | ||
|
|
||
| ## Project setup | ||
| The **Real-time Leaderboard** project provides a platform where users can: | ||
|
|
||
| ```bash | ||
| $ pnpm install | ||
| ``` | ||
| - Register and authenticate securely. | ||
| - Submit scores for various games or activities. | ||
| - View a global leaderboard that updates dynamically. | ||
| - Track their own ranking in real time. | ||
| - Generate reports of top players for a specific time period. | ||
|
|
||
| ## Compile and run the project | ||
| The system leverages Redis sorted sets for efficient real-time leaderboard management, making it scalable and performant. | ||
|
|
||
| ```bash | ||
| # development | ||
| $ pnpm run start | ||
| ## Features | ||
|
|
||
| # watch mode | ||
| $ pnpm run start:dev | ||
|
|
||
| # production mode | ||
| $ pnpm run start:prod | ||
| ``` | ||
|
|
||
| ## Run tests | ||
|
|
||
| ```bash | ||
| # unit tests | ||
| $ pnpm run test | ||
|
|
||
| # e2e tests | ||
| $ pnpm run test:e2e | ||
|
|
||
| # test coverage | ||
| $ pnpm run test:cov | ||
| ``` | ||
|
|
||
| ## Deployment | ||
|
|
||
| When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. | ||
|
|
||
| If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: | ||
|
|
||
| ```bash | ||
| $ pnpm install -g @nestjs/mau | ||
| $ mau deploy | ||
| ``` | ||
|
|
||
| With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. | ||
|
|
||
| ## Resources | ||
|
|
||
| Check out a few resources that may come in handy when working with NestJS: | ||
|
|
||
| - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. | ||
| - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). | ||
| - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). | ||
| - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. | ||
| - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). | ||
| - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). | ||
| - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). | ||
| - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). | ||
|
|
||
| ## Support | ||
|
|
||
| Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). | ||
|
|
||
| ## Stay in touch | ||
|
|
||
| - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) | ||
| - Website - [https://nestjs.com](https://nestjs.com/) | ||
| - Twitter - [@nestframework](https://twitter.com/nestframework) | ||
|
|
||
| ## License | ||
|
|
||
| Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). | ||
| - **User Authentication:** Secure user registration and login with session or JWT-based auth. | ||
| - **Score Submission:** API endpoints to submit and update user scores. | ||
| - **Leaderboard Storage:** Uses Redis sorted sets for storing and ranking scores. | ||
| - **Real-Time Updates:** Automatic leaderboard refresh on score changes. | ||
| - **User Rankings:** Query user rank and score efficiently. | ||
| - **Top Players Report:** Generate reports for top players within a given date range. | ||
| - **Dockerized Environment:** Full stack runs via Docker for consistent setup across environments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # PRD: Real-Time Leaderboard | ||
|
|
||
| ## 1. Project Overview | ||
|
|
||
| The goal is to build a real-time leaderboard platform where users can register, submit scores for different games or activities, and view leaderboards that update in real time. Redis will power the leaderboard ranking logic for performance and scalability, while PostgreSQL will store persistent user and score history data. | ||
|
|
||
| ## 2. Core Features | ||
|
|
||
| ### 1. User Authentication | ||
|
|
||
| - Users can register and log in using email and password. | ||
| - JWT-based authentication (access + refresh tokens). | ||
| - Auth endpoints (register, login, logout, refresh). | ||
| - Tech: NestJS (Auth module), PostgreSQL (Users table). | ||
|
|
||
| ### 2. Score Submission | ||
|
|
||
| - Users submit scores for specific games or activities. | ||
| - Each submission updates Redis leaderboard and persists in PostgreSQL for history. | ||
| - API validation (score must be numeric, positive, and higher than previous if applicable). | ||
| - Tech: NestJS (Scores module), Redis (Sorted Sets), PostgreSQL (ScoreHistory table). | ||
|
|
||
| ### 3. Leaderboard Display | ||
|
|
||
| - Global leaderboard showing top N players across all games. | ||
| - Individual game leaderboard view (e.g., “Top 10 in Chess”). | ||
| - Paginated or infinite scroll leaderboard (Redis rank queries). | ||
|
|
||
| ### 4. Real-Time Updates | ||
|
|
||
| - When a user submits a new score, others viewing the leaderboard see live updates. | ||
| - Implemented via WebSocket (Socket.IO). | ||
| - Tech: Socket.IO integration between NestJS and React. | ||
|
|
||
| ### 5. User Rankings | ||
|
|
||
| - Users can view their personal rank and score among all players. | ||
| - Endpoint: /leaderboard/:game/my-rank. | ||
| - Tech: Redis rank query (ZREVRANK + ZSCORE). | ||
|
|
||
| ### 6. Top Players Report | ||
|
|
||
| - Generate reports of top players within a date range. | ||
| - Admin or system-generated (JSON or CSV). | ||
| - Example: “Top players in Game X between Oct 1–7.” | ||
| - Tech: Query PostgreSQL (ScoreHistory) for aggregated data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # List of helpful resources to help us during the project | ||
|
|
||
| - [Git](#git) | ||
| - [Nest](#nestjs) | ||
| - [React](#react) | ||
| - [Docker](#docker) | ||
| - [Redis](#redis) | ||
| - [Testing](#testing) | ||
| - [SOLID](#solid) | ||
|
|
||
| ## Git | ||
|
|
||
| - [Intermediate Git](https://www.theodinproject.com/paths/full-stack-javascript/courses/javascript#intermediate-git) | ||
| - [Github flow](https://docs.github.com/en/get-started/using-github/github-flow) | ||
| - [Github Actions -Arabic-](https://youtu.be/7gJFHjXscr8) | ||
| - [Github Actions](https://youtu.be/R8_veQiYBjI) | ||
|
|
||
| ## NestJS | ||
|
|
||
| - [API with NestJS](https://wanago.io/courses/api-with-nestjs/) | ||
|
|
||
| ## React | ||
|
|
||
| - [The Odin Project - React](https://www.theodinproject.com/paths/full-stack-javascript/courses/react) | ||
| - [React docs](https://react.dev/) | ||
|
|
||
| ## Docker | ||
|
|
||
| - [Docker-Diary](https://github.com/SalmaAlassal/Docker-Diary/tree/main) | ||
| - [Get-To-Docker](https://github.com/Open-Source-Community/Get-To-Docker-24) | ||
|
|
||
| ## Redis | ||
|
|
||
| - [Redis 101](https://mrinalxdev.github.io/mrinalxblogs/blogs/redis.html) | ||
| - [Redis - Arabic](https://www.youtube.com/watch?v=uFwNNqhmhMQ&list=WL&index=4&t=700s) | ||
|
|
||
| ## Testing | ||
|
|
||
| - [Jest](https://jestjs.io/docs/getting-started) | ||
|
|
||
| ## Solid | ||
|
|
||
| - [SOLID Arabic ](https://youtube.com/playlist?list=PLwWuxCLlF_uevri_OpofVLXkRRFnZ7TSV) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.