Rate-limit the links API

Overview

How it works

    Before / after

    A link-creation request passes the rate limiter
    flowchart LR
      n0["ShortenForm · 03"]
      n1["shorten() · 03"]
      n2["POST /links"]
      n3["rateLimit() · 02"]
      n4["clientKey() · 02"]
      n5["TokenBucket.take() · 01"]
      n6["RateLimitedError · 03"]
      n0 --> n1
      n1 --> n2
      n2 --> n3
      n3 --> n4
      n3 --> n5
      n5 -->|"429"| n6
      n6 -->|"countdown"| n0
      classDef added fill:#e6f4ea,stroke:#2d8a4e,color:#14361f
      class n0,n1,n3,n4,n5,n6 added
    Added or changed in this PRNumber = chapter that introduces it

    Chapters

      The guide explains intent and points at what to check. It is not a review: code it doesn't mention isn't verified.