v1.3.0 — Valkey & DragonflyDB support

The fastest way to rate limit

One library for Node.js and Bun. Express, Fastify, Hono, NestJS, Bun.serve, Elysia. Sub-millisecond performance, zero dependencies.

MIT License TypeScript-first Zero dependencies
server.ts
import { hitlimit } from '@joint-ops/hitlimit'
import express from 'express'

const app = express()

app.use(hitlimit({
  limit: 100,
  window: '1m'
})) // That's it!
$ npm i @joint-ops/hitlimit

One library, every runtime

Works out of the box with Node.js and Bun. Same API, same performance, same simplicity.

Not sure which to use? Both share the same API. Start with your runtime and switch anytime.

0.0M+
ops/sec
Node.js (10K IPs)
0.0M+
ops/sec
Bun (10K IPs)
<0ms
Latency
p95 response time
0
Dependencies
for core module

Real benchmarks

Tested on Apple M1. Run them yourself →

Store Node.js Bun Best For
Memory
3.16M ops/s 8.32M ops/s Highest throughput
SQLite
352K ops/s 325K ops/s Persistent storage
Redis
6.7K ops/s 6.7K ops/s Distributed
Postgres
3.0K ops/s 3.7K ops/s Distributed (SQL)

10K unique IPs. Node.js v24 / Bun v1.3.7, Apple M1. Redis is network-bound. Our benchmarks — done our best to keep them fair. Full results → · Run them yourself

Built for SaaS

Tiered limits in 8 lines, not 25

Competitors require 20+ lines of manual routing for Free/Pro/Enterprise tiers. hitlimit does it in 8 lines with built-in tier support.

Before
express-rate-limit
// Create separate limiters for each tier
const freeLimiter = rateLimit({
  windowMs: 60 * 60 * 1000, // 1 hour?
  max: 100
})

const proLimiter = rateLimit({
  windowMs: 60 * 60 * 1000,
  max: 5000
})

const enterpriseLimiter = rateLimit({
  windowMs: 60 * 60 * 1000,
  max: 100000
})

// Manual routing logic
app.use((req, res, next) => {
  const tier = getUserTier(req)
  if (tier === 'enterprise') {
    return enterpriseLimiter(req, res, next)
  } else if (tier === 'pro') {
    return proLimiter(req, res, next)
  }
  return freeLimiter(req, res, next)
})
25 lines Manual tier logic Milliseconds
After
hitlimit — Node.js & Bun
// Works with Express, Fastify, Hono, Bun.serve, Elysia...
hitlimit({
  tiers: {
    free: { limit: 100, window: '1h' },
    pro: { limit: 5000, window: '1h' },
    enterprise: { limit: Infinity }
  },
  tier: (req) => req.user?.plan || 'free'
})
7 lines Built-in tiers Human time Any runtime
3x less code for the same result

Everything you need to protect your APIs

Built for performance, designed for developers. Rate limiting that doesn't slow you down.

Every Runtime

First-class support for Node.js (4.8M ops/sec) and Bun (12.3M ops/sec). Same API, same config. One library for every JavaScript runtime.

Zero Config

One line to start. Sensible defaults for everything. Human-readable time windows like '15m' and '1h'.

Tiny Bundle

~8KB core (Node.js) / ~18KB (Bun). Tree-shakeable. Zero runtime dependencies.

Tiered Limits

Free, Pro, Enterprise tiers built-in. No extra code needed. Perfect for SaaS applications.

8 Framework Adapters

Express, Fastify, Hono, NestJS, Node.js HTTP, Bun.serve, Elysia. Built-in adapters that work out of the box.

Fail Safe

Per-request error handling. Decide fail-open or fail-closed for each endpoint. Critical routes stay protected.

How hitlimit compares

Honest feature comparison. We show what we don't have yet, too.

Feature hitlimit express-rate-limit rate-limiter-flexible @nestjs/throttler
Framework adapters 8 built-in 1 DIY 1
Human time windows '15m' 900000 900 60000
Tiered limits (SaaS) Built-in Manual Manual Per-route
Bun native support bun:sqlite
Auto-ban on abuse
Storage backends 4 5 14 2
Standard headers Both Both Manual Legacy
MongoDB / Postgres stores Postgres External
Weighted requests Planned
Built-in
Manual External / DIY
Planned On roadmap