Skip to content

feat: adds rate limiter middleware#91

Merged
semmet95 merged 1 commit into
mainfrom
feature/api-key-rate-limiter
Apr 19, 2026
Merged

feat: adds rate limiter middleware#91
semmet95 merged 1 commit into
mainfrom
feature/api-key-rate-limiter

Conversation

@semmet95
Copy link
Copy Markdown
Contributor

@semmet95 semmet95 commented Apr 19, 2026

Fixes: #89


Summary by cubic

Add a token-bucket rate limiter (10 RPS, burst 20) applied to all API routes via middleware, with an env flag to disable in dev/tests. Also serves a JSON /ping route directly in Gin and removes it from the OpenAPI-generated server and spec.

  • New Features

    • Added RateLimiterMiddleware using golang.org/x/time/rate; enabled by default.
    • Toggle with RATE_LIMIT_DISABLED=true.
    • /ping now handled by Gin (JSON response) and removed from the OpenAPI spec and generated server.
  • Migration

    • Set RATE_LIMIT_DISABLED=true locally or in tests to avoid throttling (acceptance compose updated).
    • OpenAPI clients will no longer see /ping; call GET /ping directly if needed.

Written for commit 55c6d9f. Summary will update on new commits.

Signed-off-by: Amit Singh <singhamitch@outlook.com>
@semmet95 semmet95 force-pushed the feature/api-key-rate-limiter branch from c23d7e8 to 55c6d9f Compare April 19, 2026 16:30
@semmet95 semmet95 marked this pull request as ready for review April 19, 2026 16:32
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files

@semmet95 semmet95 merged commit d862cae into main Apr 19, 2026
5 checks passed
@semmet95 semmet95 deleted the feature/api-key-rate-limiter branch April 19, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rate limit for all the endpoints

1 participant