Skip to content

DurableObjectRateLimitStore

Defined in: src/adapters/durable-object.ts:87

Rate limit store backed by a Durable Object.

Each rate limit key maps to a unique DO instance, providing strongly consistent atomic counters that survive Worker eviction and work across isolates.

import { DurableObjectRateLimitStore } from "@homegrower-club/stoma/adapters";
const store = new DurableObjectRateLimitStore(env.RATE_LIMITER);
rateLimit({ max: 100, store });

new DurableObjectRateLimitStore(namespace): DurableObjectRateLimitStore

Defined in: src/adapters/durable-object.ts:88

DurableObjectNamespace

DurableObjectRateLimitStore

increment(key, windowSeconds): Promise<{ count: number; resetAt: number; }>

Defined in: src/adapters/durable-object.ts:90

Increment the counter for a key, returning the new count and TTL

string

number

Promise<{ count: number; resetAt: number; }>

RateLimitStore.increment