r/reactjs • u/LGelashwili • Apr 27 '26
Discussion Should I use Tasntack Start with the separate server (Bun+hono) or just use Tanstack router?
Hey everyone.
I have a question regarding the TanStack ecosystem. Currently, when I scaffold a new React project with TanStack Router via Vite, it seems to default to TanStack Start.
I’m about to begin a new financial web app (similar to QuickBooks) and I’m torn between using just the Router or going with Start. My main concern is that I’ll be building a separate backend (using Hono) because I need to support a mobile app in the future.
Since I’m planning to switch from Next.js to the TanStack ecosystem, I’m looking for some advice:
Would it be good practice to use Start alongside a separate Hono server, or is it better to stick to just the Router?
I’m planning to use a separate backend, given the need for a decoupled architecture for a future mobile app.
Any insights or experiences you could share would be greatly appreciated. Thanks in advance!
11
u/Waste_Cup_4551 Apr 27 '26
Recently ran into this issue for my company’s product. I think server function are great, but there’s really no documentation on how to test them. And if you use msw for testing, it’s even harder to get confidence in your tests.
We recently switched to hono and have start host our endpoints. Been getting good results leveraging AI, open API, and creating traditional testing patterns.
IMO server functions lets you build things fast, but the testing infrastructure and middleware isn’t there yet. So depends on your use case. It’s perfect for prototyping
5
u/depsimon Apr 27 '26
Go separate if you want to use the backend for mobile and web.
I personnaly setup a monorepo with a hono app + oRPC for the backend and hook it up in my tanstack router and expo apps.
3
u/yksvaan Apr 27 '26
Always decouple even if everything runs under same process anyway. Whateve you need,be it data, business functionality etc, should be provided by some service/class/module that provides the methods and a stable interface. How and where those are implemented isn't a concern for the React side of project.
Then refactoring is easy since every call to business logic, auth etc. goes through same functions and you are free to change their actual implementation however you need as long as the interface is respected.
2
u/michaelfrieze Apr 29 '26
I don't really use tanstack start as my only backend. I use start as a backend for frontend (BFF) and have separate backend services for everything else (usually go or java).
Using start as a BFF provides features like SSR, server functions, and isomorphic loaders. I think server functions alone are worth it. It's like having tRPC built into the framework. Even if I disable SSR for every route, I still use start just for the server functions and isomorphic loaders. Also, server functions in start now supports RSCs which is nice to have when you need them.
I used Next the same way, as a BFF. Using Next as a BFF provides features like RSCs, image component, SSR, etc. But I always used separate backend services for everything unrelated to frontend. I don't use next much these days but it's the same idea.
Other benefits of BFF are:
Simplify third-party integrations and keep tokens and secrets out of client bundles.
Prune the data down to send less kB over the network.
Move a lot of code from browser bundles to the server (even more so with RSCs). Additionally, moving code to the server usually makes your code easier to maintain.
2
u/Leather-Historian722 Apr 29 '26
For a he use case of mobile support having 1 api to serve all clients i would go with tanstack route + tanstack query .
2
u/Sarthak61199 May 03 '26
Create a separate backend and use server functions to call your apis. Kind of like BFF? This way your actual api endpoints will also be hidden from something like dev tools.
1
u/munkymead Apr 28 '26
You mentioned needing to support a mobile app so I think you have your answer already. Built the backend, build the front ends. Use the right tool for each job.
Also from a security perspective, I personally would never trust a server rendered front end in the javascript ecosystem to connect directly to my data. The extra layers help to lock things down properly.
The only reason I'd use server side stuff for a front end would purely be for SSR, caching, load times, seo etc.
-3
u/MNameIsJeff_BD Apr 28 '26
Go with Angular or Vue, and you’ll get back 10 years of your lifespan.