Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Elixir
  3. hammer

hammer

MITElixir

An Elixir rate-limiter with pluggable backends and multiple algorithms for API requests, file uploads, and more.

Visit WebsiteGitHubGitHub
923 stars50 forks0 contributors

What is hammer?

Hammer is an Elixir library for implementing rate limiting in applications. It allows developers to set limits on actions like API requests or file uploads within specific time windows, helping to prevent abuse and manage resource usage. The library supports multiple storage backends and rate-limiting algorithms to accommodate different performance and precision needs.

Target Audience

Elixir developers building web APIs, microservices, or any application that requires controlled access to resources, such as SaaS platforms, gaming backends, or network services.

Value Proposition

Developers choose Hammer for its pluggable architecture, which allows them to select the most suitable backend and algorithm for their use case, from simple fixed windows to precise sliding windows, all within a unified Elixir-native interface.

Overview

An Elixir rate-limiter with pluggable backends

Use Cases

Best For

  • Enforcing API rate limits per user or IP address
  • Controlling file upload frequency in web applications
  • Implementing traffic shaping for network services
  • Preventing abuse in gaming or chat systems
  • Managing resource access in distributed Elixir applications
  • Applying different rate-limiting algorithms (e.g., Token Bucket for burst tolerance)

Not Ideal For

  • Projects needing out-of-the-box integration with web frameworks like Phoenix without custom middleware development
  • Applications requiring managed, cloud-native rate limiting services with built-in dashboards and auto-scaling
  • Teams preferring a single, pre-configured algorithm and backend with minimal decision overhead
  • Environments where rate limiting must be implemented across multiple programming languages simultaneously

Pros & Cons

Pros

Flexible Backend Options

Supports ETS, Atomic, Redis, and Mnesia backends, allowing developers to choose between single-node speed (e.g., ETS default) or distributed scalability (e.g., Redis) based on deployment needs, as detailed in the backend documentation.

Multiple Algorithm Support

Implements Fixed Window, Leaky Bucket, Token Bucket, and Sliding Window algorithms, providing precise control for different use cases like burst tolerance or smooth traffic, with a comparison guide in the README to aid selection.

Performance-Optimized Design

Offers atomic backends for high-speed single-node operations and includes benchmarks in BENCHMARKS.md, demonstrating efficiency for scenarios like API rate limiting with minimal overhead.

Comprehensive Documentation

Well-documented with tutorials, guides (e.g., distributed ETS), and Hexdocs, making it easier for developers to implement features like sliding windows or distributed setups without guesswork.

Cons

Limited Sliding Window Availability

Sliding window algorithm is only available for the ETS backend, restricting its use in distributed setups with Redis or Mnesia where precision might be needed, as shown in the algorithm-backend compatibility table.

Complex Distributed Setup

Using distributed backends like Redis requires additional dependencies (e.g., separate hammer-backend-redis package) and configuration, adding overhead compared to simpler, all-in-one rate limiting solutions.

Default Algorithm Edge Cases

The default fixed window algorithm has boundary issues allowing up to 2x requests at window edges, requiring manual workarounds like bursty counters, which the README admits and suggests implementing with extra checks.

Frequently Asked Questions

Quick Stats

Stars923
Forks50
Contributors0
Open Issues0
Last commit20 hours ago
CreatedSince 2017

Tags

#elixir-lang#elixir#redis#phoenix#phoenix-framework#distributed-systems#mnesia#ets#backend#rate-limiting#api-protection#rate-limiter

Built With

E
ETS
M
Mnesia
E
Elixir
R
Redis

Links & Resources

Website

Included in

Elixir13.1k
Auto-fetched 13 hours ago

Related Projects

AtomVMAtomVM

Tiny Erlang VM

Stars2,272
Forks173
Last commit1 day ago
porcelainporcelain

Work with external processes like a boss

Stars958
Forks45
Last commit5 years ago
cubdbcubdb

Elixir embedded key/value database

Stars658
Forks34
Last commit2 years ago
ex_ratedex_rated

ExRated, the Elixir OTP GenServer with the naughty name that allows you to rate-limit calls to any service that requires it.

Stars458
Forks50
Last commit3 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub