0.0
The project is in a healthy, maintained state
Plug-and-play API rate limiter with per-user/per-plan configs, Redis backend, Slack alerts and admin dashboard.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 6.0, < 8.0
>= 5.0
 Project Readme

RailsApiGuard

A pluggable, configurable rate limiting middleware for Rails APIs with Redis backend, Slack alerts, and endpoint exclusions.

🚀 Installation

Add this line to your application's Gemfile:

gem 'rails_api_guard'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rails_api_guard

Generate the Initializer

rails generate rails_api_guard:install

Middleware

Add this to application.rb if not used generator

config.middleware.use RailsApiGuard::Middleware::RateLimiter

Configuration

Edit config/initializers/rails_api_guard.rb to set request limits, expiry time, Slack alerts, and excluded endpoint patterns.

Slack Notifications

RailsApiGuard can optionally send Slack alerts whenever a request exceeds the defined rate limit threshold.

Configuration

To enable Slack alerts, set your Slack webhook URL in the initializer:

# config/initializers/rails_api_guard.rb
RailsApiGuard.configure do |config|
  config.slack_webhook_url = ENV["SLACK_WEBHOOK_URL"]
end

## Contributing
Contribution directions are yet to add.

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).