Skip to main content
This guide walks you through cloning, building, and running RLaaS Users Service locally. By the end you will have a running service that enforces a 5-request-per-60-second sliding window and have seen both an allowed response and a rate-limit rejection.

Prerequisites

Before you begin, make sure you have the following installed:
  • Java 17+ — check with java -version
  • Maven — bundled via the Maven wrapper (./mvnw), no separate install needed
  • Redis — a local instance works fine for getting started
If you do not have Redis running locally, start one with Docker:
docker run -d -p 6379:6379 redis:7

Steps

1

Clone and build

Clone the repository and build the JAR, skipping tests for speed:
git clone https://github.com/amitsaxena098/rlaas-users-service.git
cd rlaas-users-service
./mvnw clean package -DskipTests
Maven downloads dependencies on the first run. Subsequent builds are faster.
2

Set required environment variables

The service reads its Redis connection URL from the REDIS_URL environment variable. Export it before starting:
export REDIS_URL=redis://localhost:6379
If you are pushing metrics to Grafana Cloud, also export GRAFANA_CLOUD_ZONE, GRAFANA_CLOUD_INSTANCE_ID, and GRAFANA_CLOUD_API_KEY. Those variables are optional for local testing.
3

Run the service

Start the service using the Maven wrapper:
./mvnw spring-boot:run
The service starts on port 8080 by default. You should see Spring Boot’s startup banner followed by a line confirming the application started successfully.
4

Make your first request

In a new terminal, call the /check endpoint with a userId:
curl "http://localhost:8080/check?userId=alice"
# Response: User is allowed
The service increments Alice’s counter in Redis and returns 200 User is allowed.
5

Trigger rate limiting

Call the endpoint six times in quick succession to exceed the default limit of 5 requests per window:
for i in {1..6}; do curl -s "http://localhost:8080/check?userId=alice"; echo; done
# First 5: User is allowed
# 6th:     User is not allowed...Try after 58 seconds.
The sixth request returns 429 Too Many Requests with the number of seconds remaining in the current window.
The default configuration allows 5 requests per 60-second sliding window. See the configuration page to change the algorithm, window size, or request limit.

Next steps

Configuration

Adjust the algorithm, window size, and Redis connection.

Algorithms

Understand the difference between fixed-window and sliding-window counters.

API reference

Full reference for the GET /check endpoint.

Build docs developers (and LLMs) love