CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/nestjs-best-practices

NestJS patterns -- modules, DI, exception filters, validation pipes, guards, interceptors, testing, config

98

1.36x
Quality

89%

Does it follow best practices?

Impact

100%

1.36x

Average score across 12 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Restaurant Order API

Problem/Feature Description

A restaurant chain is building a new online ordering backend. The ops team has a working menu service but needs a new orders endpoint that accepts customer orders containing multiple items. Each item has a menu item ID, a size (e.g. "small", "large"), and a quantity. The marketing team has strict requirements that the API must reject incomplete or malformed requests before they reach any business logic, and the mobile apps expect a consistent JSON shape for all successful responses.

You have been asked to implement the orders feature module for this NestJS application. The module should expose:

  1. A POST /orders endpoint that accepts a customer name and a list of order items, validates the entire payload including the nested items array, and returns the created order.
  2. A GET /orders endpoint that returns all orders.
  3. A GET /orders/:id endpoint that returns a single order by ID.

A stub OrdersService with create(), findAll(), and findOne() methods can stand in for real persistence (e.g., store orders in an in-memory array).

Output Specification

Produce a working NestJS TypeScript project rooted at orders-api/. The project should include:

  • src/main.ts — application bootstrap
  • src/app.module.ts — root module
  • src/orders/ — the orders feature module (module, controller, service, DTOs)
  • A package.json with the required dependencies listed (installation is not required)

Do not run npm install or start the server. Just produce the source files.

evals

tile.json