{"_id":"@civitai/next-axiom","_rev":"5-151fe0ee4603bcd9df76958d8631f067","name":"@civitai/next-axiom","dist-tags":{"latest":"0.17.0"},"versions":{"0.17.0":{"name":"@civitai/next-axiom","version":"0.17.0","keywords":["web-vitals","axiom","observability","performance","nextjs"],"license":"MIT","_id":"@civitai/next-axiom@0.17.0","maintainers":[{"name":"manuelurenah","email":"manuel.ureh@hotmail.com"},{"name":"justmaier","email":"just.maier@gmail.com"},{"name":"bkdiehl","email":"bkdiehl@gmail.com"}],"homepage":"https://github.com/axiomhq/next-axiom#readme","bugs":{"url":"https://github.com/axiomhq/next-axiom/issues"},"dist":{"shasum":"546c6e0b38d98da1182ae1413388e832e5b344ae","tarball":"https://registry.npmjs.org/@civitai/next-axiom/-/next-axiom-0.17.0.tgz","fileCount":57,"integrity":"sha512-S9G3zZbdXOGKuCVdgxexuA+381A8D4Kz8c3cFn2t09qHQnxFruLLhj5D2QkXouvMvZ+DYeUqGu8KIH8epN+5Vg==","signatures":[{"sig":"MEYCIQDH2ZJ2CnKmDSI+CX54BtA7ga/ooDb2VN3gBBbDjkzhvgIhAJWYx8eCIjLBIpoxJzhjFv4EY+CCuwsf4NZVj/4u9C34","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":371140},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=15"},"scripts":{"test":"jest","build":"tsc","format":"prettier --write src/*.ts __tests__/*.ts","prepare":"npm run build","check-format":"prettier -c src/*.ts __tests__/*.ts"},"_npmUser":{"name":"bkdiehl","email":"bkdiehl@gmail.com"},"repository":{"url":"git+https://github.com/axiomhq/next-axiom.git","type":"git"},"_npmVersion":"10.5.0","description":"A fork of next-axiom 0.17","directories":{},"_nodeVersion":"20.12.2","dependencies":{"whatwg-fetch":"^3.6.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.0","ts-jest":"^28.0.2","ts-node":"^10.8.0","prettier":"2.6.2","typescript":"^4.6.4","@types/jest":"^27.5.1","@types/node":"^17.0.29","jest-environment-jsdom":"^28.1.0"},"peerDependencies":{"next":"^12.1.4 || ^13 || ^14"},"_npmOperationalInternal":{"tmp":"tmp/next-axiom_0.17.0_1726626199074_0.7350296061119803","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-09-18T02:23:18.975Z","modified":"2026-06-19T19:38:55.349Z","0.17.0":"2024-09-18T02:23:19.211Z"},"bugs":{"url":"https://github.com/axiomhq/next-axiom/issues"},"license":"MIT","homepage":"https://github.com/axiomhq/next-axiom#readme","keywords":["web-vitals","axiom","observability","performance","nextjs"],"repository":{"url":"git+https://github.com/axiomhq/next-axiom.git","type":"git"},"description":"A fork of next-axiom 0.17","maintainers":[{"email":"lrojas94@gmail.com","name":"lrojas94"},{"email":"just.maier@gmail.com","name":"justmaier"},{"email":"bkdiehl@gmail.com","name":"bkdiehl"},{"email":"manuel.ureh@hotmail.com","name":"manuelurenah"},{"email":"zachlowden1@gmail.com","name":"devzacx"}],"readme":"![next-axiom: The official Next.js library for Axiom](.github/images/banner-dark.svg#gh-dark-mode-only)\n![next-axiom: The official Next.js library for Axiom](.github/images/banner-light.svg#gh-light-mode-only)\n\n<div align=\"center\">\n\n[![build](https://img.shields.io/github/actions/workflow/status/axiomhq/next-axiom/ci.yml?branch=main&ghcache=unused)](https://github.com/axiomhq/next-axiom/actions?query=workflow%3ACI)\n[![Latest release](https://img.shields.io/github/release/axiomhq/next-axiom.svg)](https://github.com/axiomhq/next-axiom/releases/latest)\n[![License](https://img.shields.io/github/license/axiomhq/next-axiom.svg?color=blue)](https://opensource.org/licenses/MIT)\n\n</div>\n\n[Axiom](https://axiom.co) unlocks observability at any scale.\n\n- **Ingest with ease, store without limits:** Axiom’s next-generation datastore enables ingesting petabytes of data with ultimate efficiency. Ship logs from Kubernetes, AWS, Azure, Google Cloud, DigitalOcean, Nomad, and others.\n- **Query everything, all the time:** Whether DevOps, SecOps, or EverythingOps, query all your data no matter its age. No provisioning, no moving data from cold/archive to “hot”, and no worrying about slow queries. All your data, all. the. time.\n- **Powerful dashboards, for continuous observability:** Build dashboards to collect related queries and present information that’s quick and easy to digest for you and your team. Dashboards can be kept private or shared with others, and are the perfect way to bring together data from different sources.\n\nFor more information, check out the [official documentation](https://axiom.co/docs).\n\n## Installation\n\n### Using Vercel Integration\n\nMake sure you have the [Axiom Vercel integration](https://www.axiom.co/vercel) installed. Once it is done, perform the steps below: \n\n- In your Next.js project, run install `next-axiom` as follows:\n\n```sh\nnpm install --save next-axiom\n```\n\n- In the `next.config.js` file, wrap your Next.js config in `withAxiom` as follows:\n\n```js\nconst { withAxiom } = require('next-axiom');\n\nmodule.exports = withAxiom({\n  // ... your existing config\n});\n```\n\n### Using Any Other Platform\n\nCreate an API token in [Axiom settings](https://cloud.axiom.co/settings/profile) and export it as `AXIOM_TOKEN`, as well as the Axiom dataset name as `AXIOM_DATASET`. Once it is done, perform the steps below:\n\n- In your Next.js project, run install `next-axiom` as follows:\n\n```sh\nnpm install --save next-axiom\n```\n\n- In the `next.config.js` file, wrap your Next.js config in `withAxiom` as follows:\n\n```js\nconst { withAxiom } = require('next-axiom');\n\nmodule.exports = withAxiom({\n  // ... your existing config\n});\n```\n\n:warning: `next-axiom` is still experimental for non-Vercel platforms and is subject to change.\n\n## Usage\n\n### Web Vitals\n\n:warning: Web-Vitals are not yet supported in Next.js 13 and above. Please use Next.js 12 or below.\n\nGo to `pages/_app.js` or `pages/_app.ts` and add the following line to report web vitals:\n\n```js\nexport { reportWebVitals } from 'next-axiom';\n```\n\n> **Note**: WebVitals are only sent from production deployments.\n\nWrapping your handlers in `withAxiom` will make `req.log` available and log\nexceptions:\n\n:warning: Nextjs 13.x server side components are not yet supported.\n\n```ts\nimport { withAxiom, AxiomAPIRequest } from 'next-axiom';\n\nasync function handler(req: AxiomAPIRequest, res: NextApiResponse) {\n  req.log.info('Login function called');\n\n  // You can create intermediate loggers\n  const log = req.log.with({ scope: 'user' });\n  log.info('User logged in', { userId: 42 });\n\n  res.status(200).text('hi');\n}\n\nexport default withAxiom(handler);\n```\n\nImport and use `log` in the frontend like this:\n\n```js\nimport { log } from `next-axiom`;\n\n// pages/index.js\nfunction home() {\n    ...\n    log.debug('User logged in', { userId: 42 })\n    ...\n}\n```\n\n### Log Levels\n\nThe log level defines the lowest level of logs sent to Axiom.\nThe default is debug, resulting in all logs being sent.\nAvailable levels are (from lowest to highest): `debug`, `info`, `warn`, `error`\n\nFor example, if you don't want debug logs to be sent to Axiom:\n\n```sh\nexport AXIOM_LOG_LEVEL=info\n```\n\nYou can also disable logging completely by setting the log level to `off`:\n\n```sh\nexport AXIOM_LOG_LEVEL=off\n```\n\n### getServerSideProps\n\nTo be able to use next-axiom with `getServerSideProps` you need to wrap your function with `withAxiomGetServerSideProps`, becasue there is no\nway at the moment to automatically detected if getServerSideProps is used.\n\n```ts\nimport { withAxiomGetServerSideProps } from 'next-axiom'\nexport const getServerSideProps = withAxiomGetServerSideProps(async ({ req, log })  => {\n  log.info('Hello, world!');\n  return {\n    props: {\n    },\n  }\n});\n\n\n### License\n\nDistributed under the [MIT License](LICENSE).\n","readmeFilename":"README.md"}