{"id":20554928,"url":"https://github.com/zeroboo/gin-request-limitter","last_synced_at":"2026-04-11T23:45:03.496Z","repository":{"id":61627393,"uuid":"542918032","full_name":"zeroboo/gin-request-limitter","owner":"zeroboo","description":"Request limitter as middleware for gin-gonic framework","archived":false,"fork":false,"pushed_at":"2025-01-14T09:29:21.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T10:51:15.550Z","etag":null,"topics":["gcp","gin","gin-gonic","go","golang","google-datastore","middleware"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroboo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-09-29T04:33:46.000Z","updated_at":"2025-01-14T09:29:26.000Z","dependencies_parsed_at":"2024-06-20T10:18:24.204Z","dependency_job_id":"8cfabeb0-f8b4-4b6d-af2c-3c93520b50d7","html_url":"https://github.com/zeroboo/gin-request-limitter","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroboo%2Fgin-request-limitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroboo%2Fgin-request-limitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroboo%2Fgin-request-limitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroboo%2Fgin-request-limitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroboo","download_url":"https://codeload.github.com/zeroboo/gin-request-limitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242159911,"owners_count":20081569,"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","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":["gcp","gin","gin-gonic","go","golang","google-datastore","middleware"],"created_at":"2024-11-16T03:14:34.241Z","updated_at":"2026-04-11T23:44:58.458Z","avatar_url":"https://github.com/zeroboo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/zeroboo/gin-request-limitter)](https://goreportcard.com/report/github.com/zeroboo/gin-request-limitter)\n# gin-request-limitter\nRequest limitter as middleware for gin-gonic framework: limit requests can be accepted of an user.\n\n\n# Features:\n  - Limit request interval: user can not send request too fast\n  - Limit request freequently:\n    - User can not send too many requests in a time window. \n    - Implement Fixed windows algorithm using Redis or Google Firestore as  persistence.\n# Usage\n* Install\n```console\ngo get github.com/zeroboo/gin-request-limitter\n```\n* Run\n\n```go\n\nctx := context.Background()\ndsClient, _ := datastore.NewClient(ctx, datastoreProjectId, option.WithCredentialsFile(serviceAccount))\n  \n/*\nCreate a limitter middleware per user:\n  persists data to kind 'tracker' in datastore\n  collect userId from gin context by field 'userId'\n  restricts request only send to 200 milis after the last one\n  restricts maximum 100 requests per 60 seconds\n*/\nhandler := CreateDatastoreBackedLimitter(dsClient,\n  \"tracker\",\n  GetUserIdFromContextByField(\"userId\"), \n  200, \n  60000, \n  100),\n  \n//use handler ...\n```\n\n* Test\n```console\ngo test -timeout 60s github.com/zeroboo/gin-request-limitter -v\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroboo%2Fgin-request-limitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroboo%2Fgin-request-limitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroboo%2Fgin-request-limitter/lists"}