Hybrid SSR + SPA in TanStack Start?
I currently maintain two separate projects that are organized in a monorepo:
• A TanStack Start app (SSR) that serves as an admin/dashboard for configuring my main app
• A TanStack Router SPA for the core user-facing experience (client-side routing only, for performance and offline support)
I’d like to consolidate them into a single codebase using TanStack Start as the foundation, but still:
• Serve the dashboard routes via SSR
• Serve the main app routes entirely on the client (SPA) with TanStack Router
Has anyone successfully done this “hybrid” routing setup with TanStack Start+Router? If so:
• How did you split your route definitions (filesystem vs. client router)?
• How do you bootstrap the client–only router inside a subset of the SSR app?
• Any special loader/action considerations or pitfalls around data fetching, code-splitting or offline support?
• Best practices for folder structure / entry points?
I’ve seen examples in Next.js, Theo and t3.chat’s hybrid patterns (https://www.youtube.com/watch?v=QLvIoi2s1zY&t=238s) and Josh tried coding (https://x.com/joshtriedcoding/status/1921886068342731149), but I’m not sure how to translate that to TanStack’s router and Start framework. Any guidance, code samples or pointers to relevant docs would be hugely appreciated!
Theo - t3․gg
YouTube
How I Built T3 Chat in 5 Days
I built the fastest AI chat app in 5 days. A lot of y'all asked how. Hopefully this helps answer :)
Thank you CodeRabbit for sponsoring! Check them out at: https://soydev.link/coderabbit
CHECK OUT T3 CHAT: https://t3.chat/
Check out my Twitch, Twitter, Discord more at https://t3.gg
S/O Ph4se0n3 for the awesome edit 🙏
6 Replies
harsh-harlequin•3mo ago
i am not sure if I correctly understand the setup
in start, only the initial request is SSRed
every subsequent navigation happens on the client side
sensitive-blueOP•3mo ago
I guess what I'm asking is that is it possible to have /dashboard and child routes be rendered using start+router, and the rest of the routes only rendered by router like a SPA.
harsh-harlequin•3mo ago
what does this mean though
"only rendered by router like a SPA"
do you mean you dont want the initial SSR for those routes?
sensitive-blueOP•3mo ago
yes, I don't want them to require a server and work offline
harsh-harlequin•3mo ago
thats a different thing then
you will need to serve the html + JS somehow
also "work offline" can mean a lot
doesnt really touch start vs. router
unless you use server functions / server routes
so going back to start. after the initial SSR response, everything happens on the client. each navigation
the only thing you need a server for at that point is: loading JS files
and other assets such as css, images
there is no JS execution on the server
sensitive-blueOP•3mo ago
Ah ok. Thanks for the clarification!