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-2/

Build a Notes API for Cloudflare Workers

Problem/Feature Description

Build a simple notes API using Hono and TypeScript, deployed as a Cloudflare Worker with KV storage for persistence.

Endpoints:

  • POST /api/notes -- create a note (fields: title, content, tags array optional)
  • GET /api/notes -- list all notes (returns metadata only: id, title, tags, createdAt)
  • GET /api/notes/:id -- get a full note including content
  • PUT /api/notes/:id -- replace a note
  • DELETE /api/notes/:id -- delete a note

The Worker has a KV namespace binding called NOTES_KV. Use it for storage:

  • Store notes as JSON values with the note ID as the key
  • For listing, maintain a separate notes:index key with an array of note metadata

Business rules:

  • Title is required, 1-200 characters
  • Content is required, max 10000 characters
  • Tags must be lowercase strings, max 5 tags
  • IDs are auto-generated UUIDs

Output Specification

Produce:

  • src/index.ts -- Cloudflare Worker entry point
  • src/app.ts -- Hono application
  • src/routes/notes.ts -- note route handlers
  • wrangler.toml -- Cloudflare Worker configuration with KV binding
  • package.json -- with dependencies (no need to install)

You may create additional files as needed.

evals

tile.json