Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AmeyaBorkar/throttlekit/llms.txt

Use this file to discover all available pages before exploring further.

ThrottleKit is published to npm as a single package with zero runtime dependencies. Peer dependencies are optional — install only what your chosen stores and adapters actually use.

Package manager

npm install throttlekit

Node.js requirement

ThrottleKit requires Node.js ≥ 18. The Web fetch adapter additionally runs on Cloudflare Workers, Deno, and Bun with no changes.
All CI is run against Node 20, 22, and 24. Node 18 is the minimum supported version because it ships the Web fetch API natively.

Zero runtime dependencies

The core package and all framework adapters ship with zero runtime dependencies. No transitive packages are installed unless you opt in to a peer dep for a specific store or adapter.
This means npm install throttlekit adds exactly one entry to your node_modules — ideal for edge runtimes and Lambda functions where cold-start size matters.

Optional peer dependencies

Install peer dependencies only for the backends and frameworks you use. Everything else remains optional.
Peer dependencyWhen you need itSubpath
ioredisRedis store with ioredis clientthrottlekit/redis
node-redisRedis store with node-redis clientthrottlekit/redis
pgPostgres storethrottlekit/postgres
expressExpress middleware adapterthrottlekit/express
fastifyFastify plugin adapterthrottlekit/fastify
honoHono middleware adapterthrottlekit/hono
koaKoa middleware adapterthrottlekit/koa
nextNext.js API route adapterthrottlekit/next
@nestjs/commonNestJS guard adapterthrottlekit/nest
@sveltejs/kitSvelteKit hook adapterthrottlekit/sveltekit
@remix-run/nodeRemix loader/action adapterthrottlekit/remix
elysiaElysia plugin adapterthrottlekit/elysia
@aws-sdk/client-dynamodbDynamoDB storethrottlekit/dynamodb
Installing a peer dependency for a store you do not use has no effect on the core package.

ESM and CJS support

ThrottleKit ships both ESM and CommonJS builds with full TypeScript declarations (.d.ts and .d.cts) for every entry point. Tree-shaking works out of the box with any modern bundler.
// ESM (recommended)
import { rateLimit, gcra } from "throttlekit";

// CommonJS
const { rateLimit, gcra } = require("throttlekit");
The ESM/CJS resolution matrix across all 24 subpaths is mechanically verified by attw and publint on every push.

Subpath entry points

ThrottleKit exports 24 subpath entry points, each tree-shakeable and independently typed. Import only what you use.
Entry pointContents
throttlekitCore: rateLimit, all strategies, MemoryStore, ManualClock, types
throttlekit/redisRedisStore (ioredis, node-redis, Upstash REST)
throttlekit/postgresPostgresStore
throttlekit/dynamodbDynamoDBStore
throttlekit/denoDenoKvStore
throttlekit/cloudflareDurableObjectStore, D1Store, KVStore
throttlekit/expressexpressRateLimit middleware
throttlekit/fastifyfastifyRateLimit plugin
throttlekit/koakoaRateLimit middleware
throttlekit/honohonoRateLimit middleware
throttlekit/nextnextRateLimit for API routes and App Router
throttlekit/nestThrottleGuard for NestJS
throttlekit/sveltekitsveltekitRateLimit hook
throttlekit/remixremixRateLimit for loaders and actions
throttlekit/elysiaelysiaRateLimit plugin
throttlekit/fetchwithRateLimit for Web fetch (Cloudflare, Deno, Bun, Next edge)
throttlekit/lambdalambdaRateLimit for AWS Lambda
throttlekit/trpctrpcRateLimit middleware
throttlekit/grpcgrpcRateLimit interceptor
throttlekit/twotiertwoTier, LeaseSpender, weightedFairEscrow, leaseSizer
throttlekit/federationfederate, GlobalCoordinator, RedisCoordinator
throttlekit/otelOpenTelemetry metrics integration
throttlekit/configbuildStrategy and config-file loader utilities
throttlekit/policyplan, policySet, assertPlanAcceptable (experimental)
throttlekit/testkitrecordLimiter, replay, ManualClock test utilities
The throttlekit/policy and throttlekit/testkit subpaths are experimental and may change shape in a minor release. Pin an exact version if you depend on them in CI.

Verifying your install

After installation, verify the package resolves correctly:
import { version } from "throttlekit";
console.log(version); // e.g. "1.0.0"
Or run the in-memory quickstart to confirm everything is working:
import { rateLimit, gcra } from "throttlekit";

const limiter = rateLimit({ strategy: gcra({ limit: 5, periodMs: 1_000 }) });
const d = limiter.checkSync("test");
console.log(d.allowed, d.remaining); // true, 4

Build docs developers (and LLMs) love