Recommended file structure for next.js?
Hey all - using tRPC heavily with next.js and it's great. Our main
[trpc].ts
file is getting huge and unwieldily - wondering what the recommendations are out there for organizing?6 Replies
hi,
have you checked out this next example
https://github.com/trpc/trpc/tree/next/examples/next-prisma-starter
also check out the docs here: https://trpc.io/docs/v10/nextjs
theres a recommended file structure section
Hey thanks a bunch. I think these give you the basic layout but not how to break out [trpc].ts - is it recommended to put individual query/mutations in that same trpc directory for example?
i believe the starter projects shows you how to break up your routers and keep them outside the [trpc].ts file
https://github.com/trpc/trpc/blob/next/examples/next-prisma-starter/src/pages/api/trpc/%5Btrpc%5D.ts
the server folder structure: https://github.com/trpc/trpc/tree/next/examples/next-prisma-starter/src/server
Got it thanks!!
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
@latest uses v10 now too 🙂