View Source Hammer, a Rate-Limiter for Elixir

Hammer is a rate-limiter for the Elixir language. It's killer feature is a pluggable backend system, allowing you to use whichever storage suits your needs. Currently, backends for ETS, Redis, and Mnesia are available.

    case Hammer.check_rate("file_upload:#{user_id}", 60_000, 10) do
      {:allow, _count} ->
        Upload.file(data)
      {:deny, _limit} ->
        render_error_page()
    end

To get started with Hammer, read the Tutorial.

See the Hammer.Application module for full documentation of configuration options.

A primary goal of the Hammer project is to make it easy to implement new storage backends. See the documentation on creating backends for more details.

New! Hammer-Plug

We've just released a new helper-library to make adding rate-limiting to your Phoenix (or other plug-based) application even easier: Hammer.Plug.