T
TanStack•4w ago
conscious-sapphire

What is the best to use Tanstack Start with a node.js backend like Fastify?

Hello, what is the best to use Tanstack Start with a node.js backend like Fastify for a full-stack project? Is using a monorepo the best way to do it? Thanks.
15 Replies
sensitive-blue
sensitive-blue•4w ago
When you need/want separate backend and frontend then I think better to use your own backend and Tanstack Router instead of Tanstack Start but if you need some BFF ( Backend for frontend ) then all fine to use Tanstack Start.
absent-sapphire
absent-sapphire•4w ago
With Start RC release, you can now use any backend you want, there's an example of using express, not yet documented as far as I can tell, but here's the code: https://github.com/TanStack/router/tree/main/e2e/react-start/custom-basepath
GitHub
router/e2e/react-start/custom-basepath at main · TanStack/router
🤖 A client-first, server-capable, fully type-safe router and full-stack framework for the web (React and more). - TanStack/router
absent-sapphire
absent-sapphire•4w ago
I personally migrating all our frontend fastify apps to use start, while keeping all our backend infra still working, like telemetry, loging, auth, etc.
conscious-sapphire
conscious-sapphireOP•4w ago
Thank you for the input. If you keep your backend in 2 separate places so I reckon you're using a monorepo right? I really like this solution. I want to build a simple e-commerce website and I think I only need SSR (for SEO) so from your take I think Monorepo/TSRouter/tRPC would be the best stack. What do you think.
absent-sapphire
absent-sapphire•4w ago
Like all of it besides tRPC, I personally dislike it a lot, but just my opinion, and I think it is not that needed with react query + server fns and yes I am using a monorepo, but my structure is that the backend (fastify part) is really not doing much and both the backend and frontend are in the same package
conscious-sapphire
conscious-sapphireOP•4w ago
what are you best alternatives of trpc if the backend is separate from the frontend but same monorepo?
absent-sapphire
absent-sapphire•4w ago
I personally switched to generating tanstack query sdk from our api schema using openapi schema that we generate for each of our backends we have a lot of microservices each one of them has a dedicated npm sdk library which is just a thin wrapper to call useQuery with the right typing tRPC kept breaking almost every minor version update which lead to a lot of our backend developers being pissed
sensitive-blue
sensitive-blue•4w ago
You can use oRPC instead of tRPC, I am using that in news projects, really simple and can use contract based when you want ( I am not using it because using tanstack start ) and you have openAPI handler whenn want to expose that https://orpc.unnoq.com/
oRPC - Typesafe APIs Made Simple 🪄
Easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
sensitive-blue
sensitive-blue•4w ago
You can create your complete app just using that CLI => https://www.better-t-stack.dev/
Better-T-Stack
Better-T-Stack
A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations
sensitive-blue
sensitive-blue•4w ago
Plus add documentations with fumadoc 🙂 The fast way to create projects with tanstack Start from my opinion! With that start you can start your app with all that you need, DB / oRPC / AUTH / UI Components / Mobile / Backend
conscious-sapphire
conscious-sapphireOP•4w ago
Thank u very much for the tool, it looks cool but it has like 86 open issues on gh though Thank you also for the oRPC suggestion, never heard about it before. May I ask why u r not using orpc bc u using tanstack start? I read somewhere that orpc is very good with server functions.
sensitive-blue
sensitive-blue•4w ago
I am using oRPC on my projects with tanstack Start, before I was using tRPC "Thank u very much for the tool, it looks cool but it has like 86 open issues on gh though" this is not bad, you need try it and check how him take care about the issues
sensitive-blue
sensitive-blue•4w ago
Look on Tanstack Start :
No description
sensitive-blue
sensitive-blue•4w ago
Or Next
No description
sensitive-blue
sensitive-blue•4w ago
The count of issues is not the value that you need to check, you need to check if this is an real issue ( Library Issue / User Issue / System Issue ) and how the lib/ organization manage that, how much the guys are working on new features / fixing bugs etc

Did you find this page helpful?