Skip to content
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

feat: Implement API Rate Limiting with ThrottlerModule #1329

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file. Why are you removing anything from this place

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i cant removed the .gitignore file that is what is preventing the node modules and others file from being pushed. the previous conflicts that i resolved was that from the package-lock.json then i had to pull the changes made from the dev branch to my branch and push it back to resolved the changes and i remove the package-lock.json in the .gitignore file that is preventing it from being push..

Copy link
Author

@NnatuanyaFrankOguguo NnatuanyaFrankOguguo Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have added what i remove from the .gitignore file back.

Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,5 @@ dist
*.dev
*.prod

# database files
data/db
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,48 @@

## Overview

## Rate Limiting

This project uses `@nestjs/throttler` for rate limiting to prevent abuse.

### Configuration

- **Global Rate Limit**: 10 requests per minute.
- **Custom Limits**: Some routes may have different limits.

### Error Handling

If a user exceeds the allowed request rate, they receive:

```json
{
"statusCode": 429,
"message": "Too Many Requests"
}

<img align="right" width="300" src="./screenshot/Screenshot1.png" alt="successful register user request api endpoint" />

<img align="right" width="300" src="./screenshot/ScreenshotE2.png" alt="throttle limiting " />


[Description]

## Folder Structure

```

|--- src
| |--- database
| |--- modules
| |--- shared
| |--- app.module.ts
| |--- main.ts
| |--- database
| |--- modules
| |--- shared
| |--- app.module.ts
| |--- main.ts
|--- .env.local
|--- .gitignore
|--- package.json
|--- tsconfig.json
```

````

## Dependencies (Dev)

Expand Down Expand Up @@ -63,7 +89,7 @@ Open a terminal and run the following git command:

```bash
git clone "url you just copied"
```
````

where "url you just copied" (without the quotation marks) is the url to this repository (your fork of this project). See the previous steps to obtain the url.

Expand Down
36 changes: 36 additions & 0 deletions docker-compose.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this. Don't push your docker-compose

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
services:
postgres:
container_name: postgres-boiler
image: postgres:latest
ports:
- '5432:5432'
environment:
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- ./data/db:/var/lib/postgresql/data
restart: always

adminer:
image: adminer
container_name: adminer-boiler
ports:
- '8080:8080'
restart: always
depends_on:
- postgres

redis:
image: redis:latest
container_name: redis-boiler
ports:
- '6379:6379'
command: ['redis-server', '--appendonly', 'yes']
volumes:
- redis_data:/data
restart: always

volumes:
data:
redis_data:
Loading