Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

tRPC 10 with Next 13 App dir #37

Open
jacobgad opened this issue Nov 14, 2022 · 3 comments
Open

tRPC 10 with Next 13 App dir #37

jacobgad opened this issue Nov 14, 2022 · 3 comments

Comments

@jacobgad
Copy link

Thank you to anyone who takes the time to respond or share their thoughts on this matter.
With the condition that the app folder was used exsclusevly with client components (to gain access to the nested layouts feature),
is there a way to setup tRPC 10 to work in the app dir?

Thanks again

@jacobgad jacobgad changed the title tRPC 10 with App dir tRPC 10 with Next 13 App dir Nov 14, 2022
@nimeshvaghasiya
Copy link

nimeshvaghasiya commented Nov 14, 2022

@jacobgad I have started a new project with create-t3-app, I'm waiting for the same as you.

@thejus-r
Copy link

is there any way to make trpc routes inside app dir (using Route Handlers), its works inside pages/api but not in app/api..

@sebastianfdz
Copy link

There is an example of this working.

repo: https://github.com/devietti/trpc-next13-app
by: @devietti

The TLDR is: It uses the fetch adapter instead of the next adapter and adds an additional layer in the trpc client (instead of using /app/api/[trpc].ts he uses /app/api/[trpc]/route.ts

Worked for me, hope it helps.

Props to @devietti

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants