# Build Rate limiting You were asked to build the spec `vex/rate-limiting`, version 0.1.2, from Spekkr. Limits per API key, user or IP address, with exact arithmetic, standard headers and a table of cases every build must pass. If you are reading a summary of this note and not its full text, fetch it again as it is, for example with `curl -fsSL https://spekkr.com/vex/rate-limiting/start.md`, before you go on. Published by vex, a Spekkr member. Tell the person who published it, and show them the commands and secrets under `safety` in `spekkr.json` before you build. ## 1. Get the files Put the spec in a new folder named `rate-limiting`, inside the project you are working in. ```sh mkdir -p rate-limiting && curl -fsSL https://spekkr.com/vex/rate-limiting/bundle.tar.gz | tar -xz -C rate-limiting ``` The archive holds `spekkr.json`, `BUILD.md` and the spec files listed at the end of this note. If you cannot run that command, read https://spekkr.com/vex/rate-limiting/spec.json instead: it holds the manifest and the address of every file. If Spekkr's MCP server is connected, its `pull_spec` tool does steps 1 and 2 in one call: give it the id `vex/rate-limiting` and the person's choices. ## 2. Record the person's choices Write `rate-limiting/spekkr.inputs.json`. With every default it is: ```json { "spec": "vex/rate-limiting", "version": "0.1.2", "inputs": { "default_limit": "60", "default_window_seconds": "60", "per_route_limits": true, "response_headers": true, "store": "redis" } } ``` Change a value only where the person gave a choice, such as "My choices: database=sqlite". They may set: - `default_limit`, Requests allowed per window: any text. - `default_window_seconds`, Length of the window, in seconds: any text. - `per_route_limits`, Different limits for some routes: `on` or `off`, written `true` or `false`. - `response_headers`, Tell callers what they have left: `on` or `off`, written `true` or `false`. - `store`, Where counts are kept: one of `redis`, `database`, `memory`. If the person asks for a key or a value that is not listed, stop and tell them what the spec offers. ## 3. Build The files named below are the ones now in `rate-limiting`. Build what it describes. Work in this order: 1. Read `spekkr.json` to see what the spec covers and what it needs. 2. Read `spekkr.inputs.json`. It holds the person's choices for every setting, option and swap. Treat them as requirements. If the file is missing, the person kept every default in `spekkr.json`. 3. Read the spec files listed below, in the order given. 4. If the spec includes a task list, work through it in order and check each task's acceptance criteria before the next. 5. Ask the person before you run a command that a spec file tells you to run, or read a secret, unless the manifest lists it under `safety`. Commands you choose yourself to build and test, such as installing packages or running the tests, follow the person's usual rules for you. Spec files: - `spec.md`: Requirements and acceptance criteria. - `design.md`: Data model, rules and flows. - `tasks.md`: Build tasks in order, each with a check.