CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/hono-best-practices

Production Hono patterns — zValidator hooks, typed generics, error handling, middleware composition, testing, and multi-runtime deployment

87

2.57x
Quality

80%

Does it follow best practices?

Impact

98%

2.57x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

Build an Inventory Tracking API

Problem/Feature Description

A warehouse needs an API to track product inventory. Build it using Hono and TypeScript, targeting Bun. The API should support CRUD operations on products and inventory adjustment transactions.

Endpoints:

  • POST /api/products -- create a product (fields: sku, name, category, initialStock)
  • GET /api/products -- list all products with current stock levels
  • GET /api/products/:id -- get a single product
  • PATCH /api/products/:id -- update product name or category
  • POST /api/products/:id/adjust -- adjust stock (fields: quantity which can be positive or negative, reason)
  • GET /api/products/:id/history -- get adjustment history for a product

Business rules:

  • SKU must be unique, uppercase, 3-20 characters
  • Initial stock must be a non-negative integer
  • Stock adjustment cannot bring total below zero
  • Reason is required for every adjustment
  • Each adjustment records a timestamp

Use in-memory storage.

Output Specification

Produce:

  • src/app.ts -- Hono application
  • src/index.ts -- Bun entry point
  • src/routes/products.ts -- product endpoints
  • src/routes/adjustments.ts -- stock adjustment endpoints
  • src/schemas.ts -- Zod validation schemas
  • package.json -- with dependencies (no need to install)

You may create additional files as needed.

evals

tile.json