Skip to content

Commit bfc4f96

Browse files
authored
Add PRD and useful resources (#7)
* docs: Add PRD * Add resources for git, nest and docker * docs: cleanup nest starter README & Write intial one * Add resources for Redis, SOLID, Testing and React * Remove explicit lines
1 parent baae977 commit bfc4f96

File tree

3 files changed

+110
-89
lines changed

3 files changed

+110
-89
lines changed

README.md

Lines changed: 21 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,30 @@
1-
<p align="center">
2-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
3-
</p>
1+
# Real-time Leaderboard
42

5-
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6-
[circleci-url]: https://circleci.com/gh/nestjs/nest
3+
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.
74

8-
<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>
9-
<p align="center">
10-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13-
<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>
14-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
15-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
16-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
17-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
18-
<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>
19-
<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>
20-
</p>
21-
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
22-
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
5+
## Table of Contents
236

24-
## Description
7+
- [Overview](#overview)
8+
- [Features](#features)
259

26-
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
10+
## Overview
2711

28-
## Project setup
12+
The **Real-time Leaderboard** project provides a platform where users can:
2913

30-
```bash
31-
$ pnpm install
32-
```
14+
- Register and authenticate securely.
15+
- Submit scores for various games or activities.
16+
- View a global leaderboard that updates dynamically.
17+
- Track their own ranking in real time.
18+
- Generate reports of top players for a specific time period.
3319

34-
## Compile and run the project
20+
The system leverages Redis sorted sets for efficient real-time leaderboard management, making it scalable and performant.
3521

36-
```bash
37-
# development
38-
$ pnpm run start
22+
## Features
3923

40-
# watch mode
41-
$ pnpm run start:dev
42-
43-
# production mode
44-
$ pnpm run start:prod
45-
```
46-
47-
## Run tests
48-
49-
```bash
50-
# unit tests
51-
$ pnpm run test
52-
53-
# e2e tests
54-
$ pnpm run test:e2e
55-
56-
# test coverage
57-
$ pnpm run test:cov
58-
```
59-
60-
## Deployment
61-
62-
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.
63-
64-
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:
65-
66-
```bash
67-
$ pnpm install -g @nestjs/mau
68-
$ mau deploy
69-
```
70-
71-
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
72-
73-
## Resources
74-
75-
Check out a few resources that may come in handy when working with NestJS:
76-
77-
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
78-
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
79-
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
80-
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
81-
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
82-
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
83-
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
84-
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
85-
86-
## Support
87-
88-
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).
89-
90-
## Stay in touch
91-
92-
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
93-
- Website - [https://nestjs.com](https://nestjs.com/)
94-
- Twitter - [@nestframework](https://twitter.com/nestframework)
95-
96-
## License
97-
98-
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
24+
- **User Authentication:** Secure user registration and login with session or JWT-based auth.
25+
- **Score Submission:** API endpoints to submit and update user scores.
26+
- **Leaderboard Storage:** Uses Redis sorted sets for storing and ranking scores.
27+
- **Real-Time Updates:** Automatic leaderboard refresh on score changes.
28+
- **User Rankings:** Query user rank and score efficiently.
29+
- **Top Players Report:** Generate reports for top players within a given date range.
30+
- **Dockerized Environment:** Full stack runs via Docker for consistent setup across environments.

docs/PRD-realtime-leaderboard.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# PRD: Real-Time Leaderboard
2+
3+
## 1. Project Overview
4+
5+
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.
6+
7+
## 2. Core Features
8+
9+
### 1. User Authentication
10+
11+
- Users can register and log in using email and password.
12+
- JWT-based authentication (access + refresh tokens).
13+
- Auth endpoints (register, login, logout, refresh).
14+
- Tech: NestJS (Auth module), PostgreSQL (Users table).
15+
16+
### 2. Score Submission
17+
18+
- Users submit scores for specific games or activities.
19+
- Each submission updates Redis leaderboard and persists in PostgreSQL for history.
20+
- API validation (score must be numeric, positive, and higher than previous if applicable).
21+
- Tech: NestJS (Scores module), Redis (Sorted Sets), PostgreSQL (ScoreHistory table).
22+
23+
### 3. Leaderboard Display
24+
25+
- Global leaderboard showing top N players across all games.
26+
- Individual game leaderboard view (e.g., “Top 10 in Chess”).
27+
- Paginated or infinite scroll leaderboard (Redis rank queries).
28+
29+
### 4. Real-Time Updates
30+
31+
- When a user submits a new score, others viewing the leaderboard see live updates.
32+
- Implemented via WebSocket (Socket.IO).
33+
- Tech: Socket.IO integration between NestJS and React.
34+
35+
### 5. User Rankings
36+
37+
- Users can view their personal rank and score among all players.
38+
- Endpoint: /leaderboard/:game/my-rank.
39+
- Tech: Redis rank query (ZREVRANK + ZSCORE).
40+
41+
### 6. Top Players Report
42+
43+
- Generate reports of top players within a date range.
44+
- Admin or system-generated (JSON or CSV).
45+
- Example: “Top players in Game X between Oct 1–7.”
46+
- Tech: Query PostgreSQL (ScoreHistory) for aggregated data.

docs/resources.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# List of helpful resources to help us during the project
2+
3+
- [Git](#git)
4+
- [Nest](#nestjs)
5+
- [React](#react)
6+
- [Docker](#docker)
7+
- [Redis](#redis)
8+
- [Testing](#testing)
9+
- [SOLID](#solid)
10+
11+
## Git
12+
13+
- [Intermediate Git](https://www.theodinproject.com/paths/full-stack-javascript/courses/javascript#intermediate-git)
14+
- [Github flow](https://docs.github.com/en/get-started/using-github/github-flow)
15+
- [Github Actions -Arabic-](https://youtu.be/7gJFHjXscr8)
16+
- [Github Actions](https://youtu.be/R8_veQiYBjI)
17+
18+
## NestJS
19+
20+
- [API with NestJS](https://wanago.io/courses/api-with-nestjs/)
21+
22+
## React
23+
24+
- [The Odin Project - React](https://www.theodinproject.com/paths/full-stack-javascript/courses/react)
25+
- [React docs](https://react.dev/)
26+
27+
## Docker
28+
29+
- [Docker-Diary](https://github.com/SalmaAlassal/Docker-Diary/tree/main)
30+
- [Get-To-Docker](https://github.com/Open-Source-Community/Get-To-Docker-24)
31+
32+
## Redis
33+
34+
- [Redis 101](https://mrinalxdev.github.io/mrinalxblogs/blogs/redis.html)
35+
- [Redis - Arabic](https://www.youtube.com/watch?v=uFwNNqhmhMQ&list=WL&index=4&t=700s)
36+
37+
## Testing
38+
39+
- [Jest](https://jestjs.io/docs/getting-started)
40+
41+
## Solid
42+
43+
- [SOLID Arabic ](https://youtube.com/playlist?list=PLwWuxCLlF_uevri_OpofVLXkRRFnZ7TSV)

0 commit comments

Comments
 (0)