{"id":21525095,"url":"https://github.com/achrefdevtn/rate-limiting","last_synced_at":"2026-04-11T19:32:21.354Z","repository":{"id":253936376,"uuid":"844980300","full_name":"AchrefDevTN/rate-limiting","owner":"AchrefDevTN","description":"A Node.js Express app demonstrating rate limiting with the MVC architecture. Limits API requests to prevent abuse: 100 requests per 15 minutes globally, 5 login attempts per 15 minutes. Includes helmet for security. Organized into controllers, routes, and configuration.","archived":false,"fork":false,"pushed_at":"2024-08-20T12:20:32.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T18:18:23.900Z","etag":null,"topics":["api-rate-limiting","expressjs","nodejs","rate-limiting","web-security"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AchrefDevTN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-20T10:50:41.000Z","updated_at":"2024-08-20T13:25:02.000Z","dependencies_parsed_at":"2024-08-20T13:21:53.150Z","dependency_job_id":null,"html_url":"https://github.com/AchrefDevTN/rate-limiting","commit_stats":null,"previous_names":["achrefdevtn/rate-limiting"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AchrefDevTN/rate-limiting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AchrefDevTN%2Frate-limiting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AchrefDevTN%2Frate-limiting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AchrefDevTN%2Frate-limiting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AchrefDevTN%2Frate-limiting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AchrefDevTN","download_url":"https://codeload.github.com/AchrefDevTN/rate-limiting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AchrefDevTN%2Frate-limiting/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261453214,"owners_count":23160471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-rate-limiting","expressjs","nodejs","rate-limiting","web-security"],"created_at":"2024-11-24T01:32:31.371Z","updated_at":"2025-12-30T22:26:06.381Z","avatar_url":"https://github.com/AchrefDevTN.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rate Limiting\n\n![Rate Limiting](https://miro.medium.com/v2/resize:fit:720/format:webp/1*6y-sXg7h44QSa_R_Loeejw.jpeg)\n\n## Overview\n\nThis repository provides a comprehensive implementation of rate limiting using Node.js and Express. The project showcases best practices in applying global and route-specific rate limits to prevent abuse and ensure fair usage.\n\n## Table of Contents\n\n- [Features](#features)\n- [Tech Stack](#tech-stack)\n- [Prerequisites](#prerequisites)\n- [Setup](#setup)\n- [API Endpoints](#api-endpoints)\n- [Rate Limiting Details](#rate-limiting-details)\n- [Contributing](#contributing)\n- [License](#license)\n- [Links](#links)\n\n## Features\n\n- **Global Rate Limiting**: Limits the number of requests per IP address to prevent abuse.\n- **Login Rate Limiting**: Specifically limits login attempts to mitigate brute force attacks.\n- **Security Enhancements**: Utilizes Helmet for basic security improvements.\n\n## Tech Stack\n\n- **Backend**: Node.js, Express\n- **Rate Limiting**: express-rate-limit\n- **Security**: Helmet\n- **Environment Management**: dotenv\n\n## Prerequisites\n\nEnsure you have the following installed and configured on your machine:\n\n- **Node.js**: Version 14 or higher. [Download here](https://nodejs.org/).\n- **MySQL**: MySQL server or a compatible database for future expansions. [Download here](https://dev.mysql.com/downloads/mysql/).\n\nFor installation assistance, refer to the official documentation or guides.\n\n## Setup\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/AchrefDevTN/rate-limiting.git\n   ```\n2. **Navigate into the project directory:**\n   ```bash\n   cd rate-limiting\n   ```\n  \n3. **Install dependencies:**\n   ```bash\n   npm install\n   ```\n4. **Create a .env file in the root directory:**\n   (Copy the contents below and configure your environment variables)\n  \n   ```ini\n   PORT=5000\n   ```\n\n5. **Run the application:**\n   - For development\n   ```bash\n   npm run dev\n   ```\n   - For production\n   ```bash\n   npm start\n   ```\n\n6. **Access the API:**\n   - The server will be running on\n   ```bash\n   http://localhost:5000\n   ```\n\n## API Endpoints\n\n- **GET `/api/`**  \n  Returns a welcome message.  \n  **Response:**  \n  ```json\n  {\n     \"message\": \"Welcome to the Rate Limiting API!\"\n  }\n  ```\n  \n- **POST `/api/login`**  \n  Logs in a user and applies rate limiting.  \n  **Request body:**  \n  ```json\n\n  {\n    \"username\": \"string\",\n    \"password\": \"string\"\n  }\n  ```\n\n  **Response:**  \n  ```json\n\n  {\n    \"message\": \"Login successful\"\n  }\n  ```\n\n\n## Global Rate Limiter\n- **Limits**: 100 requests per 15 minutes per IP\n- **Message**: Too many requests from this IP, please try again later.\n\n## Login Rate Limiter\n- **Limits**: 5 login attempts per 15 minutes per IP\n- **Message**: Too many login attempts from this IP, please try again later.\n\n## Contributing\nIf you have suggestions or improvements, please submit an issue or pull request. Contributions are welcome!\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/AchrefDevTN/rate-limiting/blob/main/LICENSE) file for details.\n\n## 🔗 Links\n[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)]([https://www.linkedin.com/](https://www.linkedin.com/in/achref-ben-brahim-dev/))\n\n\n| Node.js | Express | Rate Limiting | License |\n|---------|---------|---------------|---------|\n| [![Node.js](https://img.shields.io/badge/Node.js-v14%2B-green)](https://nodejs.org/) | [![Express](https://img.shields.io/badge/Express-v4.18.2-blue)](https://expressjs.com/) | [![Rate Limiting](https://img.shields.io/badge/Rate%20Limiting-%E2%9C%94-brightgreen)](https://www.npmjs.com/package/express-rate-limit) | [![License](https://img.shields.io/badge/license-MIT-brightgreen)](https://github.com/AchrefDevTN/rate-limiting/blob/main/LICENSE) |\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefdevtn%2Frate-limiting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fachrefdevtn%2Frate-limiting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefdevtn%2Frate-limiting/lists"}