{"_id":"@aiendpoint/serve","_rev":"2-5bbacc13825066c71a3ce282627fffae","name":"@aiendpoint/serve","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@aiendpoint/serve","version":"0.1.0","keywords":["aiendpoint","ai","api","middleware","express","fastify","nextjs","hono","nestjs"],"license":"Apache-2.0","_id":"@aiendpoint/serve@0.1.0","maintainers":[{"name":"bejoyfuuul","email":"bejoyfuuul@gmail.com"}],"homepage":"https://aiendpoint.dev","bugs":{"url":"https://github.com/aiendpoint/platform/issues"},"dist":{"shasum":"b058238a877d447df80bc49a88d6ce16139831bb","tarball":"https://registry.npmjs.org/@aiendpoint/serve/-/serve-0.1.0.tgz","fileCount":20,"integrity":"sha512-mvhxC1TsZa09fLkxUPMUGxvbYaLtSVyzCwPnqkCoOLXAJ6of+ANlLf/vYl5f/GmT1UIW/8dJ7E0j23/UqMEFXg==","signatures":[{"sig":"MEYCIQCD1n6ZgG3eYPJFHpfQp0jNdCJiRF+cWIPxTGhsJGwqTgIhALF05nFZK3kiUOXX5tnWnq6jfk/6dPcta+iUE+B1kuin","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13689},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":"./dist/index.js","./hono":"./dist/hono.js","./next":"./dist/next.js","./express":"./dist/express.js","./fastify":"./dist/fastify.js","./handler":"./dist/handler.js"},"gitHead":"c820526915612c3ebc19aaa475115e298ae98138","scripts":{"build":"tsc","clean":"rm -rf dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"bejoyfuuul","email":"bejoyfuuul@gmail.com"},"repository":{"url":"git+https://github.com/aiendpoint/platform.git","type":"git","directory":"packages/serve"},"_npmVersion":"11.8.0","description":"Serve your /ai endpoint from any JS/TS framework - Express, Fastify, Next.js, Hono, NestJS","directories":{},"_nodeVersion":"24.11.1","publishConfig":{"access":"public"},"typesVersions":{"*":{"hono":["dist/hono.d.ts"],"next":["dist/next.d.ts"],"express":["dist/express.d.ts"],"fastify":["dist/fastify.d.ts"],"handler":["dist/handler.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.7.0","next":"^16.0.0","express":"^5.1.0","fastify":"^5.8.4","typescript":"^5.7.2","@types/node":"^22.10.0","@types/express":"^5.0.0"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4","fastify":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true},"fastify":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/serve_0.1.0_1774713168810_0.6737153420887256","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"_id":"@aiendpoint/serve@0.2.0","bugs":{"url":"https://github.com/aiendpoint/platform/issues"},"dist":{"shasum":"01036441d5b389acd0510c9868b00909833e35f7","tarball":"https://registry.npmjs.org/@aiendpoint/serve/-/serve-0.2.0.tgz","fileCount":21,"integrity":"sha512-63Bjiesc4RKKhjci1BKoUO6wnhoECH3PD9ZEJUaDiG+uuhAsmVURs4jnQUwNgm33lDdnDk7vEZbA0eY+t2KH6w==","signatures":[{"sig":"MEUCIQCnW/Cu5QxlO+vnT0UKuk9fGEgHVcOA38HFsOaIdfrsQQIgB8wgXNXiz90LKJhCAUVAL73pxSZCxunfYwDcn3dwYrw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDyCNnUM7rxAjGLrws8VXe6KLBktn+B0fXX++lZM7s2NAIhAMoPss7BuKtcTJ1OOTz6d/IYivmS4FRR34QPkLob0GX2"}],"unpackedSize":28002},"main":"dist/index.js","name":"@aiendpoint/serve","type":"module","_from":"file:/tmp/aiendpoint-release-m362HV/aiendpoint-serve-0.2.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":"./dist/index.js","./hono":"./dist/hono.js","./next":"./dist/next.js","./express":"./dist/express.js","./fastify":"./dist/fastify.js","./handler":"./dist/handler.js"},"license":"Apache-2.0","scripts":{"build":"tsc","clean":"rm -rf dist"},"version":"0.2.0","_npmUser":{"name":"bejoyfuuul","email":"bejoyfuuul@gmail.com"},"homepage":"https://aiendpoint.dev","keywords":["aiendpoint","ai","api","middleware","express","fastify","nextjs","hono","nestjs"],"_resolved":"/tmp/aiendpoint-release-m362HV/aiendpoint-serve-0.2.0.tgz","_integrity":"sha512-63Bjiesc4RKKhjci1BKoUO6wnhoECH3PD9ZEJUaDiG+uuhAsmVURs4jnQUwNgm33lDdnDk7vEZbA0eY+t2KH6w==","repository":{"url":"git+https://github.com/aiendpoint/platform.git","type":"git","directory":"packages/serve"},"_npmVersion":"11.16.0","description":"Serve your /ai endpoint from any JS/TS framework - Express, Fastify, Next.js, Hono, NestJS","directories":{},"maintainers":[{"name":"bejoyfuuul","email":"bejoyfuuul@gmail.com"}],"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"typesVersions":{"*":{"hono":["dist/hono.d.ts"],"next":["dist/next.d.ts"],"express":["dist/express.d.ts"],"fastify":["dist/fastify.d.ts"],"handler":["dist/handler.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.13.5","next":"16.3.3","express":"^5.1.0","fastify":"^5.12.1","typescript":"^5.7.2","@types/node":"^22.10.0","@types/express":"^5.0.0"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4","fastify":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true},"fastify":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/serve_0.2.0_1789447608531_0.11377652781903902"}}},"time":{"created":"2026-03-28T15:52:48.750Z","modified":"2026-09-15T04:46:48.818Z","0.1.0":"2026-03-28T15:52:48.950Z","0.2.0":"2026-09-15T04:46:48.617Z"},"bugs":{"url":"https://github.com/aiendpoint/platform/issues"},"license":"Apache-2.0","homepage":"https://aiendpoint.dev","keywords":["aiendpoint","ai","api","middleware","express","fastify","nextjs","hono","nestjs"],"repository":{"url":"git+https://github.com/aiendpoint/platform.git","type":"git","directory":"packages/serve"},"description":"Serve your /ai endpoint from any JS/TS framework - Express, Fastify, Next.js, Hono, NestJS","maintainers":[{"name":"bejoyfuuul","email":"bejoyfuuul@gmail.com"}],"readme":"# @aiendpoint/serve\n\nServe your `/ai` endpoint from any JS/TS framework. One package, one install.\n\n## Install\n\n```bash\nnpm install @aiendpoint/serve\n```\n\n## Usage\n\n### Express\n\n```ts\nimport express from 'express'\nimport { aiendpoint } from '@aiendpoint/serve/express'\n\nconst app = express()\napp.use(aiendpoint({ spec: './ai.json' }))\napp.listen(3000)\n```\n\n### Fastify\n\n```ts\nimport Fastify from 'fastify'\nimport { aiendpoint } from '@aiendpoint/serve/fastify'\n\nconst app = Fastify()\napp.register(aiendpoint, { spec: './ai.json' })\napp.listen({ port: 3000 })\n```\n\n### Next.js (App Router)\n\n```ts\n// app/ai/route.ts\nimport { aiendpoint } from '@aiendpoint/serve/next'\n\nexport const GET = aiendpoint({ spec: './ai.json' })\n```\n\n### Hono\n\n```ts\nimport { Hono } from 'hono'\nimport { aiendpoint } from '@aiendpoint/serve/hono'\n\nconst app = new Hono()\napp.use(aiendpoint({ spec: './ai.json' }))\nexport default app\n```\n\n### NestJS\n\nNestJS uses Express under the hood. Use the Express adapter:\n\n```ts\n// main.ts\nimport { aiendpoint } from '@aiendpoint/serve/express'\n\napp.use(aiendpoint({ spec: './ai.json' }))\n```\n\n## Options\n\nAll adapters accept the same options:\n\n```ts\naiendpoint({\n  spec: './ai.json',  // path to spec file, or inline object\n  path: '/ai',        // route path (default: '/ai')\n  maxAge: 3600,       // Cache-Control max-age in seconds (default: 3600)\n})\n```\n\n## Generate ai.json\n\n```bash\nnpx @aiendpoint/cli init --openapi https://your-api.com/openapi.json\nnpx @aiendpoint/cli init  # interactive wizard\n```\n\n## Custom adapter\n\nFor frameworks not listed above, use the shared utilities:\n\n```ts\nimport { loadSpec, cacheHeader } from '@aiendpoint/serve/handler'\n\nconst spec = loadSpec('./ai.json')\n// serve `spec` as JSON with header `Cache-Control: ${cacheHeader(3600)}`\n```\n\n## Links\n\n- [aiendpoint.dev](https://aiendpoint.dev)\n- [@aiendpoint/cli](https://www.npmjs.com/package/@aiendpoint/cli)\n- [GitHub](https://github.com/aiendpoint/platform)\n\n## Both discovery paths\n\n`/.well-known/ai` is preferred; `/ai` remains a compatibility alias. CLI codegen\ncreates both routes. Express/Fastify/Hono serve adapters map both by default.\nIn Next.js, keep the handler in `app/ai/route.ts` and add:\n\n```ts\n// app/.well-known/ai/route.ts\nexport { GET } from '../../ai/route'\n```\n\nUse the same layout under `src/app` if that is where your routes live. An existing\nrewrite from `/.well-known/ai` to `/ai` is equally valid. There is no copied JSON\nfile to keep in sync.\n","readmeFilename":"README.md"}