Limitly
Getting Started

Introduction

Everything you need to know about Limitly. A TypeScript-first rate limiting SDK for Node.js and browsers with Redis-backed distributed rate limiting.

Introduction to Limitly

Limitly is a TypeScript-first rate limiting SDK for Node.js and browsers. Redis-backed distributed rate limiting with zero configuration.

What is Rate Limiting?

Rate limiting controls traffic to prevent abuse, ensure fair usage, and maintain service availability.

Key Features

  • Zero Configuration: Get started instantly with sensible defaults
  • Redis-Backed: Distributed rate limiting across multiple servers
  • Bring Your Own Redis: Recommended for production - full tenant isolation
  • TypeScript First: Full type safety and IDE autocomplete
  • Flexible: Customize limits per user, endpoint, or use case
  • Production Ready: Error handling, timeouts, and best practices built-in
import { createClient } from 'limitly-sdk';

// Recommended: Use your own Redis for production
const client = createClient({
  redisUrl: process.env.REDIS_URL || 'redis://localhost:6379',
  serviceId: 'my-app'
});

const result = await client.checkRateLimit('user-123');

if (result.allowed) {
  console.log(`Remaining: ${result.remaining}`);
}

// Without redisUrl (development/testing only)
// ⚠️ Shares hosted Redis - may collide with other users using same serviceId
// const client = createClient({ serviceId: 'my-app' });

Use Cases

  • API Protection: Protect REST/GraphQL APIs from abuse
  • User Tiers: Different limits for free/premium/enterprise users
  • Endpoint Limits: Custom limits per endpoint based on resource usage
  • Bot Protection: Prevent automated attacks with strict IP-based limits

How It Works

Limitly uses the Token Bucket Algorithm:

  • Each identifier gets a bucket with maximum capacity
  • Requests consume tokens; tokens refill at a constant rate
  • Allows smooth traffic with burst handling

Getting Started

  1. Install: npm install limitly-sdk
  2. Use: const client = createClient({ redisUrl: 'redis://localhost:6379' }); await client.checkRateLimit('user-123');

See Installation for setup or Quick Start for examples.