{"_id":"@apitally/serverless","_rev":"4-109fe9187b10ccd780c4c0c66af35d9d","name":"@apitally/serverless","dist-tags":{"latest":"0.2.1"},"versions":{"0.0.1":{"name":"@apitally/serverless","version":"0.0.1","keywords":["analytics","api","apitally","cloudflare","cloudflare-workers","hono","logging","metrics","middleware","monitor","monitoring","plugin","rest","restful","serverless","workers"],"author":{"name":"Apitally","email":"hello@apitally.io"},"license":"MIT","_id":"@apitally/serverless@0.0.1","maintainers":[{"name":"simongurcke","email":"simon@gurcke.de"}],"homepage":"https://apitally.io","bugs":{"url":"https://github.com/apitally/apitally-js-serverless/issues"},"dist":{"shasum":"bbbe40c5b96d6e823704e008e8bfc550a1c123ef","tarball":"https://registry.npmjs.org/@apitally/serverless/-/serverless-0.0.1.tgz","fileCount":36,"integrity":"sha512-G9oiaAt9tgEkDca7w/K+pJpQxcwqtRtdkrY/KMjFfVd+QMqIvjAg0RCQP2+uPOWXER4sNuHgm1+r9OBMytuY+A==","signatures":[{"sig":"MEYCIQDnhj6Y4z4Z0nX2Xem3WuExOv5iOH7m0FmI8bwIYmiI1QIhAPwgTvoD8KGYJd5uxG+sgWlMuClhhTrV17pUOquffeYR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52844},"type":"module","exports":{"./hono":{"types":"./dist/hono/index.d.ts","import":"./dist/hono/index.js"},"./package.json":"./package.json"},"gitHead":"3b6467f1953574b9a4d5cc72b2b17040b3176fc2","scripts":{"test":"vitest","build":"tsup","check":"tsc --noEmit && eslint src tests && prettier --check .","format":"prettier --write ."},"_npmUser":{"name":"simongurcke","email":"simon@gurcke.de"},"prettier":{"printWidth":80},"repository":{"url":"git+ssh://git@github.com/apitally/apitally-js-serverless.git","type":"git"},"_npmVersion":"10.9.2","description":"Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).","directories":{},"_nodeVersion":"22.15.1","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.8","hono":"^4.6.5","tsup":"^8.1.0","eslint":"^9.0.0","vitest":"^4.0.0","prettier":"^3.1.0","@eslint/js":"^9.29.0","typescript":"^5.2.2","unplugin-swc":"^1.5.1","typescript-eslint":"^8.34.0","@hono/zod-validator":"^0.7.0","@vitest/coverage-v8":"^4.0.0"},"peerDependencies":{"hono":"^4"},"peerDependenciesMeta":{"hono":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/serverless_0.0.1_1766318598916_0.7914627334520941","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@apitally/serverless","version":"0.1.0","keywords":["analytics","api","apitally","cloudflare","cloudflare-workers","hono","logging","metrics","middleware","monitor","monitoring","plugin","rest","restful","serverless","workers"],"author":{"name":"Apitally","email":"hello@apitally.io"},"license":"MIT","_id":"@apitally/serverless@0.1.0","maintainers":[{"name":"simongurcke","email":"simon@gurcke.de"}],"homepage":"https://apitally.io","bugs":{"url":"https://github.com/apitally/apitally-js-serverless/issues"},"dist":{"shasum":"f0e881e1a6046308a8a57bdac7157beab489913f","tarball":"https://registry.npmjs.org/@apitally/serverless/-/serverless-0.1.0.tgz","fileCount":36,"integrity":"sha512-uEE+lRcOi3iaYkgzQBSilXwffabe/BJQbOJ7VaYn/yYhAUa/NQyQ0AgPytaWaR4REMgLQU9qzDHKQHPOl6yq+w==","signatures":[{"sig":"MEQCIE3Pp8A2yaAAAIsgDSoV+qPLw48E9mdxT/P+dBMVwkbVAiBIUbQ66020DkFJ08H1noVNZCEwm91nHc2KWOIcQkigag==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apitally%2fserverless@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":52844},"type":"module","exports":{"./hono":{"types":"./dist/hono/index.d.ts","import":"./dist/hono/index.js"},"./package.json":"./package.json"},"gitHead":"3b6467f1953574b9a4d5cc72b2b17040b3176fc2","scripts":{"test":"vitest","build":"tsup","check":"tsc --noEmit && eslint src tests && prettier --check .","format":"prettier --write ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44291bef-e64d-4c4b-9d6f-e2ef9ce65a06"}},"prettier":{"printWidth":80},"repository":{"url":"git+ssh://git@github.com/apitally/apitally-js-serverless.git","type":"git"},"_npmVersion":"11.6.2","description":"Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.8","hono":"^4.6.5","tsup":"^8.1.0","eslint":"^9.0.0","vitest":"^4.0.0","prettier":"^3.1.0","@eslint/js":"^9.29.0","typescript":"^5.2.2","unplugin-swc":"^1.5.1","typescript-eslint":"^8.34.0","@hono/zod-validator":"^0.7.0","@vitest/coverage-v8":"^4.0.0"},"peerDependencies":{"hono":"^4"},"peerDependenciesMeta":{"hono":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/serverless_0.1.0_1766318787314_0.5117494553225233","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@apitally/serverless","version":"0.2.0","keywords":["analytics","api","apitally","cloudflare","cloudflare-workers","hono","logging","metrics","middleware","monitor","monitoring","plugin","rest","restful","serverless","workers"],"author":{"name":"Apitally","email":"hello@apitally.io"},"license":"MIT","_id":"@apitally/serverless@0.2.0","maintainers":[{"name":"simongurcke","email":"simon@gurcke.de"}],"homepage":"https://apitally.io","bugs":{"url":"https://github.com/apitally/apitally-js-serverless/issues"},"dist":{"shasum":"6bedfd5edb8f3dd8b123ad47f2ca57c2496ebfd1","tarball":"https://registry.npmjs.org/@apitally/serverless/-/serverless-0.2.0.tgz","fileCount":39,"integrity":"sha512-wL+UUgllQuXOHZw9NH4yfQVT9FSnsApVCMhL6CkiEFo8puaZQwRkGTw8379JZUGmcHb5Esl1wtPlpPk5x20fbw==","signatures":[{"sig":"MEQCIFkirJpGcmINHYmsv+tGABB+BxBDWekBBL3frPkZhGBzAiAkdL0Qj5poQEc+sUJW/rkchlrmt1hajNypCOji+oPd1g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apitally%2fserverless@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60558},"type":"module","exports":{"./hono":{"types":"./dist/hono/index.d.ts","import":"./dist/hono/index.js"},"./package.json":"./package.json"},"gitHead":"90662831e26f91c029be3c7305094f9acb7b53b1","scripts":{"test":"vitest","build":"tsup","check":"tsc --noEmit && eslint src tests && prettier --check .","format":"prettier --write ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44291bef-e64d-4c4b-9d6f-e2ef9ce65a06"}},"prettier":{"printWidth":80},"repository":{"url":"git+ssh://git@github.com/apitally/apitally-js-serverless.git","type":"git"},"_npmVersion":"11.6.2","description":"Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.8","hono":"^4.6.5","tsup":"^8.1.0","eslint":"^9.0.0","vitest":"^4.0.0","prettier":"^3.1.0","@eslint/js":"^9.29.0","typescript":"^5.2.2","unplugin-swc":"^1.5.1","typescript-eslint":"^8.34.0","@hono/zod-validator":"^0.7.0","@vitest/coverage-v8":"^4.0.0"},"peerDependencies":{"hono":"^4"},"peerDependenciesMeta":{"hono":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/serverless_0.2.0_1767316272435_0.3590085946258037","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@apitally/serverless","version":"0.2.1","description":"Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).","author":{"name":"Apitally","email":"hello@apitally.io"},"license":"MIT","keywords":["analytics","api","apitally","cloudflare","cloudflare-workers","hono","logging","metrics","middleware","monitor","monitoring","plugin","rest","restful","serverless","workers"],"repository":{"type":"git","url":"git+ssh://git@github.com/apitally/apitally-js-serverless.git"},"bugs":{"url":"https://github.com/apitally/apitally-js-serverless/issues"},"homepage":"https://apitally.io","type":"module","scripts":{"build":"tsup","format":"biome format --write .","check":"tsc --noEmit && biome check .","test":"vitest"},"exports":{"./hono":{"types":"./dist/hono/index.d.ts","import":"./dist/hono/index.js"},"./package.json":"./package.json"},"peerDependencies":{"hono":"^4"},"peerDependenciesMeta":{"hono":{"optional":true}},"devDependencies":{"@biomejs/biome":"2.5.5","@hono/zod-validator":"^0.8.0","@vitest/coverage-v8":"^4.0.0","hono":"^4.6.5","tsup":"^8.1.0","typescript":"^6.0.3","unplugin-swc":"^1.5.1","vitest":"^4.0.0","zod":"^3.23.8"},"gitHead":"4baef3f67b0d047e0374b849b06b34fb6a818e10","_id":"@apitally/serverless@0.2.1","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-xl6CCAaeHACJexQEONUkcMiDIYC6XsjmaQdlx+bynuJel/fGYs2m/BZmwFWpJ/2ho4niVvjx+/JXJoMINInobQ==","shasum":"7fc82f5f3e2060bb5b6f1a99e63f884ed1934b31","tarball":"https://registry.npmjs.org/@apitally/serverless/-/serverless-0.2.1.tgz","fileCount":39,"unpackedSize":63699,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apitally%2fserverless@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD+ux7jQMamOspst8rBRErD0Bjq5mgbo48ChK0GKZjDuwIhALyR05MdnZQNe+tIFAlXnF94XFvBaAtY/lEtCjXzyG3P"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44291bef-e64d-4c4b-9d6f-e2ef9ce65a06"}},"directories":{},"maintainers":[{"name":"simongurcke","email":"simon@gurcke.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/serverless_0.2.1_1784625809712_0.37903527873397125"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-21T12:03:18.797Z","modified":"2026-07-21T09:23:30.176Z","0.0.1":"2025-12-21T12:03:19.060Z","0.1.0":"2025-12-21T12:06:27.478Z","0.2.0":"2026-01-02T01:11:12.599Z","0.2.1":"2026-07-21T09:23:29.845Z"},"bugs":{"url":"https://github.com/apitally/apitally-js-serverless/issues"},"author":{"name":"Apitally","email":"hello@apitally.io"},"license":"MIT","homepage":"https://apitally.io","keywords":["analytics","api","apitally","cloudflare","cloudflare-workers","hono","logging","metrics","middleware","monitor","monitoring","plugin","rest","restful","serverless","workers"],"repository":{"type":"git","url":"git+ssh://git@github.com/apitally/apitally-js-serverless.git"},"description":"Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).","maintainers":[{"name":"simongurcke","email":"simon@gurcke.de"}],"readme":"<p align=\"center\">\n  <a href=\"https://apitally.io\" target=\"_blank\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://assets.apitally.io/logos/logo-horizontal-new-dark.png\">\n      <source media=\"(prefers-color-scheme: light)\" srcset=\"https://assets.apitally.io/logos/logo-horizontal-new-light.png\">\n      <img alt=\"Apitally logo\" src=\"https://assets.apitally.io/logos/logo-horizontal-new-light.png\" width=\"220\">\n    </picture>\n  </a>\n</p>\n<p align=\"center\"><b>API monitoring & analytics made simple</b></p>\n<p align=\"center\" style=\"color: #ccc;\">Metrics, logs, and alerts for your serverless APIs — with just a few lines of code.</p>\n<br>\n<p>\n<picture>\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://assets.apitally.io/screenshots/overview-dark.png\">\n  <source media=\"(prefers-color-scheme: light)\" srcset=\"https://assets.apitally.io/screenshots/overview-light.png\">\n  <img alt=\"Apitally dashboard\" src=\"https://assets.apitally.io/screenshots/overview-light.png\">\n</picture>\n</p>\n<br>\n\n# Apitally SDK for Cloudflare Workers\n\n[![Tests](https://github.com/apitally/apitally-js-serverless/actions/workflows/tests.yaml/badge.svg?event=push)](https://github.com/apitally/apitally-js-serverless/actions)\n[![Codecov](https://codecov.io/gh/apitally/apitally-js-serverless/graph/badge.svg?token=sFIDRfSfca)](https://codecov.io/gh/apitally/apitally-js-serverless)\n[![npm](https://img.shields.io/npm/v/@apitally/serverless?logo=npm&color=%23cb0000)](https://www.npmjs.com/package/@apitally/serverless)\n\nApitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues.\nGet started in minutes by just adding a few lines of code and a Logpush job.\n\nLearn more about Apitally on our 🌎 [website](https://apitally.io) or check out\nthe 📚 [documentation](https://docs.apitally.io).\n\nThis SDK is for APIs running on [Cloudflare Workers](https://developers.cloudflare.com/workers/) and relies on [Logpush](https://developers.cloudflare.com/workers/observability/logs/logpush/) to send data to Apitally.\n\n## Key features\n\n### API analytics\n\nTrack traffic, error and performance metrics for your API, each endpoint and\nindividual API consumers, allowing you to make informed, data-driven engineering\nand product decisions.\n\n### Request logs\n\nDrill down from insights to individual API requests or use powerful search and filters to\nfind specific requests. View correlated application logs for a complete picture\nof each request, making troubleshooting faster and easier.\n\n### Error tracking\n\nUnderstand which validation rules in your endpoints cause client errors. Capture\nerror details and stack traces for 500 error responses.\n\n### API monitoring & alerts\n\nGet notified immediately if something isn't right using custom alerts and synthetic\nuptime checks. Alert notifications can be delivered via email, Slack and Microsoft Teams.\n\n## Supported frameworks\n\n| Framework                                  | Supported versions | Setup guide                                                           |\n| ------------------------------------------ | ------------------ | --------------------------------------------------------------------- |\n| [**Hono**](https://github.com/honojs/hono) | `4.x`              | [Link](https://docs.apitally.io/setup-guides/hono-cloudflare-workers) |\n\nApitally also supports many other web frameworks in [JavaScript](https://github.com/apitally/apitally-js), [Python](https://github.com/apitally/apitally-py), [Go](https://github.com/apitally/apitally-go), [.NET](https://github.com/apitally/apitally-dotnet) and [Java](https://github.com/apitally/apitally-java) via our other SDKs.\n\n## Getting started\n\nIf you don't have an Apitally account yet, first [sign up here](https://app.apitally.io/?signup).\n\n### 1. Create app in Apitally\n\nCreate an app in the Apitally dashboard and select **Hono (Cloudflare Workers)** as your framework. You'll see detailed setup instructions, which also include your client ID.\n\n### 2. Create Logpush job\n\nLog in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and navigate to _Analytics & Logs > Logpush_. Create a [Logpush](https://developers.cloudflare.com/workers/observability/logs/logpush/) job with the following settings:\n\n| Setting                      | Value                                                                              |\n| ---------------------------- | ---------------------------------------------------------------------------------- |\n| Destination                  | HTTP destination                                                                   |\n| HTTP endpoint                | `https://hub.apitally.io/v2/{client-id}/{env}/logpush`                             |\n| Dataset                      | Workers trace events                                                               |\n| If logs match...             | Filtered logs: EventType equals `fetch` and ScriptName equals `{your-worker-name}` |\n| Send the following fields... | General: Event, EventTimestampMs, Logs                                             |\n\nIn the HTTP endpoint, replace `{client-id}` with your app's client ID and `{env}` with the environment (e.g. `prod` or `dev`). In the filter criteria, replace `{your-worker-name}` with the name of your Worker, as specified in your Wrangler config.\n\n### 3. Configure Worker\n\nEnable [Workers Logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/) and [Logpush](https://developers.cloudflare.com/workers/observability/logs/logpush/) in your `wrangler.toml` configuration file:\n\n```toml\nlogpush = true\n\n[observability]\nenabled = true\nhead_sampling_rate = 1\n\n[observability.logs]\ninvocation_logs = true\n```\n\n### 4. Add middleware\n\nInstall the SDK:\n\n```bash\nnpm install @apitally/serverless\n```\n\nThen add the Apitally middleware to your Hono application using the `useApitally` function:\n\n```javascript\nimport { Hono } from \"hono\";\nimport { useApitally } from \"@apitally/serverless/hono\";\n\nconst app = new Hono();\n\nuseApitally(app, {\n  logRequestHeaders: true,\n  logRequestBody: true,\n  logResponseHeaders: true,\n  logResponseBody: true,\n});\n\n// Ensure route handlers are registered after useApitally()\n```\n\nFor further instructions, see our\n[setup guide for Hono on Cloudflare Workers](https://docs.apitally.io/setup-guides/hono-cloudflare-workers).\n\nSee the [SDK reference](https://docs.apitally.io/sdk-reference/javascript-serverless) for all available configuration options, including how to mask sensitive data, customize request logging, and more.\n\n## Getting help\n\nIf you need help please\n[create a new discussion](https://github.com/orgs/apitally/discussions/categories/q-a)\non GitHub or email us at [support@apitally.io](mailto:support@apitally.io). We'll get back to you as soon as possible.\n\n## License\n\nThis library is licensed under the terms of the [MIT license](LICENSE).\n","readmeFilename":"README.md"}