{"id":13576598,"url":"https://github.com/0verread/goralim","last_synced_at":"2025-04-05T08:32:22.226Z","repository":{"id":227372860,"uuid":"771252935","full_name":"0verread/goralim","owner":"0verread","description":"A rate limiting package for Go to handle distributed workloads","archived":false,"fork":false,"pushed_at":"2024-04-27T16:28:40.000Z","size":54,"stargazers_count":140,"open_issues_count":4,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-05T13:40:43.762Z","etag":null,"topics":["distributed-systems","golang","rate-limiter","rate-limiting","redis"],"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/0verread.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":"2024-03-13T00:41:52.000Z","updated_at":"2024-05-22T03:13:58.000Z","dependencies_parsed_at":"2024-03-13T02:23:40.495Z","dependency_job_id":"6372406a-9187-4673-8abe-6ddc8ac01ce8","html_url":"https://github.com/0verread/goralim","commit_stats":null,"previous_names":["0verread/goralim"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0verread%2Fgoralim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0verread%2Fgoralim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0verread%2Fgoralim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0verread%2Fgoralim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0verread","download_url":"https://codeload.github.com/0verread/goralim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247311795,"owners_count":20918337,"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":["distributed-systems","golang","rate-limiter","rate-limiting","redis"],"created_at":"2024-08-01T15:01:11.884Z","updated_at":"2025-04-05T08:32:21.817Z","avatar_url":"https://github.com/0verread.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"![banner](images/banner.png)\n\n# Goralim\n\n[goralim](https://github.com/0verread/goralim) is a Golang package that provides a rate limiter based on [Token bucket](https://en.wikipedia.org/wiki/Token_bucket) algorithm. It is capable to handle distributed workload with its redis database support. It has HTTP server middleware support (as of now).\n\n\u003e 🚧 this is a beta version now and under active development. For production use, fork it and make changes based on your need.\n\n## Install\n```bash\ngo get \"github.com/0verread/goralim\" -m\n```\n## Usage\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\tgoralim \"github.com/0verread/goralim\"\n)\n\nfunc main() {\n\t// Redis initialization\n\tconfig := goralim.RedisConfig{\n\t\tHOST: \"127.0.0.1\",\n\t\tPORT: 6379,\n\t\t// password\n\t\tPASS: \"\",\n\t}\n\tredisStore := goralim.NewRedisClient(config)\n\n\t// setup rate limiter for a key (key can be userId/client)\n\t// 10 is bucket size, 5 is bucket refill rate per second\n\ttb := goralim.NewTokenBucket(\"key123\", redisStore, 10, 5)\n\n\t// create HTTP server and setup a goralim middleware to put a rate limiter\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, \"Hey There this is a Request\")\n\t})\n\n\trateLimitedHandler := goralim.RateLimiter(tb, handler)\n\thttp.ListenAndServe(\":8080\", rateLimitedHandler)\n}\n```\n\n## Contributions\n\nfeel free to create pull requests for the bugs and/or features. additionally, you can start working on any open issues that i've created. those are the priorities for next stable prod ready release. make sure you write and/or modify the test cases. thank you.\n\n\n## License\nUnder [MIT](LICENSE) license\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0verread%2Fgoralim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0verread%2Fgoralim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0verread%2Fgoralim/lists"}