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

{
  "context": "Tests Hono best practices in a project that explicitly asks for tests (should use app.request()), has mixed API and redirect routes, and targets Node.js. The task does not mention zValidator hooks, error handling patterns, or testing approaches.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Tests use app.request()",
      "description": "Test file uses app.request() to test routes -- not supertest, not starting an HTTP server, not node-fetch. Tests import the app from app.ts.",
      "max_score": 15
    },
    {
      "name": "zValidator with hook callback",
      "description": "zValidator includes a hook callback returning structured JSON on validation failure",
      "max_score": 12
    },
    {
      "name": "c.req.valid() for validated data",
      "description": "Handlers use c.req.valid('json') or c.req.valid('param') -- not c.req.json() after zValidator",
      "max_score": 8
    },
    {
      "name": "Global onError handler",
      "description": "app.onError registered with structured error responses and no stack trace leaks",
      "max_score": 10
    },
    {
      "name": "notFound handler",
      "description": "app.notFound returns JSON 404",
      "max_score": 7
    },
    {
      "name": "Node.js entry point",
      "description": "Entry point uses @hono/node-server serve() and the package is in dependencies",
      "max_score": 10
    },
    {
      "name": "App separated from entry",
      "description": "App is defined in app.ts and exported so tests can import it without starting a server",
      "max_score": 8
    },
    {
      "name": "Param validation",
      "description": "The :slug param is validated using zValidator('param', schema) -- not raw c.req.param() without validation",
      "max_score": 7
    },
    {
      "name": "Built-in middleware",
      "description": "logger() and secureHeaders() registered",
      "max_score": 7
    },
    {
      "name": "Route grouping",
      "description": "API routes and redirect routes are on separate Hono instances mounted via app.route()",
      "max_score": 6
    },
    {
      "name": "Redirect uses c.redirect()",
      "description": "The redirect endpoint uses c.redirect(url, 302) -- not manually setting Location header",
      "max_score": 5
    },
    {
      "name": "Consistent error shape",
      "description": "All error responses use consistent { error: { code, message } } shape",
      "max_score": 5
    }
  ]
}

evals

tile.json