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

criteria.jsonevals/scenario-1/

{
  "context": "Tests Hono best practices in a Bun-targeted project with PATCH, query param filtering, and URL validation. The task does not mention zValidator hooks, error handling patterns, or middleware composition.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "zValidator with hook callback",
      "description": "zValidator is used for validation with a hook callback that returns structured JSON errors on failure -- not the default plain-text response",
      "max_score": 15
    },
    {
      "name": "c.req.valid() for validated data",
      "description": "Handlers access validated data via c.req.valid('json'), c.req.valid('query'), etc. -- not c.req.json() or c.req.query() after zValidator",
      "max_score": 10
    },
    {
      "name": "Query param validation",
      "description": "The tag query parameter on GET /bookmarks is validated using zValidator('query', schema) -- not raw c.req.query() without validation",
      "max_score": 8
    },
    {
      "name": "Global onError handler",
      "description": "app.onError registered with structured JSON error responses and no stack trace leaks",
      "max_score": 12
    },
    {
      "name": "notFound handler",
      "description": "app.notFound returns JSON 404 instead of default plain text",
      "max_score": 8
    },
    {
      "name": "Bun entry point pattern",
      "description": "The entry point uses 'export default { fetch: app.fetch, port: ... }' -- not @hono/node-server serve() or Deno.serve()",
      "max_score": 10
    },
    {
      "name": "Built-in middleware",
      "description": "At least logger() and secureHeaders() are registered",
      "max_score": 8
    },
    {
      "name": "Route grouping",
      "description": "Bookmark routes are on a separate Hono instance mounted via app.route()",
      "max_score": 7
    },
    {
      "name": "Env generic declared",
      "description": "Hono app uses a typed Env generic, not bare new Hono()",
      "max_score": 8
    },
    {
      "name": "Separate app from entry",
      "description": "App defined in app.ts, entry point in index.ts -- not everything in one file",
      "max_score": 6
    },
    {
      "name": "CRUD endpoints functional",
      "description": "All five endpoints (POST, GET list, GET single, PATCH, DELETE) are implemented with appropriate status codes",
      "max_score": 8
    }
  ]
}

evals

scenario-1

criteria.json

task.md

tile.json