CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/api-design-patterns

REST API design patterns — response envelopes, pagination, filtering, status codes, and resource naming

87

1.78x
Quality

83%

Does it follow best practices?

Impact

98%

1.78x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Order API for a Customer Portal

Problem Description

An online retailer needs a backend API for their customer portal where customers can place and track orders. Each order belongs to a customer and contains one or more line items. Customers should be able to see their own orders and admins should be able to see all orders.

Build a Node.js/Express REST API that supports:

  • Listing all orders (admin) with filtering by status (pending, shipped, delivered, cancelled)
  • Listing orders for a specific customer
  • Getting the details of a single order including its line items
  • Creating a new order with multiple line items in a single request
  • Updating an order's shipping address (without affecting other order fields)
  • Cancelling an order (only if it has not shipped yet)
  • A batch endpoint to update the status of multiple orders at once (e.g., marking 20 orders as "shipped")

Orders have: id, customer_id, status, shipping_address, total, created_at. Line items have: id, order_id, product_name, quantity, unit_price.

Output Specification

Implement the API in a src/ directory with an entry point at src/app.js (or src/app.ts). Use SQLite or in-memory storage.

Produce a package.json with all dependencies.

Do not start the server — just produce the source files.

evals

tile.json