Skip to content

Khushbu696/Rate_Limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ API Rate Limiter & Monitoring System

A professional, real-time API Rate Limiting dashboard and backend system. This project provides a robust solution for managing API traffic, preventing abuse, and monitoring system health via a sleek, interactive dashboard.


🚀 Key Features

  • 🔐 Multi-Layer Authentication: Secure authentication and validation with unique API Key generation for every user.
  • ⚖️ Dynamic Rate Limiting: Manage rules in real-time without restarting the server.
    • GLOBAL: Apply limits to all users for specific endpoints.
    • USER: Set custom quotas for individual users.
    • API_KEY: Precision control for specific developer keys.
  • 📊 Live Monitoring Dashboard:
    • Traffic Throughput: Real-time charts showing request volume.
    • Live Audit Logs: Instant visibility into every allowed (200) and blocked (429) request.
    • Stat Cards: High-level metrics for Total Requests, Blocked Events, and Active Rules.
  • 🧪 Integrated API Tester: Built-in terminal to test your APIs and rate limits directly from the browser.
  • 👥 RBAC (Role-Based Access Control): Admin-only control panel for managing global rules and system-wide logs.

📸 Screenshots

📊 Dashboard Overview

Dashboard

📜 Live Request Logs (200 vs 429)

Logs

📈 Traffic & Rate Limiting Analytics

Analytics

⚙️ Applied Rate Limit Rules

Rules


🛠️ Tech Stack

Backend

  • Java 17 with Spring Boot 3
  • Spring Security (Custom Filter & Interceptors)
  • Spring Data JPA (MySQL Persistence)
  • Lombok (Boilerplate reduction)

Frontend

  • Next.js 14 (App Router)
  • TypeScript
  • Recharts (Visual Analytics)
  • Lucide Icons
  • Vanilla CSS (Custom Premium Glassmorphism UI)

📖 API Documentation

The complete API documentation including request bodies, headers, and authentication flows can be found here:

🔗 Postman API Documentation (Public Link)

Quick Reference:

Resource Path Method Access
Auth /auth/register POST Public
Auth /auth/login POST Public
Rules /rate-limit/create POST Admin
Stats /analytics/summary GET Authenticated
Logs /logs GET Authenticated

⚙️ How It Works (The Core Logic)

  1. Interceptor Layer: Every request is checked for a valid API-KEY header.
  2. Filter Layer: The RateLimiterFilter intercepts requests to protected paths (e.g., /api/**).
  3. Hierarchy Check: The system looks for rules in the order: API_KEY > USER > GLOBAL.
  4. Sliding Window: It queries the request history within the defined timeWindow (e.g., 60 seconds).
  5. Decision:
    • If count < limit, the request proceeds and is logged as 200.
    • If count >= limit, the request is rejected with 429 Too Many Requests.

🛠️ Setup & Installation

1. Prerequisites

  • JDK 17+
  • Node.js 18+
  • MySQL Server

2. Backend Setup

cd backend
# Update application.properties with your MySQL credentials
./mvnw spring-boot:run

3. Frontend Setup

cd frontend
npm install
npm run dev

About

Real-time API Rate Limiter & Monitoring System with RBAC, dynamic rule management, live analytics dashboard, and API key-based authentication built using Spring Boot & Next.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors