Back to Blog
Halt logo
Blog Post

Introducing Halt

A practical rate-limiting toolkit for Python and TypeScript teams building reliable APIs.

The Halt Team

Why rate limiting matters

Rate limiting is one of the simplest controls you can add to improve security, stability, and fairness across your API.

Abuse protection

Reduce brute-force attempts, credential stuffing, and scraping traffic.

Fair usage

Keep shared resources fair across users, tenants, and API keys.

Service stability

Absorb spikes and avoid cascading failures in downstream systems.

Cost control

Prevent unexpected traffic from driving unpredictable infrastructure bills.

What Halt gives you

  • One mental model across Python and TypeScript.
  • Algorithm choices for burst, fairness, and shaping use-cases.
  • Storage flexibility for local dev and distributed production.
  • SaaS-ready building blocks like plan-based policies and quotas.

Quick examples

FastAPI

main.pypython
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
)

app.add_middleware(HaltMiddleware, limiter=limiter)

Express

server.tstypescript
import express from "express";
import { RateLimiter, InMemoryStore, presets } from "halt";
import { haltMiddleware } from "halt/express";

const app = express();

const limiter = new RateLimiter({
  store: new InMemoryStore(),
  policy: presets.PUBLIC_API,
});

app.use(haltMiddleware(limiter));

Plan-based policy selection

policy.tstypescript
import { getPlanPolicy } from "halt";

function policyForUser(plan: string) {
  return getPlanPolicy(plan);
}

When to use it

  • Public APIs with unknown client behavior.
  • Authentication and OTP endpoints.
  • Multi-tenant SaaS plans with usage tiers.
  • Any endpoint where you need predictable quality of service.

References

Get started

Install Halt and start with docs or examples:

pip install haltnpm install haltDocsExamples