Nest

Active problem-solving

Practice Prompts

Try it before you reveal. Each coding, algorithm, and system-design prompt unfolds in stages — approach, then solution — so you practice retrieval, not recognition. Mark what you solved; revisit the rest.

Solved 0 / 26
Level
  1. CodeMid

    Paginated REST endpoint with validation + auth

    NestJSvalidationguards

    Build GET /users?page=1&limit=20 that is JWT-protected, validates query params, and returns a paginated result. Show the controller, the query DTO, and how the guard/pipe are wired.

    next: new
  2. CodeSenior

    Custom RolesGuard with the Reflector

    NestJSauthRBAC

    Implement a @Roles('admin') decorator and a RolesGuard that reads required roles from route metadata and compares them to request.user.roles. Make method-level roles override class-level.

    next: new
  3. CodeSenior

    Retry with exponential backoff + jitter

    Noderesilience

    Write retry(fn, { retries, baseMs }) that retries a failing async function with exponential backoff and jitter, only retrying transient errors, and gives up after N attempts.

    next: new
  4. CodeMid

    In-memory LRU cache (O(1))

    Nodedata structures

    Implement an LRU cache with O(1) get and set and a max capacity that evicts the least-recently-used entry.

    next: new
  5. CodeSenior

    Async pool with a concurrency limit

    Nodeasync

    Process 10,000 items by running an async worker(item) with at most N in flight at once (a bounded Promise.all). Why not just Promise.all(items.map(worker))?

    next: new
  6. CodeMid

    Response-envelope TransformInterceptor

    NestJSinterceptorsRxJS

    Write an interceptor that wraps every successful response in { data, timestamp } without each handler knowing about it.

    next: new
  7. CodeSenior

    Stream a large file with backpressure

    Nodestreams

    Serve a multi-GB file as a gzipped download without loading it into memory, and make sure errors and resources are handled.

    next: new
  8. CodeSenior

    Redis token-bucket rate limiter

    NodeRedisrate limiting

    Implement a distributed token-bucket limiter (refill rate R, capacity C) that's correct across multiple app instances. Why must it be atomic?

    next: new
  9. CodeSenior

    Fix GraphQL N+1 with DataLoader

    NestJSGraphQLperformance

    A Post.author field resolver runs one query per post over a list of 50 posts (1+50 queries). Fix it with DataLoader and explain the two classic bugs.

    next: new
  10. CodeSenior

    Graceful shutdown for a Nest service

    NestJSops

    Implement graceful shutdown so a SIGTERM (k8s rollout) drains in-flight requests and closes resources before exit.

    next: new
  11. DesignArchitect

    Design a multi-tenant SaaS API

    architecturemulti-tenancy

    Design the backend for a B2B SaaS where each tenant's data must be isolated. Cover the isolation model, tenant resolution, and how you prevent cross-tenant leakage.

    next: new
  12. DesignArchitect

    Design an event-driven order pipeline

    architecturemicroservicesmessaging

    An order flows through payment, inventory, and shipping — separate services. Design it for reliability: no double charges, no lost orders, consistent state.

    next: new
  13. DesignArchitect

    Design auth across an API gateway + microservices

    architectureauthmicroservices

    You have a gateway and several backend services. Where do you authenticate and authorize, and how do downstream services trust the caller?

    next: new
  14. DesignSenior

    Design caching for a read-heavy endpoint

    architecturecachingperformance

    A product-detail endpoint gets 50k RPS, 99% reads, data changes a few times a day. Design the caching so it's fast, fresh enough, and survives a cache miss storm.

    next: new
  15. DesignArchitect

    Design idempotent payment processing

    architectureresilience

    Clients retry on timeout, so a “charge card” request can arrive twice. Design the API + storage so a customer is never double-charged.

    next: new
  16. DesignSenior

    Design observability for a Nest service

    architectureobservability

    You're on call for a Nest API and latency just spiked. Design the observability you'd want in place to diagnose it in minutes, not hours.

    next: new
  17. CodeSenior

    Implement Promise.all from scratch

    Nodeasyncpromises

    Reimplement Promise.all(promises): resolve to an array of results in input order, reject as soon as any input rejects (fail-fast), and resolve to [] for an empty array. Don't use the built-in.

    next: new
  18. CodeSenior

    Implement a custom EventEmitter

    Nodeeventspatterns

    Build an EventEmitter with on, off, once, and emit. A once listener fires exactly one time then removes itself. What breaks if a listener calls off during emit?

    next: new
  19. CodeSenior

    Implement a promise pool (concurrency limit)

    Nodeasyncconcurrency

    Write promisePool(thunks, limit) that runs at most N async tasks at once and returns results in input order. Tasks are thunks (() => Promise), not promises — why does that matter?

    next: new
  20. CodeSenior

    Implement an LRU cache with a Map

    Nodedata structurescaching

    Implement an O(1) LRU cache (get/put, fixed capacity) using only a JS Map — no hand-rolled linked list. How does Map give you the recency order for free?

    next: new
  21. CodeSenior

    Implement an in-process token-bucket limiter

    Noderate limitingalgorithms

    Build a token-bucket rate limiter: capacity C, refill rate R tokens/sec, tryRemove() returns true (allow) or false (→ 429). No setInterval. How do you refill without a timer?

    next: new
  22. CodeSenior

    Implement retry with backoff + jitter

    Noderesilienceasync

    Write retry(fn, retries, baseMs) that retries a failing async call with exponential backoff plus jitter, and rethrows the last error after attempts are exhausted.

    next: new
  23. CodeSenior

    Implement debounce and throttle

    Nodeasyncpatterns

    Implement debounce(fn, wait) and throttle(fn, wait). Explain the difference, and make sure both preserve this and the arguments.

    next: new
  24. DesignSenior

    Design a job queue with retries + dead-letter

    architecturemessagingresilience

    Design a background job queue: producers enqueue work, workers process it, transient failures retry, and permanently-failing jobs land somewhere safe instead of blocking the queue.

    next: new
  25. DesignSenior

    Design a multi-channel notification system

    architecturemessagingscalability

    Design a system that sends notifications across email, SMS, and push. It must not double-send on retry, must survive a provider outage, and must fan a single event out to many recipients.

    next: new
  26. DesignSenior

    Design a distributed rate limiter

    architecturerate limitingRedis

    Design a rate limiter for an API behind N app instances: e.g. 100 requests/min per API key, enforced consistently no matter which instance a request hits. Return 429 with a Retry-After when exceeded.

    next: new