nextjs / trpc as backend vs dedicated backend
maybe a bit better to ask here hehe:
i had been wondering about this for a while, but when do you guys usually decide that trpc / server actions / nextjs api routes are just not enough and move off to a separate backend?
4 Replies
one case i've had is that my main product is the api and the frontend is 1/4 of the usage. In this case i still have a 'core logic' package that both the frontend and backend is using. So my frontend still has its own backend, it's not even 'calling the api' :poohheh:
The main reason is i don't like doing one file per route. Also the separate deployments is kinda nice in my case.
Also obviously if i have a performance critical / long running processes i'd also use a different language but that's more a js problem than nextjs one. I have yet to encounter that in my work tho
I'm also wondering this, at what point should we have a separated backend for a full-stack app?
i see, but thats a different usecase :D
its just an API you provide and your frontend is just the docs / marketing page for it
but the api you provide, is it pure nextjs api routes?
in my case i use hono. And my frontend isn't even next.js, i use Astro 😅
But it's the same idea because astro's api endpoints also only do one route per file
in short the two main considerations are dx (aka taste) and performance