{"_id":"@api-emulator/adapter-next","_rev":"5-f0b723499ba5c92d24203c186968b333","name":"@api-emulator/adapter-next","dist-tags":{"latest":"0.9.0"},"versions":{"0.5.2":{"name":"@api-emulator/adapter-next","version":"0.5.2","license":"MIT","_id":"@api-emulator/adapter-next@0.5.2","maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"homepage":"https://api-emulator.jsj.sh","bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"dist":{"shasum":"ba75792c2cd650249b75555da56ea5adf0571b79","tarball":"https://registry.npmjs.org/@api-emulator/adapter-next/-/adapter-next-0.5.2.tgz","fileCount":5,"integrity":"sha512-nOdtlSSyXRJEitNteXh4g+Xf2h9/LZjdVZvGO6h5/wkIJIga2L9Wa79YwsrWUmJq0dfl5vFr71AE2KxqBs8t+Q==","signatures":[{"sig":"MEUCIQCAIBgRTcTM8mKuhE5EuQx+fSANrvDonwwA0LdGLHzW0QIgLv6zTNMucYX3p/8TA764cAabS3dK29dsVF6jKswiXbg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-emulator%2fadapter-next@0.5.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29804},"main":"./dist/index.js","type":"module","_from":"file:/tmp/api-emulator-adapter-next-0.5.2.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup --clean","clean":"rm -rf dist .turbo","type-check":"tsc --noEmit"},"_npmUser":{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"},"_resolved":"/tmp/api-emulator-adapter-next-0.5.2.tgz","_integrity":"sha512-nOdtlSSyXRJEitNteXh4g+Xf2h9/LZjdVZvGO6h5/wkIJIga2L9Wa79YwsrWUmJq0dfl5vFr71AE2KxqBs8t+Q==","repository":{"url":"git+https://github.com/jsj/api-emulator.git","type":"git","directory":"packages/@api-emulator/adapter-next"},"_npmVersion":"11.11.0","description":"Next.js App Router integration for emulate. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"@api-emulator/core":"0.5.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"^4.1.0","typescript":"^5.7"},"_npmOperationalInternal":{"tmp":"tmp/adapter-next_0.5.2_1778549143679_0.008156464871125424","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@api-emulator/adapter-next","version":"0.6.0","license":"MIT","_id":"@api-emulator/adapter-next@0.6.0","maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"homepage":"https://api-emulator.jsj.sh","bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"dist":{"shasum":"58962751a2c2a48743ed290f5529510b67765f8a","tarball":"https://registry.npmjs.org/@api-emulator/adapter-next/-/adapter-next-0.6.0.tgz","fileCount":5,"integrity":"sha512-MTriqzfZWMMP6Z60hyf+Mh5BhBWT520Jz6ubbcrgbiDseuk6/HqA5RYc31J5IfKCTUpY6jJnde37jjxSEe+mdQ==","signatures":[{"sig":"MEUCIQDSjs2szpuuSa5NE/QbF7XPH6PUpsgH515Q0GMrMgfB0wIgePhqmVrGNWZEU+mTGdwAi3ENpDdQ4mAyb8rJzeeOyY0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-emulator%2fadapter-next@0.6.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30380},"main":"./dist/index.js","type":"module","_from":"file:/tmp/api-emulator-adapter-next-0.6.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup --clean","clean":"rm -rf dist .turbo","type-check":"tsc --noEmit"},"_npmUser":{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"},"_resolved":"/tmp/api-emulator-adapter-next-0.6.0.tgz","_integrity":"sha512-MTriqzfZWMMP6Z60hyf+Mh5BhBWT520Jz6ubbcrgbiDseuk6/HqA5RYc31J5IfKCTUpY6jJnde37jjxSEe+mdQ==","repository":{"url":"git+https://github.com/jsj/api-emulator.git","type":"git","directory":"packages/@api-emulator/adapter-next"},"_npmVersion":"11.11.0","description":"Next.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"@api-emulator/core":"0.6.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"^4.1.0","typescript":"^5.7"},"_npmOperationalInternal":{"tmp":"tmp/adapter-next_0.6.0_1778636823008_0.7039818022169162","host":"s3://npm-registry-packages-npm-production"}},"0.7.0":{"name":"@api-emulator/adapter-next","version":"0.7.0","license":"MIT","_id":"@api-emulator/adapter-next@0.7.0","maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"homepage":"https://api-emulator.jsj.sh","bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"dist":{"shasum":"4504d08d8d2954d95e0c36666757129e89762ce8","tarball":"https://registry.npmjs.org/@api-emulator/adapter-next/-/adapter-next-0.7.0.tgz","fileCount":5,"integrity":"sha512-/cXVgtxSDNsr44EDrpuSFFIy0VKIqVW5eWPkpEtrasAGsg4BPzuR7oLaj1RW/mJfzfzRjRprfq5vXKvbzxunGw==","signatures":[{"sig":"MEUCIQDQDeVVMAR4ItsmuTM9NIDfdFkX4ZzB15d0Kj885C42PgIgWtLbvBiX7hEEkN2DbVpFE/tun/WciWudV7knw26ShD4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-emulator%2fadapter-next@0.7.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30380},"main":"./dist/index.js","type":"module","_from":"file:/tmp/api-emulator-adapter-next-0.7.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup --clean","clean":"rm -rf dist .turbo","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3a4eeeb6-55f2-4eec-b18c-ee960d9c70f3"}},"_resolved":"/tmp/api-emulator-adapter-next-0.7.0.tgz","_integrity":"sha512-/cXVgtxSDNsr44EDrpuSFFIy0VKIqVW5eWPkpEtrasAGsg4BPzuR7oLaj1RW/mJfzfzRjRprfq5vXKvbzxunGw==","repository":{"url":"git+https://github.com/jsj/api-emulator.git","type":"git","directory":"packages/@api-emulator/adapter-next"},"_npmVersion":"11.16.0","description":"Next.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"@api-emulator/core":"0.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"^4.1.0","typescript":"^5.7"},"_npmOperationalInternal":{"tmp":"tmp/adapter-next_0.7.0_1780761837354_0.93405524397057","host":"s3://npm-registry-packages-npm-production"}},"0.8.0":{"name":"@api-emulator/adapter-next","version":"0.8.0","license":"MIT","_id":"@api-emulator/adapter-next@0.8.0","maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"homepage":"https://api-emulator.jsj.sh","bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"dist":{"shasum":"3929ce761b8ff23ee0d65973163512f9f432f715","tarball":"https://registry.npmjs.org/@api-emulator/adapter-next/-/adapter-next-0.8.0.tgz","fileCount":5,"integrity":"sha512-26bD4JAwf5Fj33Dlak8iD+3uxY14O0hA7ho+sn29R0fxNvJYOvqT4vqw4P05b6i3LL6X+mN4b0lcbAOd12lUUA==","signatures":[{"sig":"MEYCIQC0XKO0vWgDVkio9lrY0A8D2FqZjcF3nSQhrDeNuzla2QIhAOcjfQOi4cU6Jhm6EsUZ5qPoyDc2fKSekeVurIuT3DNs","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-emulator%2fadapter-next@0.8.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30380},"main":"./dist/index.js","type":"module","_from":"file:/tmp/api-emulator-adapter-next-0.8.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup --clean","clean":"rm -rf dist .turbo","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3a4eeeb6-55f2-4eec-b18c-ee960d9c70f3"}},"_resolved":"/tmp/api-emulator-adapter-next-0.8.0.tgz","_integrity":"sha512-26bD4JAwf5Fj33Dlak8iD+3uxY14O0hA7ho+sn29R0fxNvJYOvqT4vqw4P05b6i3LL6X+mN4b0lcbAOd12lUUA==","repository":{"url":"git+https://github.com/jsj/api-emulator.git","type":"git","directory":"packages/@api-emulator/adapter-next"},"_npmVersion":"12.0.2","description":"Next.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","directories":{},"_nodeVersion":"24.18.0","dependencies":{"@api-emulator/core":"0.8.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8","vitest":"^4.1.0","typescript":"^5.7"},"_npmOperationalInternal":{"tmp":"tmp/adapter-next_0.8.0_1785798585852_0.051888996863553416","host":"s3://npm-registry-packages-npm-production"}},"0.9.0":{"name":"@api-emulator/adapter-next","version":"0.9.0","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"homepage":"https://api-emulator.jsj.sh","repository":{"type":"git","url":"git+https://github.com/jsj/api-emulator.git","directory":"packages/@api-emulator/adapter-next"},"bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup --clean","dev":"tsup --watch","test":"vitest run","clean":"rm -rf dist .turbo","type-check":"tsc --noEmit","lint":"eslint src"},"dependencies":{"@api-emulator/core":"0.9.0"},"devDependencies":{"tsup":"^8","typescript":"^5.7","vitest":"^4.1.0"},"_id":"@api-emulator/adapter-next@0.9.0","description":"Next.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","_integrity":"sha512-Lpc+/rSCHQC1e3VQ5E2xx3Wg/m1n+HHAQTbBw59leZR6FI9N9x3oVA8RoHeQv6CfCvGYeS+d+VdOrog/nfFfhw==","_resolved":"/tmp/api-emulator-adapter-next-0.9.0.tgz","_from":"file:/tmp/api-emulator-adapter-next-0.9.0.tgz","_nodeVersion":"24.18.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-Lpc+/rSCHQC1e3VQ5E2xx3Wg/m1n+HHAQTbBw59leZR6FI9N9x3oVA8RoHeQv6CfCvGYeS+d+VdOrog/nfFfhw==","shasum":"46a34ed2bdf193cea896055e94d65c73f0c4782b","tarball":"https://registry.npmjs.org/@api-emulator/adapter-next/-/adapter-next-0.9.0.tgz","fileCount":5,"unpackedSize":30380,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-emulator%2fadapter-next@0.9.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICqoU3h7rRdcFP3ibt3/tpwKWNRfq+QHjVFh9LqTRSoRAiBg84AUVrR0kIJyG9bg7o29B+hCyj5F8UzWIr7yDbTPFw=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3a4eeeb6-55f2-4eec-b18c-ee960d9c70f3"}},"directories":{},"maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-next_0.9.0_1786480084051_0.2991434667763062"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-12T01:25:43.561Z","modified":"2026-08-11T20:28:04.667Z","0.5.2":"2026-05-12T01:25:43.838Z","0.6.0":"2026-05-13T01:47:03.159Z","0.7.0":"2026-06-06T16:03:57.480Z","0.8.0":"2026-08-03T23:09:45.997Z","0.9.0":"2026-08-11T20:28:04.199Z"},"bugs":{"url":"https://github.com/jsj/api-emulator/issues"},"license":"MIT","homepage":"https://api-emulator.jsj.sh","repository":{"type":"git","url":"git+https://github.com/jsj/api-emulator.git","directory":"packages/@api-emulator/adapter-next"},"description":"Next.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.","maintainers":[{"name":"jsjackson","email":"james.sorley.jackson@gmail.com"}],"readme":"# @api-emulator/adapter-next\n\nNext.js App Router integration for api-emulator. Embed emulators directly in your Next.js app so they run on the same origin, solving the Vercel preview deployment problem where OAuth callback URLs change with every deployment.\n\nPart of [api-emulator](https://github.com/jsj/api-emulator) — local drop-in replacement services for CI and no-network sandboxes.\n\n## Install\n\n```bash\nnpm install @api-emulator/adapter-next\n```\n\n## Route handler\n\nCreate a catch-all route that serves emulator traffic:\n\n```typescript\n// app/api-emulator/[...path]/route.ts\nimport { createApiEmulatorHandler } from '@api-emulator/adapter-next'\nimport type { ServicePlugin } from '@api-emulator/core'\n\nconst localPlugin: ServicePlugin = {\n  name: 'local',\n  register(app) {\n    app.get('/health', (c) => c.json({ ok: true }))\n  },\n}\n\nexport const { GET, POST, PUT, PATCH, DELETE } = createApiEmulatorHandler({\n  services: {\n    local: { emulator: { plugin: localPlugin } },\n  },\n})\n```\n\n## Auth.js / NextAuth configuration\n\nPoint your provider at the emulator paths on the same origin:\n\n```typescript\nimport GitHub from 'next-auth/providers/github'\n\nconst baseUrl = process.env.VERCEL_URL\n  ? `https://${process.env.VERCEL_URL}`\n  : 'http://localhost:3000'\n\nGitHub({\n  clientId: 'any-value',\n  clientSecret: 'any-value',\n  authorization: { url: `${baseUrl}/api-emulator/github/login/oauth/authorize` },\n  token: { url: `${baseUrl}/api-emulator/github/login/oauth/access_token` },\n  userinfo: { url: `${baseUrl}/api-emulator/github/user` },\n})\n```\n\nNo `oauth_apps` need to be seeded. When none are configured, the emulator skips `client_id`, `client_secret`, and `redirect_uri` validation.\n\n## Font files in serverless\n\nEmulator UI pages use bundled fonts. Wrap your Next.js config to include them in the serverless trace:\n\n```typescript\n// next.config.mjs\nimport { withApiEmulator } from '@api-emulator/adapter-next'\n\nexport default withApiEmulator({\n  // your normal Next.js config\n})\n```\n\nIf you mount the catch-all at a custom path, pass the matching prefix:\n\n```typescript\nexport default withApiEmulator(nextConfig, { routePrefix: '/api/api-emulator' })\n```\n\n## Persistence\n\nBy default, emulator state is in-memory and resets on every cold start. To persist state across restarts, pass a `persistence` adapter:\n\n```typescript\nimport { createApiEmulatorHandler } from '@api-emulator/adapter-next'\nimport type { ServicePlugin } from '@api-emulator/core'\n\nconst localPlugin: ServicePlugin = {\n  name: 'local',\n  register(app) { app.get('/health', (c) => c.json({ ok: true })) },\n}\n\nconst kvAdapter = {\n  async load() { return await kv.get('api-emulator-state') },\n  async save(data: string) { await kv.set('api-emulator-state', data) },\n}\n\nexport const { GET, POST, PUT, PATCH, DELETE } = createApiEmulatorHandler({\n  services: { local: { emulator: { plugin: localPlugin } } },\n  persistence: kvAdapter,\n})\n```\n\nFor local development, `@api-emulator/core` ships `filePersistence`:\n\n```typescript\nimport { filePersistence } from '@api-emulator/core'\n\n// ...\npersistence: filePersistence('.api-emulator/state.json'),\n```\n\n## Links\n\n- [Full documentation](https://api-emulator.jsj.sh)\n- [GitHub](https://github.com/jsj/api-emulator)\n","readmeFilename":"README.md"}