Next.js Adapter
tRPC's support for Next.js is far more expansive than just an adapter. This page covers a brief summary of how to set up the adapter, but complete documentation is available here
Example app
| Description | Links | 
|---|---|
| Next.js Minimal Starter | 
Next.js example
Serving your tRPC router in a Next.js project is straight-forward. Just create an API handler in pages/api/trpc/[trpc].ts as shown below:
pages/api/trpc/[trpc].tsts
pages/api/trpc/[trpc].tsts
Handling CORS, and other Advanced usage
While you can usually just "set and forget" the API Handler as shown above, sometimes you might want to modify it further.
The API handler created by createNextApiHandler and equivalents in other frameworks is just a function that takes req and res objects. This means you can also modify those objects before passing them to the handler, for example to enable CORS.
pages/api/trpc/[trpc].tsts
pages/api/trpc/[trpc].tsts
Route Handlers
If you're trying out the Next.js App Router and want to use route handlers, you can do so by using the fetch adapter, as they build on web standard Request and Response objects:
app/api/trpc/[trpc]/route.tsts
app/api/trpc/[trpc]/route.tsts