Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
An e-commerce platform serves a Fastify product catalogue API that receives heavy, bursty traffic. During peak shopping events the service has experienced two recurring problems.
The first problem is thundering herd on popular products. When a product goes viral (e.g. a flash sale announcement), hundreds of concurrent requests arrive within milliseconds, all of which hit the database for the same product record. The database buckles under the load even though the data being fetched is identical for each request. Introducing a simple TTL cache helped somewhat, but during the burst window before the first request completes, all the subsequent requests still reach the database simultaneously.
The second problem is event loop saturation. Under sustained load the Node.js event loop latency climbs above one second. At that point the API is technically still running but is responding so slowly that clients time out and retry, making the situation worse. The ops team wants the service to detect this condition and shed incoming requests with an explicit 503 response rather than letting the event loop spiral.
Your task is to build a production-hardened version of the product catalogue API that addresses both problems. The service must include at least three routes: list all products (GET /products), fetch a single product by ID (GET /products/:id), and search products by category (GET /products/search?category=...). For the purposes of this implementation, the "database" can be an in-memory array of product objects — no external database connection is needed.
Every route must return a well-defined response shape. The agent must avoid returning untyped JSON responses.
Produce the following files:
package.json — type: "module", with all required dependencies and a start scriptsrc/app.ts — Fastify application factory with load-shedding and caching configured. Export buildApp()src/plugins/catalogue.ts — a Fastify plugin that registers the three product routes. The expensive "database" lookup for individual products and search results must go through the caching layer rather than being called directly in the handlersrc/data/products.ts — the in-memory product data (at least 5 sample products with id, name, category, price, and description fields)performance-notes.md — a short document explaining: which package is used for load shedding and what thresholds are set, which package is used for request deduplication/caching and how it prevents thundering herd, and why response schemas are defined on every routeevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher