On this page

Installation

Install hitlimit using your preferred package manager.

Install the Package

npm install @joint-ops/hitlimit
# or: pnpm add @joint-ops/hitlimit
# or: yarn add @joint-ops/hitlimit
bun add @joint-ops/hitlimit-bun

The hitlimit-bun package is optimized specifically for Bun and includes native SQLite store support out of the box.

Verify Installation

Create a test file to verify the installation:

test.ts
import { hitlimit } from '@joint-ops/hitlimit-bun'

const limiter = hitlimit({ limit: 10, window: '1m' })

console.log('hitlimit-bun installed successfully!')

Run the test:

bun run test.ts

Optional Store Packages

Install additional stores as needed:

Redis Store

Install the ioredis peer dependency to use the Redis store:

npm install ioredis
# or: pnpm add ioredis
bun add ioredis

SQLite Store

npm install better-sqlite3
# or: pnpm add better-sqlite3
# Built-in! Bun includes bun:sqlite natively.
# No additional package needed.

Requirements

  • Node.js: v18.0.0 or higher
  • TypeScript: v5.0 or higher (optional)
  • Bun: v1.0.0 or higher
  • TypeScript: v5.0 or higher (optional but recommended)

Next Steps

Now that you have hitlimit installed, head over to the Quick Start guide to set up your first rate limiter.

Now that you have hitlimit-bun installed, proceed to the Quick Start guide.