{"_id":"@allstak/next","_rev":"5-dee7898fa683c603b478fc7a893895f4","name":"@allstak/next","dist-tags":{"beta":"0.1.0","latest":"0.3.0"},"versions":{"0.1.0":{"name":"@allstak/next","version":"0.1.0","license":"MIT","_id":"@allstak/next@0.1.0","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/allstak-io/allstak-next/issues"},"dist":{"shasum":"d18bc238906d1b818338cfaf62863af2d5bce0df","tarball":"https://registry.npmjs.org/@allstak/next/-/next-0.1.0.tgz","fileCount":9,"integrity":"sha512-LP50PZFxjAaLV1QFPj+g4W1Q7dyQAjHpwTWG2vQ7RnVOLmRfFbIWNxYMFdvMCTnRPkNhFUkD1PS2fY0GY/T6sg==","signatures":[{"sig":"MEUCIQCnYGWpQ7hneoFOwJiGRzeOGQdx4Mz0MgM3EZqIIfIkXQIgVqgq60PQCP0uI4I/iVrlBx+byuVGACqnUKs0sgMhZ7I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119883},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"9256cda75743778db256a6ed3d85d7a1aede3cdd","scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --sourcemap","pack:dry":"npm pack --dry-run"},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"repository":{"url":"git+https://github.com/allstak-io/allstak-next.git","type":"git"},"_npmVersion":"10.9.3","description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","vitest":"^1.6.1","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"next":{"optional":true},"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/next_0.1.0_1778477430986_0.9418393739955011","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allstak/next","version":"0.1.1","license":"MIT","_id":"@allstak/next@0.1.1","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/allstak-io/allstak-next/issues"},"dist":{"shasum":"5f570b7d45a0d63e42da2192812e4eb998018bcd","tarball":"https://registry.npmjs.org/@allstak/next/-/next-0.1.1.tgz","fileCount":10,"integrity":"sha512-0SXZ9d3MVX1XZB2/+Px8ZzqpTBaXS9PjgBJw+hO7iqSfWnvukDSwIyvhWztzqOqeFwVM8Q+VKQTE49dbR6dDQw==","signatures":[{"sig":"MEUCIDvqmRbNuPSMNmH/EatdgYOudWQMgeyerPDt+dqjMAO9AiEAx2lgV2DRRh5rRUMltYbknQWC/BYdsjemarBGO6xgu9c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34786},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"7ff66ab879ce0401ba87a803092ffc1165b10e53","scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --sourcemap","pack:dry":"npm pack --dry-run"},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"repository":{"url":"git+https://github.com/allstak-io/allstak-next.git","type":"git"},"_npmVersion":"10.9.3","description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","vitest":"^1.6.1","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"next":{"optional":true},"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/next_0.1.1_1779125189786_0.8091308665595771","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@allstak/next","version":"0.1.2","license":"MIT","_id":"@allstak/next@0.1.2","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/allstak-io/allstak-next/issues"},"dist":{"shasum":"55ec69833cd0aa8681a319be94d49c928570d9bc","tarball":"https://registry.npmjs.org/@allstak/next/-/next-0.1.2.tgz","fileCount":10,"integrity":"sha512-dQDEL42gpVd7uH7fg4jX1YGeI+oYbEmPnuhHKo+NCwN/EPt3UvpWx7ymI0pYllcsk8rUbdrMDeJTtiSGr43hww==","signatures":[{"sig":"MEQCICh66/FV16dqEFZFfEaVhMUX2theBmDMX0QGP8TFDxkvAiBIaac+dvps/AvgPMOhLcgQKYNQeWekGXfdxbZ+SDXbkA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":140266},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"7ff66ab879ce0401ba87a803092ffc1165b10e53","scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --sourcemap","pack:dry":"npm pack --dry-run"},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"repository":{"url":"git+https://github.com/allstak-io/allstak-next.git","type":"git"},"_npmVersion":"10.9.3","description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","vitest":"^1.6.1","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"next":{"optional":true},"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/next_0.1.2_1779125342462_0.6775629875608753","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@allstak/next","version":"0.2.0","license":"MIT","_id":"@allstak/next@0.2.0","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/AllStak/allstak-next/issues"},"dist":{"shasum":"10e6bf45005b88a6fcb7ad0dabc75fbbd3c6447b","tarball":"https://registry.npmjs.org/@allstak/next/-/next-0.2.0.tgz","fileCount":10,"integrity":"sha512-D1ccpALHW12nv7tiB6REPWrUTjP2L/5nEXnFIk2X/bhPK3LndBkj8a6d/xzQ285DM+D5FPkEUSBirexs8TU7Yg==","signatures":[{"sig":"MEUCIQDcoAmV3cfZDN8I6MnSro2CzNLW3kNw7d4Ji6CtClUNiAIgTn7G9Rqs1EDrvTLjH/fvzg7B768kl5g8+lX+t+Hltbo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allstak%2fnext@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":671493},"main":"./dist/index.js","_from":"file:/home/runner/work/allstak-next/allstak-next/pack/allstak-next-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --sourcemap","pack:dry":"npm pack --dry-run"},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"_resolved":"/home/runner/work/allstak-next/allstak-next/pack/allstak-next-0.2.0.tgz","_integrity":"sha512-D1ccpALHW12nv7tiB6REPWrUTjP2L/5nEXnFIk2X/bhPK3LndBkj8a6d/xzQ285DM+D5FPkEUSBirexs8TU7Yg==","repository":{"url":"git+https://github.com/AllStak/allstak-next.git","type":"git"},"_npmVersion":"10.8.2","description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","vitest":"^1.6.1","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"next":{"optional":true},"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/next_0.2.0_1780080542405_0.5707198588701501","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@allstak/next","version":"0.3.0","description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/instrumentation-client.d.ts","import":"./dist/instrumentation-client.mjs","require":"./dist/instrumentation-client.js"}},"repository":{"type":"git","url":"git+https://github.com/AllStak/allstak-next.git"},"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/AllStak/allstak-next/issues"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts src/instrumentation-client.ts --format cjs,esm --dts --sourcemap --clean","typecheck":"tsc --noEmit -p tsconfig.build.json","test":"vitest run","pack:dry":"npm pack --dry-run"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"next":{"optional":true},"react":{"optional":true}},"devDependencies":{"@types/node":"^20.0.0","@types/react":"^18.0.0","react":"^18.0.0","tsup":"^8.0.0","typescript":"^5.3.0","vitest":"^1.6.1"},"engines":{"node":">=20"},"license":"MIT","_id":"@allstak/next@0.3.0","_integrity":"sha512-v8nWz60xW6tWiRYu0kB+t+ztmp4mmzdT5ItMZ2ZYinE509HGYWoj94EFcgPjijArIoTfVvf1/opZCueE1Ektpg==","_resolved":"/home/runner/work/allstak-next/allstak-next/pack/allstak-next-0.3.0.tgz","_from":"file:/home/runner/work/allstak-next/allstak-next/pack/allstak-next-0.3.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-v8nWz60xW6tWiRYu0kB+t+ztmp4mmzdT5ItMZ2ZYinE509HGYWoj94EFcgPjijArIoTfVvf1/opZCueE1Ektpg==","shasum":"341641ab06ae2769dee1e476f7fc2914409b55e8","tarball":"https://registry.npmjs.org/@allstak/next/-/next-0.3.0.tgz","fileCount":18,"unpackedSize":1202218,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allstak%2fnext@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDOfFBFkSb8oeAaCOsOokJ9HZdl7KR9S98FeiMXXrUKWgIgTSiQRrqEme1Uyjpfc+xrgE/kFLjoprow7Kbstjhr38Q="}]},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"directories":{},"maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/next_0.3.0_1780099101678_0.7826169434838786"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-11T05:30:30.919Z","modified":"2026-05-29T23:58:22.175Z","0.1.0":"2026-05-11T05:30:31.130Z","0.1.1":"2026-05-18T17:26:29.930Z","0.1.2":"2026-05-18T17:29:02.650Z","0.2.0":"2026-05-29T18:49:02.601Z","0.3.0":"2026-05-29T23:58:21.884Z"},"bugs":{"url":"https://github.com/AllStak/allstak-next/issues"},"license":"MIT","homepage":"https://allstak.sa","repository":{"type":"git","url":"git+https://github.com/AllStak/allstak-next.git"},"description":"Standalone AllStak Next.js SDK with source-map upload support. No @allstak/* runtime dependencies.","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"readme":"# @allstak/next\n\nAllStak SDK for Next.js App Router and Pages Router. After two small wiring\nsteps it automatically captures server + client errors, route-handler /\nmiddleware errors, outbound HTTP, Core Web Vitals, database queries, structured\nlogs, and an automatic breadcrumb trail — and uploads source maps. Almost\neverything is default-on and individually toggleable; you rarely write\nper-call telemetry code.\n\n## Install\n\n```bash\nnpm install @allstak/next\n```\n\n## App Router\n\nTwo files, then you're done.\n\n1. Server bootstrap — create `instrumentation.ts`:\n\n```ts\nexport async function register() {\n  const { registerAllStak } = await import('@allstak/next');\n\n  registerAllStak({\n    apiKey: process.env.ALLSTAK_API_KEY,\n    environment: process.env.NODE_ENV ?? 'production',\n    release: process.env.NEXT_PUBLIC_RELEASE,\n  });\n}\n```\n\n`registerAllStak` automatically wires server-side error capture, the outbound\n`fetch` tracer, database query instrumentation (the `pg` driver), and a\n`console` → structured-log bridge. Each is default-on and individually\ntoggleable (`enableDbInstrumentation`, `enableConsoleLogs`, `enableOutboundHttp`, …).\n\n2. Client bootstrap — create `instrumentation-client.ts` at your project root:\n\n```ts\n// instrumentation-client.ts  (project root — Next.js auto-loads it in the browser)\nexport * from '@allstak/next/client';\n```\n\nThat single re-export auto-runs a browser bootstrap from `NEXT_PUBLIC_*` env:\nit registers a client, installs global error handlers, Core Web Vitals,\noutbound-`fetch` tracing, the auto-breadcrumb collectors (console / navigation /\nfetch), and the console→log bridge — with NO manual call. Set\n`NEXT_PUBLIC_ALLSTAK_API_KEY` (and optionally `NEXT_PUBLIC_ALLSTAK_HOST`,\n`NEXT_PUBLIC_ALLSTAK_RELEASE`, …); toggle any collector off by setting e.g.\n`NEXT_PUBLIC_ALLSTAK_BREADCRUMBS=false`.\n\n`withAllStak()` (see Source maps) injects this client entry into the browser\nbundle for you, so the `instrumentation-client.ts` file is optional when you\nuse it.\n\nWrap client components when you want a local fallback:\n\n```tsx\n'use client';\n\nimport { withAllStakErrorBoundary } from '@allstak/next';\n\nfunction PageContent() {\n  return <AppContent />;\n}\n\nexport default withAllStakErrorBoundary(PageContent, {\n  fallback: <p>Something went wrong.</p>,\n});\n```\n\n## Route handlers\n\n```ts\nimport { withAllStakRouteHandler } from '@allstak/next';\n\nexport const GET = withAllStakRouteHandler(async () => {\n  return Response.json({ ok: true });\n});\n```\n\n## Pages Router\n\n```ts\n// pages/_app.tsx\nimport { installGlobalErrorHandlers } from '@allstak/next';\nimport { useEffect } from 'react';\n\nexport default function App({ Component, pageProps }) {\n  useEffect(() => installGlobalErrorHandlers(), []);\n  return <Component {...pageProps} />;\n}\n```\n\n## Database queries\n\n`registerAllStak` auto-instruments the `pg` driver when it resolves in your app\n(covering `Pool` and `Client`, including prepared/named queries and\ntransactions). Every query is normalized — string and numeric literals are\nmasked to `?` BEFORE it leaves the SDK, so bound values never reach the wire —\nand emitted to `/ingest/v1/db`.\n\nORM integrations that need a live client instance are one explicit call:\n\n```ts\n// Prisma — construct the client with query-event logging, then attach.\nimport { PrismaClient } from '@prisma/client';\nimport { instrumentPrisma } from '@allstak/next';\n\nconst prisma = new PrismaClient({ log: [{ emit: 'event', level: 'query' }] });\ninstrumentPrisma(prisma);\n\n// Drizzle — pass the AllStak logger.\nimport { drizzle } from 'drizzle-orm/node-postgres';\nimport { allstakDrizzleLogger } from '@allstak/next';\n\nconst db = drizzle(pool, { logger: allstakDrizzleLogger() });\n```\n\n## Logs\n\nA console → structured-log bridge is installed by default (server via\n`registerAllStak`, browser via the client bootstrap). Existing\n`console.{debug,info,warn,error}` calls become structured logs at\n`/ingest/v1/logs`; the original console output is always preserved. An\n`error`/`fatal` log carrying an `Error` is also promoted to `captureException`.\n\nWire your logger of choice, or log explicitly:\n\n```ts\nimport pino from 'pino';\nimport { allstakPinoStream, allstakWinstonTransport, captureLog } from '@allstak/next';\n\n// pino\nconst logger = pino({ level: 'info' }, allstakPinoStream());\n\n// winston (optional peer)\nconst t = allstakWinstonTransport();\nconst wlogger = winston.createLogger({ transports: t ? [t] : [] });\n\n// explicit\ncaptureLog('warn', 'cache miss', { region: 'eu' });\n```\n\n## Breadcrumbs\n\nThe browser bootstrap installs console / navigation / fetch breadcrumb\ncollectors by default, so any error captured afterwards carries the \"what\nhappened just before\" trail automatically — no manual `addBreadcrumb` calls.\nToggle with `enableAutoBreadcrumbs` / `NEXT_PUBLIC_ALLSTAK_BREADCRUMBS`.\n\n## Source maps\n\n```js\nconst { withAllStak } = require('@allstak/next');\n\nmodule.exports = withAllStak({\n  release: process.env.NEXT_PUBLIC_RELEASE,\n  uploadToken: process.env.ALLSTAK_UPLOAD_TOKEN,\n}, {\n  reactStrictMode: true,\n});\n```\n\n`withAllStak()` also injects the browser client bootstrap into your bundle by\ndefault (so you can skip the root `instrumentation-client.ts`); pass\n`clientBootstrap: false` to opt out.\n\n## Manual capture\n\n```ts\nimport { captureException, initAllStakNext } from '@allstak/next';\n\ninitAllStakNext({\n  apiKey: process.env.ALLSTAK_API_KEY,\n  environment: process.env.NODE_ENV ?? 'production',\n  release: process.env.NEXT_PUBLIC_RELEASE,\n});\n\nawait captureException(new Error('checkout failed'), {\n  route: '/checkout',\n});\n```\n\n## Configuration\n\n| Option | Description |\n| --- | --- |\n| `apiKey` | Project API key. |\n| `environment` | Deployment environment. |\n| `release` | App version or commit SHA. |\n| `uploadToken` | Source-map upload token. |\n| `dist` | Optional build distribution name. |\n| `tunnelRoute` | Optional browser ingest tunnel route. |\n| `enableDbInstrumentation` | Auto-wire DB driver capture (`pg`). Default true. |\n| `enableConsoleLogs` | Bridge `console.*` to `/ingest/v1/logs`. Default true. |\n| `enableAutoBreadcrumbs` | Console/navigation/fetch breadcrumb collectors. Default true. |\n| `enableOutboundHttp` | Outbound `fetch` capture + trace propagation. Default true. |\n| `enableWebVitals` | Core Web Vitals spans. Default true (browser). |\n\nBrowser env toggles (set to `false` to opt out): `NEXT_PUBLIC_ALLSTAK_API_KEY`,\n`NEXT_PUBLIC_ALLSTAK_HOST`, `NEXT_PUBLIC_ALLSTAK_ENVIRONMENT`,\n`NEXT_PUBLIC_ALLSTAK_RELEASE`, `NEXT_PUBLIC_ALLSTAK_WEB_VITALS`,\n`NEXT_PUBLIC_ALLSTAK_OUTBOUND_HTTP`, `NEXT_PUBLIC_ALLSTAK_BREADCRUMBS`,\n`NEXT_PUBLIC_ALLSTAK_CONSOLE_LOGS`, `NEXT_PUBLIC_ALLSTAK_SEND_PII`.\n\n## Troubleshooting\n\n- Server errors missing: ensure `instrumentation.ts` is enabled in your Next.js version.\n- Client errors missing: install global handlers or use the error boundary helper.\n- Source maps missing: use the same release value in runtime config and source-map upload.\n\n## Contributing and Support\n\n- Report bugs with the GitHub bug report template: https://github.com/AllStak/allstak-next/issues/new/choose\n- Open pull requests using the checklist in [CONTRIBUTING.md](CONTRIBUTING.md).\n- Report security vulnerabilities privately through [SECURITY.md](SECURITY.md).\n\n## License\n\nMIT\n","readmeFilename":"README.md"}