← All Learning Paths

API Gateway Engineer

Run the front door of your platform: routing, rate limiting, load shedding, request coalescing, and the 502s that tell you the gateway is doing its job badly.

roleintermediate6 nodes12.83h total

Path overview

网关是所有流量的第一现场,也是过载保护的最后一道闸。本路径从网关与 ingress 的边界讲起,依次落地限流、卸载与请求合并三种流量整形手段,最终亲手实现一个带完整观测的限流网关项目。

The gateway is the first stop for every request and the last gate before overload. This path covers gateway versus ingress boundaries, then rate limiting, load shedding, and request coalescing, ending with a gateway project.

  1. Read "How to Build a Rate Limiter in Node.js" for the "Choose an algorithm" argument, then name the decision in gateway work it would change.

    Completion criteria: Record a short walkthrough of "How to Build a Rate Limiter in Node.js" with timestamps at "Choose an algorithm" and "Design the key", plus the commit that applies it.

    Next step: Add Rate Limiting Middleware

    ⏱ 1h

  2. Apply "Add Rate Limiting Middleware" to a gateway task, checking that "req.ip reflects the client address appended by the trusted proxy." appears after the "Implement a fixed-window limiter keyed by client and route, with a cap on the map size and" step.

    Prerequisites: How to Build a Rate Limiter in Node.js

    Completion criteria: Run the steps through "Implement a fixed-window limiter keyed by client and route, with a cap on the map size and", paste the command output, and mark the line that matches "req.ip reflects the client address appended by the trusted proxy."; then rerun with one parameter changed.

    Next step: Add Load-Shedding Middleware

    ⏱ 0.5h

  3. Execute "Add Load-Shedding Middleware" end to end, then repeat the last step with one parameter changed and compare "Prevent an overload spike from collapsing latency for every request by bounding concurrency".

    Prerequisites: Add Rate Limiting Middleware

    Completion criteria: Deliver a transcript of "Add Load-Shedding Middleware" with each step's command and observed state, ending at "Prevent an overload spike from collapsing latency for every request by bounding concurrency".

    Next step: Coalesce Concurrent Requests for the Same Key

    ⏱ 0.5h

  4. Run "Prevent a hot key from stampeding the origin when it expires or is first requested under" from "Coalesce Concurrent Requests for the Same Key" and confirm the documented result "Concurrent calls for the same key share one promise and one origin request.".

    Prerequisites: Add Load-Shedding Middleware

    Completion criteria: Run "Coalesce Concurrent Requests for the Same Key" twice — once as written and once with a changed input — and attach both transcripts with the observed difference.

    Next step: Refill a Token Bucket Correctly

    ⏱ 0.5h

  5. Solve "Refill a Token Bucket Correctly" for gateway work: turn JSON object: { capacity, refillPerSecond, tokens, elapsedMs, cost } into {allowed:true,tokensAfter:2} and pass both samples.

    Completion criteria: Submit a solution for "API Gateway Engineer" that passes both samples ({capacity:10,refillPerSecond:2,tokens:1,elapsedMs:2000,cost: to {allowed:true,tokensAfter:2}) and attach the failing case you fixed.

    Next step: Build a Rate Limiting Reverse Proxy in Node.js

    ⏱ 0.33h

  6. Deliver the "Build a Rate Limiting Reverse Proxy in Node.js" blueprint with "Proxying streams request and response bodies without buffering the full payload in memory" working and "Token bucket and fixed window limiters selectable per route through a JSON config" recorded as evidence.

    Prerequisites: Refill a Token Bucket Correctly

    Completion criteria: Ship "Proxying streams request and response bodies without buffering the full payload in memory" and attach the test log plus a one-page acceptance note mapping the feature to the passing test.

    Next step: Apply this path in a capstone project and review the related resources.

    ⏱ 6h