{"id":16611365,"url":"https://github.com/shufo/plug_rate_limit_redis","last_synced_at":"2025-03-21T14:31:06.853Z","repository":{"id":14029831,"uuid":"75694177","full_name":"shufo/plug_rate_limit_redis","owner":"shufo","description":"An Elixir plug rate limiting with redis","archived":false,"fork":false,"pushed_at":"2023-12-15T20:35:48.000Z","size":11,"stargazers_count":8,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T11:11:32.514Z","etag":null,"topics":["elixir"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/plug_rate_limit_redis","language":"Elixir","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/shufo.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}},"created_at":"2016-12-06T04:22:45.000Z","updated_at":"2020-06-03T18:41:55.000Z","dependencies_parsed_at":"2023-12-15T22:02:55.074Z","dependency_job_id":null,"html_url":"https://github.com/shufo/plug_rate_limit_redis","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"6be76cf5d55c302cc100e393d2256c432f993ff8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fplug_rate_limit_redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fplug_rate_limit_redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fplug_rate_limit_redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fplug_rate_limit_redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shufo","download_url":"https://codeload.github.com/shufo/plug_rate_limit_redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244815123,"owners_count":20514894,"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":["elixir"],"created_at":"2024-10-12T01:36:48.563Z","updated_at":"2025-03-21T14:31:06.415Z","avatar_url":"https://github.com/shufo.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/shufo/plug_rate_limit_redis.svg?branch=master)](https://travis-ci.org/shufo/plug_rate_limit_redis)\n[![hex.pm version](https://img.shields.io/hexpm/v/plug_rate_limit_redis.svg)](https://hex.pm/packages/plug_rate_limit_redis)\n[![hex.pm](https://img.shields.io/hexpm/l/plug_rate_limit_redis.svg)](https://github.com/shufo/plug_rate_limit_redis/blob/master/LICENSE)\n\n# plug_rate_limit_redis\n\nAn Elixir plug that rate limiting with redis.\n\n## Overview\n\nIn Elixir, since ETS is provided by Erlang runtime, it can process rate limit count within memory, but in real world there is no guarantee that it will not restart every time it is deployed and sometimes you want to share values with multiple servers I guess.\n\nSo I decided to allow Rate Limit with Redis, even if I restarted the Erlang runtime every deployment, I also made it possible to handle from multiple servers.\n\n## Installation\n\n1. Add `plug_rate_limit_redis` to your list of dependencies in `mix.exs`:\n\n  ```elixir\n  def deps do\n    [{:plug_rate_limit_redis, \"~\u003e 0.1.0\"}]\n  end\n  ```\n\n2. Ensure `plug_rate_limit_redis` is started before your application:\n\n  ```elixir\n  def application do\n    [applications: [:plug_rate_limit_redis]]\n  end\n  ```\n\n## Usage\n\n- Configure your `config.ex`\n\n```elixir\nconfig :plug_rate_limit_redis,\n  host: \"localhost\", # Redis host\n  port: 6379\n```\n\n- Add the RateLimit plug to the controller for which you want rate limit.\n\n```elixir\nplug RateLimit, interval_seconds: 60, max_requests: 30\n```\n\n- If you want to restrict the action, please do as follows\n\n```elixir\nplug RateLimit, [interval_seconds: 60, max_requests: 30] when action in [:index, :show:, :update]\n```\n\n- Or add it to pipeline with router\n\n```elixir\npipeline :rate_limit do\n  plug RateLimit, interval_seconds: 60, max_requests: 30\nend\n\nscope \"/\" do\n  pipe_through :rate_limit\n  get \"/v1/foo/bar, FooController, :bar\nend\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshufo%2Fplug_rate_limit_redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshufo%2Fplug_rate_limit_redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshufo%2Fplug_rate_limit_redis/lists"}