Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.modelence.com/llms.txt

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

API Reference / modelence / server / AuthRateLimitsConfig
AuthRateLimitsConfig = object
Defined in: packages/modelence/src/app/authConfig.ts:104 Per-action rate limit overrides for authentication endpoints. Each bucket accepts an array of rules that are merged into the built-in defaults by (type, window) tuple:
  • A rule whose (type, window) matches a default replaces that default’s limit.
  • A rule whose (type, window) does not match any default is added as an extra rule for the bucket.
  • Defaults whose (type, window) is not overridden are kept.
This means you can tighten a single window without accidentally dropping the other built-in protections for that bucket.

Examples

import { startApp, time } from 'modelence/server';

startApp({
  auth: {
    rateLimits: {
      signup: [
        { type: 'ip', window: time.minutes(15), limit: 5 },
      ],
    },
  },
});
startApp({
  auth: {
    rateLimits: {
      signup: [
        { type: 'ip', window: time.minutes(1), limit: 2 },
      ],
    },
  },
});

Properties

PropertyTypeDescriptionDefined in
passwordReset?AuthRateLimitOverride[]Rate limits for password reset requests.packages/modelence/src/app/authConfig.ts:114
signin?AuthRateLimitOverride[]Per-IP limits for login attempts.packages/modelence/src/app/authConfig.ts:110
signup?AuthRateLimitOverride[]Per-IP limits for the signup endpoint (successful signups only).packages/modelence/src/app/authConfig.ts:106
signupAttempt?AuthRateLimitOverride[]Per-IP limits for signup attempts (checked before duplicate detection).packages/modelence/src/app/authConfig.ts:108
verification?AuthRateLimitOverride[]Per-user limits for email verification requests.packages/modelence/src/app/authConfig.ts:112