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.
- CodeMid
Paginated REST endpoint with validation + auth
NestJSvalidationguardsBuild
GET /users?page=1&limit=20that 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 - CodeSenior
Custom RolesGuard with the Reflector
NestJSauthRBACImplement a
@Roles('admin')decorator and aRolesGuardthat reads required roles from route metadata and compares them torequest.user.roles. Make method-level roles override class-level.next: new - CodeSenior
Retry with exponential backoff + jitter
NoderesilienceWrite
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 - CodeMid
In-memory LRU cache (O(1))
Nodedata structuresImplement an LRU cache with O(1)
getandsetand a max capacity that evicts the least-recently-used entry.next: new - CodeSenior
Async pool with a concurrency limit
NodeasyncProcess 10,000 items by running an async
worker(item)with at most N in flight at once (a boundedPromise.all). Why not justPromise.all(items.map(worker))?next: new - CodeMid
Response-envelope TransformInterceptor
NestJSinterceptorsRxJSWrite an interceptor that wraps every successful response in
{ data, timestamp }without each handler knowing about it.next: new - CodeSenior
Stream a large file with backpressure
NodestreamsServe a multi-GB file as a gzipped download without loading it into memory, and make sure errors and resources are handled.
next: new - CodeSenior
Redis token-bucket rate limiter
NodeRedisrate limitingImplement a distributed token-bucket limiter (refill rate R, capacity C) that's correct across multiple app instances. Why must it be atomic?
next: new - CodeSenior
Fix GraphQL N+1 with DataLoader
NestJSGraphQLperformanceA
Post.authorfield 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 - CodeSenior
Graceful shutdown for a Nest service
NestJSopsImplement graceful shutdown so a SIGTERM (k8s rollout) drains in-flight requests and closes resources before exit.
next: new - DesignArchitect
Design a multi-tenant SaaS API
architecturemulti-tenancyDesign 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 - DesignArchitect
Design an event-driven order pipeline
architecturemicroservicesmessagingAn order flows through payment, inventory, and shipping — separate services. Design it for reliability: no double charges, no lost orders, consistent state.
next: new - DesignArchitect
Design auth across an API gateway + microservices
architectureauthmicroservicesYou have a gateway and several backend services. Where do you authenticate and authorize, and how do downstream services trust the caller?
next: new - DesignSenior
Design caching for a read-heavy endpoint
architecturecachingperformanceA 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 - DesignArchitect
Design idempotent payment processing
architectureresilienceClients retry on timeout, so a “charge card” request can arrive twice. Design the API + storage so a customer is never double-charged.
next: new - DesignSenior
Design observability for a Nest service
architectureobservabilityYou'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 - CodeSenior
Implement Promise.all from scratch
NodeasyncpromisesReimplement
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 - CodeSenior
Implement a custom EventEmitter
NodeeventspatternsBuild an
EventEmitterwithon,off,once, andemit. Aoncelistener fires exactly one time then removes itself. What breaks if a listener callsoffduringemit?next: new - CodeSenior
Implement a promise pool (concurrency limit)
NodeasyncconcurrencyWrite
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 - CodeSenior
Implement an LRU cache with a Map
Nodedata structurescachingImplement an O(1) LRU cache (
get/put, fixed capacity) using only a JSMap— no hand-rolled linked list. How doesMapgive you the recency order for free?next: new - CodeSenior
Implement an in-process token-bucket limiter
Noderate limitingalgorithmsBuild a token-bucket rate limiter: capacity C, refill rate R tokens/sec,
tryRemove()returns true (allow) or false (→ 429). NosetInterval. How do you refill without a timer?next: new - CodeSenior
Implement retry with backoff + jitter
NoderesilienceasyncWrite
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 - CodeSenior
Implement debounce and throttle
NodeasyncpatternsImplement
debounce(fn, wait)andthrottle(fn, wait). Explain the difference, and make sure both preservethisand the arguments.next: new - DesignSenior
Design a job queue with retries + dead-letter
architecturemessagingresilienceDesign 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 - DesignSenior
Design a multi-channel notification system
architecturemessagingscalabilityDesign 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 - DesignSenior
Design a distributed rate limiter
architecturerate limitingRedisDesign 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-Afterwhen exceeded.next: new