Fastify patterns — always apply schema-first validation, plugin encapsulation, structured error handling, hooks lifecycle, decorators, TypeScript type providers, production hardening (CORS, helmet, rate limiting), pino logging, graceful shutdown, and correct async handler patterns
89
89%
Does it follow best practices?
Impact
91%
2.75xAverage score across 5 eval scenarios
Passed
No known issues
Build a Fastify API for a restaurant ordering system. The API should handle creating, listing, and retrieving orders.
An order has: id (UUID string), customerName (string), items (array of order items), status (string: "pending", "preparing", "ready", "delivered"), totalPrice (number), and createdAt (ISO date string). Each order item has: menuItemId (integer), name (string), size ("small", "medium", "large"), quantity (integer, 1-20), and price (number).
POST /api/orders -- Create a new order. Accepts customerName and items in the body.GET /api/orders -- List all orders. Accepts optional status query parameter to filter.GET /api/orders/:id -- Get a single order by ID.PATCH /api/orders/:id/status -- Update order status. Accepts status in the body.Use an in-memory array for storage (no database needed).
Produce TypeScript files in a src/ directory:
src/app.ts -- Fastify app setup and configurationsrc/plugins/orders.ts -- Order routes and handlerssrc/services/orderService.ts -- Business logic for order managementsrc/server.ts -- Server startupDo not include test files or build configuration.
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
fastify-best-practices
verifiers