As reported: Okta (Auth0) Staff Backend Engineer loop (Oct 2026). Take-home on CodeSignal with a 24-hour window, Node.js only: build a rate limiter using the token-bucket algorithm — an Express app that reads a config file and exposes an API returning rate-limit responses. The next technical round opened with a code review of the submission ("why is it structured this way?").
Build a small Node.js service with Express:
- On start-up, read a configuration file that defines the rate limits (for example, per endpoint or per client: bucket capacity and refill rate).
- Implement a token bucket per limited key: each request takes one token; tokens refill continuously at the configured rate up to the capacity.
- Expose an API that applies the limiter and returns the rate-limit result — success while tokens remain, and a rate-limited response once the bucket is empty.
- Be ready to walk a reviewer through the structure of the code and the choices behind it.
Clarifications
- The config format, the exact keys being limited and the response bodies are open: define them in a README and stay consistent.
- The standard signal for "limited" is HTTP
429 Too Many Requests; headers such asRetry-After/X-RateLimit-Remainingmake the response useful to clients.