iconDirEasy

Rate limiting

How to customize the rate limiting

You can customize the rate limits for upvotes and comments.

launch.ts
// Specific rate limits for different APIs
export const API_RATE_LIMITS = {
  SEARCH: {
    REQUESTS: 15, // 15 requêtes
    WINDOW: 60 * 1000, // par minute
  },
  DEFAULT: {
    REQUESTS: 10, // 10 requêtes
    WINDOW: 60 * 1000, // par minute
  },
} as const
 
// Limits for upvotes
export const UPVOTE_LIMITS = {
  ACTIONS_PER_WINDOW: 100, // Maximum number of upvote actions per time window
  TIME_WINDOW_MS: 5 * 60 * 1000, // Time window for rate limit (5 minutes)
  TIME_WINDOW_MINUTES: 5, // Time window for rate limit (5 minutes)
  MIN_TIME_BETWEEN_ACTIONS_MS: 2000, // Minimum time between two actions on the same project (2 seconds)
  MIN_TIME_BETWEEN_ACTIONS_SECONDS: 2, // Minimum time between two actions on the same project (2 seconds)
  DEBOUNCE_TIME_MS: 500, // Client-side debounce time (500ms)
  CLOSE_UPVOTE_AFTER_LAUNCH: true, // There is a voting time of one day after the product launched, which is recommended to be set to false for directory apps
} as const
 
// Limits for comments
export const COMMENT_LIMITS = {
  ACTIONS_PER_WINDOW: 5, // Maximum 5 comments per window
 
  TIME_WINDOW_MS: 10 * 60 * 1000, // 10 minute window
}

All these are customizable in the lib/constants.ts file.