Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omkargade04/rate-limiting
This a backend server build using spring boot. It contains API endpoints . Main objective of this project is to implement rate limiting feature on APIs using Redis
https://github.com/omkargade04/rate-limiting
docker java postgresql redis springboot
Last synced: 18 days ago
JSON representation
This a backend server build using spring boot. It contains API endpoints . Main objective of this project is to implement rate limiting feature on APIs using Redis
- Host: GitHub
- URL: https://github.com/omkargade04/rate-limiting
- Owner: omkargade04
- Created: 2024-07-11T18:11:22.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-12T03:40:18.000Z (4 months ago)
- Last Synced: 2024-10-11T06:11:52.606Z (about 1 month ago)
- Topics: docker, java, postgresql, redis, springboot
- Language: Java
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RATE LIMITER WITH REDIS
- This application is a Spring Boot application demonstrating rate limiting with Redis for user management operations.
-
Explanation:
-
UserController: The API endpoint for managing user information. It includes methods to handle creating, retrieving, updating, and deleting user data. This controller interacts with the UserService to perform these operations. -
UserService: Contains the business logic for user management. It performs CRUD operations on the User entity and interacts with the RateLimiterService to apply rate limiting rules. -
RateLimiterService: Utilizes Redis to track and enforce rate limiting rules. It ensures that the number of requests made by a user does not exceed the specified limit within a given time window. -
UserRepository: Extends Spring Data JPA's JpaRepository, providing methods for performing database operations on user entities. This layer abstracts the data access operations, making it easier to manage user data. -
Redis Configuration: Redis is configured to support rate limiting functionality. The configuration includes setting up a RedisTemplate for efficient data access and operations. This template handles the interactions with Redis, such as incrementing request counts and setting expiration times for keys, ensuring accurate rate limiting.
-
### Explore Rest APIs
Method
Url
Description
Request Body
POST
/api/v1/users
Create a new user
create user vody
GET
/api/v1/users
Retrieve all users
GET
/api/v1/users/{userId}
Retrieve a user by ID
PUT
/api/v1/users/{userId}
Update an existing user
update user body
DELETE
/api/v1/users/{userId}
Delete a user by ID
---
Docker
---
### Docker Run
The application can be built and run by the `Docker` engine. The `Dockerfile` has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
```sh
$ cd rate-limiting
$ docker-compose up -d
```
If you change anything in the project and run it on Docker, you can also use this command shown below
```sh
$ cd rate-limiting
$ docker-compose up --build
```
---