{"id":30882053,"url":"https://github.com/stoppieboy/rate-limiter","last_synced_at":"2025-09-08T08:04:46.089Z","repository":{"id":313509602,"uuid":"1049088137","full_name":"stoppieboy/rate-limiter","owner":"stoppieboy","description":"A High Throughput Rate Limiter","archived":false,"fork":false,"pushed_at":"2025-09-06T14:02:35.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-06T15:29:12.626Z","etag":null,"topics":["gin-gonic","golang","lua","prometheus","redis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoppieboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T13:21:07.000Z","updated_at":"2025-09-06T14:02:38.000Z","dependencies_parsed_at":"2025-09-06T15:29:14.068Z","dependency_job_id":"f28d9ba2-5de2-4645-bada-7e24db3eb6bc","html_url":"https://github.com/stoppieboy/rate-limiter","commit_stats":null,"previous_names":["stoppieboy/rate-limiter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/stoppieboy/rate-limiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoppieboy%2Frate-limiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoppieboy%2Frate-limiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoppieboy%2Frate-limiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoppieboy%2Frate-limiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoppieboy","download_url":"https://codeload.github.com/stoppieboy/rate-limiter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoppieboy%2Frate-limiter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274152754,"owners_count":25231293,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["gin-gonic","golang","lua","prometheus","redis"],"created_at":"2025-09-08T08:03:07.336Z","updated_at":"2025-09-08T08:04:46.081Z","avatar_url":"https://github.com/stoppieboy.png","language":"Go","readme":"# 🚦 High-Throughput Rate Limiter (Gin + Redis + Lua + Prometheus)\n\nA blazing-fast, production-ready rate limiter built in Go (Gin), powered by Redis Lua scripts for atomic token bucket operations, and instrumented with Prometheus \u0026 Grafana for real-time monitoring and observability.\n\n✨ Features\n\n⚡ High Throughput – Uses Redis Lua scripts for atomic token bucket updates with minimal latency.\n\n🛡 Distributed \u0026 Consistent – Works across multiple Gin instances using Redis as a shared store.\n\n🎛 Configurable – Easily set bucket size, refill rate, and key granularity (per user/IP/endpoint).\n\n📊 Metrics \u0026 Observability – Exposes Prometheus metrics at /metrics endpoint for scraping.\n\n🧩 Gin Middleware – Drop-in middleware for any Gin project.\n\n🧪 Tested – Unit tests for Lua script, middleware, and metrics.\n\n## ⚙️ How It Works\n\n### 1. Token Bucket Algorithm\n\n- Each request tries to consume a token from its bucket.\n\n- If available → token is decremented and request proceeds.\n\n- If empty → request is rejected with 429 Too Many Requests.\n\n### 2. Redis Lua Script\n\n- Atomic refill \u0026 consume in a single round trip.\n\n- Prevents race conditions under high concurrency.\n\n### 3. Prometheus Integration\n\n- Exposes metrics: allowed requests, rejections, bucket usage, request latency.\n\n- Compatible with Grafana dashboards for monitoring.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoppieboy%2Frate-limiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoppieboy%2Frate-limiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoppieboy%2Frate-limiter/lists"}