{"_id":"@arcjet-vendor/connectrpc-connect-next","_rev":"3-d754bdb24c05cef6ca0cc281624bb64e","name":"@arcjet-vendor/connectrpc-connect-next","dist-tags":{"latest":"1.7.1"},"versions":{"1.7.1":{"name":"@arcjet-vendor/connectrpc-connect-next","version":"1.7.1","license":"Apache-2.0","_id":"@arcjet-vendor/connectrpc-connect-next@1.7.1","maintainers":[{"name":"quinn-arcjet","email":"quinn@arcjet.com"}],"homepage":"https://github.com/connectrpc/connect-es#readme","bugs":{"url":"https://github.com/connectrpc/connect-es/issues"},"dist":{"shasum":"243569e593c83f5958e797ea22a7ae51aeeb34c7","tarball":"https://registry.npmjs.org/@arcjet-vendor/connectrpc-connect-next/-/connectrpc-connect-next-1.7.1.tgz","fileCount":11,"integrity":"sha512-Az89iteJ3kGTWNJpJeccwvQIPK9WGo6oZuQOoDQ2/lY0nfjdDZvN1iaDAwNhe5MnqylLTuLL4wUbXisPaQ5iOA==","signatures":[{"sig":"MEUCICt+VSQbqFb+uRcKditgYxMQArwzlfcv5AjzRYSYzhzVAiEAr0WpBuZYFv8yS7est053aKIxH4c1O5UzXx1Ct4n+lDY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14783},"main":"./dist/cjs/index.js","type":"module","types":"./dist/cjs/index.d.ts","engines":{"node":">=16.0.0"},"exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f7eddb5136ff9cfd48b03377925b3053f848e09c","scripts":{"attw":"attw --pack","lint":"eslint --max-warnings 0 .","build":"npm run build:cjs && npm run build:esm","format":"prettier --write --ignore-unknown '.' '!dist'","prebuild":"rm -rf ./dist/*","build:cjs":"tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'","build:esm":"tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm","license-header":"license-header"},"_npmUser":{"name":"quinn-arcjet","email":"quinn@arcjet.com"},"repository":{"url":"git+https://github.com/connectrpc/connect-es.git","type":"git","directory":"packages/connect-next"},"_npmVersion":"10.8.2","description":"> ⚠️ **Vendored fork**   > Maintained by Arcjet for internal/product use. May diverge from upstream.","directories":{},"sideEffects":false,"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"@arcjet-vendor/connectrpc-connect":"1.7.1","@arcjet-vendor/connectrpc-connect-node":"1.7.1"},"peerDependencies":{"next":"^13.2.4 || ^14.2.5","@bufbuild/protobuf":"^1.10.0","@arcjet-vendor/connectrpc-connect":"1.7.1","@arcjet-vendor/connectrpc-connect-node":"1.7.1"},"_npmOperationalInternal":{"tmp":"tmp/connectrpc-connect-next_1.7.1_1769558355309_0.9224356594724088","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2026-01-27T23:59:15.226Z","modified":"2026-02-06T01:50:02.180Z","1.7.1":"2026-01-27T23:59:15.456Z"},"bugs":{"url":"https://github.com/connectrpc/connect-es/issues"},"license":"Apache-2.0","homepage":"https://github.com/connectrpc/connect-es#readme","repository":{"url":"git+https://github.com/connectrpc/connect-es.git","type":"git","directory":"packages/connect-next"},"description":"> ⚠️ **Vendored fork**   > Maintained by Arcjet for internal/product use. May diverge from upstream.","maintainers":[{"name":"davidmytton","email":"david@arcjet.com"},{"name":"quinn-arcjet","email":"quinn@arcjet.com"}],"readme":"> ⚠️ **Vendored fork**  \n> Maintained by Arcjet for internal/product use. May diverge from upstream.\n\n# @arcjet-vendor/connectrpc-connect-next\n\nConnect is a family of libraries for building and consuming APIs on different languages and platforms, and\n[@arcjet-vendor/connectrpc-connect](https://www.npmjs.com/package/@arcjet-vendor/connectrpc-connect) brings type-safe APIs with Protobuf to\nTypeScript.\n\n`@arcjet-vendor/connectrpc-connect-next` provides a plugin for [Next.js](https://nextjs.org/),\nthe React Framework for the Web.\n\n### nextJsApiRouter()\n\nProvide your Connect RPCs via Next.js API routes. To enable Connect in Next.js,\nadd two files to your project:\n\n```diff\n.\n├── connect.ts\n└── pages\n    └── api\n        └── [[...connect]].ts\n```\n\n> **Note:** Next.js 13 introduced the new App Router. Your Connect API routes\n> need to be placed in `pages/`, but you can use the `app/` directory for the\n> App Router at the same time.\n\nThe new file `connect.ts` is where you register your RPCs:\n\n```ts\n// connect.ts\nimport { ConnectRouter } from \"@arcjet-vendor/connectrpc-connect\";\n\nexport default function (router: ConnectRouter) {\n  // implement rpc Say(SayRequest) returns (SayResponse)\n  router.rpc(ElizaService, ElizaService.methods.say, async (req) => ({\n    sentence: `you said: ${req.sentence}`,\n  }));\n}\n```\n\n`pages/api/[[..connect]].ts` is a Next.js [catch-all API route](https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes):\n\n```ts\n// pages/api/[[..connect]].ts\nimport { nextJsApiRouter } from \"@arcjet-vendor/connectrpc-connect-next\";\nimport routes from \"../../connect\";\n\nconst { handler, config } = nextJsApiRouter({ routes });\nexport { handler as default, config };\n```\n\nWith that server running, you can make requests with any Connect or gRPC-Web client.\nNote that Next.js serves all your RPCs with the `/api` prefix.\n\n`curl` with the Connect protocol:\n\n```bash\ncurl \\\n    --header \"Content-Type: application/json\" \\\n    --data '{\"sentence\": \"I feel happy.\"}' \\\n    --http2-prior-knowledge \\\n    http://localhost:3000/api/connectrpc.eliza.v1.ElizaService/Say\n```\n\nNode.js with the gRPC-web protocol (using a transport from [@arcjet-vendor/connectrpc-connect-node](https://www.npmjs.com/package/@arcjet-vendor/connectrpc-connect-node)):\n\n```ts\nimport { createClient } from \"@arcjet-vendor/connectrpc-connect\";\nimport { createGrpcWebTransport } from \"@arcjet-vendor/connectrpc-connect-node\";\nimport { ElizaService } from \"./gen/eliza_connect.js\";\n\nconst transport = createGrpcWebTransport({\n  baseUrl: \"http://localhost:3000/api\",\n  httpVersion: \"1.1\",\n});\n\nconst client = createClient(ElizaService, transport);\nconst { sentence } = await client.say({ sentence: \"I feel happy.\" });\nconsole.log(sentence); // you said: I feel happy.\n```\n\nA client for the web browser actually looks identical to this example - it would\nsimply use `createConnectTransport` from [@arcjet-vendor/connectrpc-connect-web](https://www.npmjs.com/package/@arcjet-vendor/connectrpc-connect-web)\ninstead.\n\nNote that support for gRPC is limited, since many gRPC clients require HTTP/2,\nand Express does not support the Node.js `http2` module.\n\n### Deploying to Vercel\n\nCurrently, `@arcjet-vendor/connectrpc-connect-next` does not support the Vercel Edge runtime.\nIt requires the Node.js server runtime, which is used by default when deploying\nto Vercel.\n\n## Getting started\n\nTo get started with Connect, head over to the [docs](https://connectrpc.com/docs/node/getting-started)\nfor a tutorial, or take a look at [our example](https://github.com/connectrpc/connect-es/tree/main/packages/example).\n","readmeFilename":"README.md"}