tRPC - Express - Next.js boilerplate
Is there a tRPC boilerplate, that lives in an express.js context that allows you to use all express middlewares from npm, with an already set next.js server, with a folder structure like create-t3-app?
5 Replies
I do have a structure like that for my twitter clone, check the with-express branch
https://github.com/AlandSleman/t3-twitter-clone
GitHub
GitHub - AlandSleman/t3-twitter-clone: Twitter clone built with T3 ...
Twitter clone built with T3 Stack + NextAuth + Supabase + Prisma - GitHub - AlandSleman/t3-twitter-clone: Twitter clone built with T3 Stack + NextAuth + Supabase + Prisma
🤔
If you have any questions you can ask me, using express middlewares with trpc are easy you just use the middleware for the route you want then after the middleware is done it will get to your trpc route code.
I checked your code but i can't figure out how next is started and how your express server (in
server.ts
file) is started ? Did you start the server manually with node /path/to/server.js
or just next dev
?
In my code express is actually ignored and never call by express so the api is not started. Though the trpc middleware setup does not block next eitherYeah it's basically like that, you have to start both express and the next server separately.