Challenges

Real backend engineering problems inspired by production systems. Write and execute real code.

Difficulty
Category
FREE
MediumAPI Design

Rate Limiter for API Gateway

Design a sliding window rate limiter for an API gateway handling 1M+ requests/min. Must be thread-safe with O(1) allow() and support 10K+ concurrent clients.

Sliding windowThread safetyConcurrency
func (rl *RateLimiter) Allow(clientID string) bool {
    rl.mu.Lock()
    defer rl.mu.Unlock()
    sw := rl.getWindow(clientID)
    now := time.Now()
    sw.removeExpired(now, rl.window)
    if len(sw.timestamps) >= rl.rate {
        return false
    }
    sw.timestamps = append(sw.timestamps, now)
    return true
}
GoPythonJavaNode.js4 tests
FREE
MediumAPI Design / Microservices

Build a Backend-for-Frontend (BFF)

Build a BFF that aggregates data from 3 downstream microservices in parallel with timeouts, error isolation, and request tracing. Failed sections degrade gracefully instead of crashing the page.

Fan-out/fan-inGraceful degradationRequest tracing
func handleHomePage(w http.ResponseWriter, r *http.Request) {
    ctx, cancel := context.WithTimeout(r.Context(), 500*time.Millisecond)
    defer cancel()
    sections := fetchAll(ctx, services, requestID)
    json.NewEncoder(w).Encode(PageResponse{Sections: sections})
}
GoPythonJava6 tests
PRO
MediumDistributed Systems

A/B Experiment System

Build an experiment evaluation service with deterministic user-to-variant assignment using FNV-1a hashing, traffic allocation buckets, and attribute-based targeting rules.

Consistent hashingFeature flagsTraffic splitting
func assignVariant(expID, userID string, variants []Variant) string {
    h := fnv.New32a()
    h.Write([]byte(expID + userID))
    bucket := int(h.Sum32()) % 100
    // Map bucket to variant via traffic allocation
}
GoPythonJava8 tests
PRO
HardDistributed Systems

API Gateway with Resilience Middleware

Build a middleware chain with sliding window rate limiter (100 req/min), circuit breaker (5 failures → open), and semaphore-based load shedder (50 concurrent max).

Circuit breakerLoad sheddingMiddleware composition
// Middleware chain order matters:
// Request → Rate Limiter → Load Shedder → Circuit Breaker → Upstream
handler := Chain(proxy,
    rl.Middleware(),   // cheapest check first
    ls.Middleware(),   // protect server resources
    cb.Middleware(),   // protect upstream service
)
GoPythonJava9 tests
PRO
MediumAPI Design / Security

Passport-Based Auth Gateway

Build an auth gateway that validates JWTs once, creates a base64-encoded passport with user claims, and propagates it downstream. Supports idempotency keys and proxy state for cache optimization.

JWT validationPassport patternIdempotency keys
func (p Passport) Encode() string {
    data, _ := json.Marshal(p)
    return base64.StdEncoding.EncodeToString(data)
}
// X-Passport: eyJ1c2VyX2lkIjoidXNlcl8xMjMi...
// X-Proxy-State: base64(status:sub:country:platform)
GoPythonJava10 tests