django-smart-ratelimit: Flexible, high-performance rate-limiting for Django

Hi everyone!

I’m excited to share django-smart-ratelimit v0.3.2—a lightweight, context-aware rate-limiting library for Django apps.

Key features:

  • :white_check_mark: Per-view, per-user (or API key) and global limits
  • :high_voltage: Blazing speed via atomic Redis Lua scripts
  • :stopwatch: Fixed-window & sliding-window algorithms
  • :electric_plug: Pluggable backends: Redis, database, in-memory
  • :puzzle_piece: Decorator + middleware APIs
  • :bar_chart: Standard RateLimit headers (Limit/Remaining/Reset)

Getting started is easy:

pip install django-smart-ratelimit
from smart_ratelimit.decorators import ratelimit

@ratelimit(key='user', rate='100/h', block=True)
def my_view(request):
    return HttpResponse("Hello, rate-limited Django!")

:link: PyPI: https://pypi.org/project/django-smart-ratelimit/
:link: GitHub & full roadmap: https://github.com/YasserShkeir/django-smart-ratelimit

I’d love to hear:

  • Your use cases or integration tips
  • Any issues you encounter or features you’d like to see
  • Performance feedback in real-world workloads

Thanks for checking it out—looking forward to your thoughts and contributions!
— Yasser Shkeir

3 Likes

Wow that is really impressive. I used to create a dynamic global dictionary to store individual IPs and tract their rate of hits on API or Pages.

This would save me a lot of time.

1 Like

I’m pleased to announce the release of django‑smart‑ratelimit v0.8.0

What’s New in v0.8.0

  • Circuit Breaker Pattern: automatic failure detection and recovery across Memory, Redis, Database, MongoDB & multi‑backend setups

  • Exponential Backoff: adaptive retry delays on consecutive failures

  • Built‑in by Default: zero‑config protection with sensible defaults

  • Full Customization: override globally or per‑backend, or disable if needed

  • No Breaking Changes: fully backward compatible

Highlights

Install
pip install django‑smart‑ratelimit==0.8.0

Resources
• GitHub Repo → https://github.com/YasserShkeir/django-smart-ratelimit
• Discussions & Support → https://github.com/YasserShkeir/django-smart-ratelimit/discussions

I welcome your feedback, use‑cases, and any issues you encounter. Thanks for trying it out!

— Yasser Shkeir