Modern rate limiting
for APIs & SaaS
Drop-in middleware with safe defaults, observability hooks, and distributed storage support. Works the same in Python and TypeScript.
from fastapi import FastAPI
from halt import RateLimiter, InMemoryStore, presets
from halt.adapters.fastapi import HaltMiddleware
app = FastAPI()
limiter = RateLimiter(
store=InMemoryStore(),
policy=presets.PUBLIC_API # 100 req/min
)
app.add_middleware(HaltMiddleware, limiter=limiter)Halt at work
Halt checks each request, forwards valid traffic, and blocks excessive calls before they hit your handlers.
Client
fetch("/api/data", {
headers: { "x-api-key": "team_pro_key" }
});Halt Middleware
const limiter = new RateLimiter({...});
app.use(haltMiddleware(limiter));API Server
app.get("/api/data", async (req, res) => {
return res.json({ ok: true });
});Accepted 1 rapid requests
Live logs
12:41:01 req_id=8f1 user=team_pro check=pass remaining=3
12:41:01 forwarded=true target="/api/data" status=200 latency=25ms
Why Halt
Everything you need for reliable limits
Production-grade algorithms, storage, and telemetry in one toolkit.
4 Algorithms
Token Bucket, Fixed Window, Sliding Window, and Leaky Bucket.
6 Storage Backends
Memory, Redis, PostgreSQL, MongoDB, DynamoDB, Memcached.
SaaS-Ready
Quotas, penalties, plan-based limits, telemetry hooks.
High Performance
~100k req/s with minimal overhead and O(1) memory per key.
Framework Support
FastAPI, Flask, Django, Express, Next.js adapters built-in.
Smart Defaults
Health-check exemptions, private IP allowlist, RateLimit-* headers.
Supported stack
Frameworks, storage, and algorithms
Everything you need is grouped below with direct links and compact summaries.
Frameworks
5 itemsStorage Backends
6 itemsReady to protect your API?
Install Halt and add bulletproof rate limiting to any service.