Skip to content

Commit 0b1f31d

Browse files
authored
update Docs: PRD and README (#17)
1 parent 1b3e100 commit 0b1f31d

File tree

3 files changed

+57
-62
lines changed

3 files changed

+57
-62
lines changed

README.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
# Real-time Leaderboard
1+
# Multi-Tenant API Management
22

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.
4-
5-
## Table of Contents
6-
7-
- [Overview](#overview)
8-
- [Features](#features)
9-
10-
## Overview
11-
12-
The **Real-time Leaderboard** project provides a platform where users can:
13-
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.
19-
20-
The system leverages Redis sorted sets for efficient real-time leaderboard management, making it scalable and performant.
21-
22-
## Features
23-
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.
3+
A **multi-tenant API management platform** is a system that allows multiple organizations (tenants) to manage, secure, and monitor their APIs through a shared infrastructure while keeping their data and configurations completely isolated from each other.

docs/PRD-realtime-leaderboard.md

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,68 @@
1-
# PRD: Real-Time Leaderboard
2-
1+
# PRD: Multi-Tenant API Management
32
## 1. Project Overview
43

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.
4+
A **multi-tenant API management platform** is a system that allows multiple organizations (tenants) to manage, secure, and monitor their APIs through a shared infrastructure while keeping their data and configurations completely isolated from each other.
5+
6+
Think of it like an apartment building: multiple tenants live in the same building (shared infrastructure), but each has their own private apartment with locked doors (data isolation). Each tenant can customize their space independently without affecting others.
7+
8+
## 2. Key Features
9+
10+
**Core API Management:**
11+
12+
- API Gateway (routing, load balancing)
13+
- Rate limiting and throttling
14+
- Authentication and authorization (API keys, OAuth, JWT)
15+
- Request/response transformation
16+
- Caching mechanisms
17+
- API versioning
18+
19+
**Multi-Tenancy Specific:**
620

7-
## 2. Core Features
21+
- **Tenant isolation** - Complete data and configuration separation
22+
- **Custom domains** - Each tenant can use their own domain
23+
- **Role-based access control (RBAC)** - Per-tenant user management
24+
- **Quota management** - Different limits per tenant tier
25+
- **Billing integration** - Usage tracking per tenant
826

9-
### 1. User Authentication
27+
**Security:**
1028

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).
29+
- SSL/TLS termination
30+
- IP whitelisting/blacklisting per tenant
31+
- DDoS protection
32+
- Security policy enforcement
33+
- API key rotation
1534

16-
### 2. Score Submission
35+
**Analytics & Monitoring:**
1736

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).
37+
- Real-time API metrics (per tenant)
38+
- Usage analytics and reports
39+
- Error tracking and logging
40+
- Performance monitoring
41+
- Custom dashboards
2242

23-
### 3. Leaderboard Display
43+
**Developer Portal:**
2444

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).
45+
- Tenant-branded developer portals
46+
- API documentation
47+
- Interactive API testing
48+
- SDK generation
49+
- Developer onboarding workflows
2850

29-
### 4. Real-Time Updates
51+
**Administrative:**
3052

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.
53+
- Tenant provisioning and management
54+
- Subscription tier management
55+
- White-labeling options
56+
- Backup and disaster recovery
57+
- Audit logs per tenant
3458

35-
### 5. User Rankings
59+
**Integration:**
3660

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).
61+
- CI/CD pipeline integration
62+
- Webhook support
63+
- Third-party service connectors
64+
- Custom plugin/middleware support
4065

41-
### 6. Top Players Report
4266

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.
67+
---
68+
[Multi-Tenant API Management](https://www.notion.so/Multi-Tenant-API-Management-Platform-AC-2a872cc6fd8580f897fefde03649320f)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "Real-time-Leaderboard",
2+
"name": "Multi-Tenant-API-Management",
33
"version": "0.0.1",
44
"description": "",
55
"author": "",
66
"private": true,
7-
"license": "UNLICENSED",
7+
"license": "MIT",
88
"scripts": {
99
"build": "nest build",
1010
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",

0 commit comments

Comments
 (0)