Hammer.Plug v1.0 - Easy rate-limiting for Phoenix (and other plug apps)

Hammer is a rate-limiter for Elixir, with pluggable storage backends.

Hammer.Plug is a plug helper which lets you easily add rate-limiting to Phoenix applications, or any Elixir system that uses plug.

Example:

# Allow ten uploads per 60 seconds
plug Hammer.Plug, [
  rate_limit: {"video:upload", 60_000, 10},
  by: {:session, :user_id}
] when action == :upload_video_file

def upload_video_file(conn, _opts) do
  # ...
end
8 Likes