{"id":15723547,"url":"https://github.com/passidel/hono-timing","last_synced_at":"2026-05-18T09:34:19.147Z","repository":{"id":177427470,"uuid":"660347194","full_name":"PassiDel/hono-timing","owner":"PassiDel","description":"Add Server-Timings to your hono server!","archived":false,"fork":false,"pushed_at":"2023-07-01T16:41:08.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T08:21:14.851Z","etag":null,"topics":["hono","metrics","performance-monitoring","server-timing","timing","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PassiDel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-29T20:01:30.000Z","updated_at":"2023-07-01T13:33:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"07d2ba31-2696-4e35-aa1c-033d67fb02cf","html_url":"https://github.com/PassiDel/hono-timing","commit_stats":null,"previous_names":["passidel/hono-timing"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/PassiDel/hono-timing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PassiDel%2Fhono-timing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PassiDel%2Fhono-timing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PassiDel%2Fhono-timing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PassiDel%2Fhono-timing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PassiDel","download_url":"https://codeload.github.com/PassiDel/hono-timing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PassiDel%2Fhono-timing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272801032,"owners_count":24995202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hono","metrics","performance-monitoring","server-timing","timing","web"],"created_at":"2024-10-03T22:12:12.826Z","updated_at":"2026-05-18T09:34:19.080Z","avatar_url":"https://github.com/PassiDel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Server-Timing API for Hono\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/PassiDel/hono-timing/ci.yml?branch=main)](https://github.com/PassiDel/hono-timing/actions)\n[![GitHub](https://img.shields.io/github/license/PassiDel/hono-timing)](https://github.com/PassiDel/hono-timing/blob/main/LICENSE)\n![NPM](https://img.shields.io/npm/l/%40puazzi%2Fhono-timing)\n[![npm type definitions](https://img.shields.io/npm/types/@puazzi/hono-timing)](https://www.npmjs.com/package/@puazzi/hono-timing)\n[![npm](https://img.shields.io/npm/v/@puazzi/hono-timing)](https://www.npmjs.com/package/@puazzi/hono-timing)\n\nThis module adds [Server-Timing](https://www.w3.org/TR/server-timing/) to response headers\nfor [Hono](https://hono.dev/).\n\nThis middleware is based on the work of [yosuke-furukawa](https://github.com/yosuke-furukawa/server-timing), thank you!\n\n# Install\n\n```shell\nnpm install @puazzi/hono-timing\n```\n\n# Usage\n\n```ts\nimport { serve } from '@hono/node-server';\nimport { Hono } from 'hono';\nimport { endTime, setMetric, startTime, timing } from \"@puazzi/hono-timing\";\n\nconst app = new Hono();\n\n// add the middleware to your router\napp.use('*', timing());\n\napp.get('/', async (c) =\u003e {\n\n  // add custom metrics\n  setMetric(c, 'region', 'europe-west3')\n\n  // add custom metrics with timing, must be in milliseconds\n  setMetric(c, 'custom', 23.8, 'My custom Metric')\n\n  // start a new timer\n  startTime(c, 'db');\n  const data = await db.findMany(...);\n\n  // end the timer\n  endTime(c, 'db');\n\n  return c.json({ response: data });\n});\n\nserve(app);\n\n```\n\n## Conditionally enabled\n\n```ts\nimport { Hono } from 'hono';\nimport { timing } from '@puazzi/hono-timing';\n\nconst app = new Hono();\n\napp.use(\n  '*',\n  timing({\n    // c: Context of the request\n    enabled: (c) =\u003e c.req.method === 'POST'\n  })\n);\n```\n\n# API\n\n## Config\n\n| **Name**         | **Type**                           | **Default**           | **Description**                                                                                                                                                                                                                                                                                          |\n| ---------------- | ---------------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| total            | boolean                            | true                  | Show a total response time.                                                                                                                                                                                                                                                                              |\n| enabled          | boolean \\| (c: Context) =\u003e boolean | true                  | Whether timings should be added to the headers or not.                                                                                                                                                                                                                                                   |\n| totalDescription | string                             | 'Total Response Time' | Description for the total response time.                                                                                                                                                                                                                                                                 |\n| autoEnd          | boolean                            | true                  | If `startTime()` should end automatically at the end of the request. If disabled, not manually ended timers will not be shown.                                                                                                                                                                           |\n| crossOrigin      | boolean \\| string                  | false                 | The origin this timings header should be readable.\u003cbr\u003eIf false, only from current origin.\u003cbr\u003eIf true, from all origin.\u003cbr\u003eIf string, from this domain(s). Multiple domains must be separated with a comma.\u003cbr\u003eSee [docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Timing-Allow-Origin). |\n\n# Result\n\n![Example Timings](example.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpassidel%2Fhono-timing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpassidel%2Fhono-timing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpassidel%2Fhono-timing/lists"}