Skip to content

feat: implement rate limiting #289

@tim-hm

Description

@tim-hm

Problem

With NUCs now supported client-side (browsers), nildb is now more exposed to high-volume traffic. Thus, we need to implement fair-use rate limiting to protect nodes from abuse and ensure service stability.

Proposed Solution

  • Start with an off the shelf rate limiting implementation like hono-rate-limiter
  • Apply limits both on both per-builder account and per IP
  • The rate limits (e.g., requests per second, burst capacity) should be configurable at the node level.
  • When a client exceeds the rate limit, the API should return a standard ⁠429 Too Many Requests HTTP status code.

Acceptance criteria

  • Requests from a single IP exceeding the configured rate are rejected with a ⁠429 error.
  • An aggregate of requests using the same builder did and exceeding the configured rate are rejected with a ⁠429 error.
  • The rate-limiting logic is enabled by default but can be configured or disabled via node settings.

  • The impact on performance for non-rate-limited requests is negligible.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions