T
TanStack12mo ago
genetic-orange

TanStack Start with SPA

I use Router w/Express for a production app (and it's great, thank you!), but for a new app I'd like to skip the Express part, but still use a react SPA with some basic API routes. Is this supported with Start? Even if it's requires a custom vinxi/app config. Thanks!
3 Replies
flat-fuchsia
flat-fuchsia12mo ago
It seems like you're describing full stack frameworks. Start works as CSR as a default I think. But you also have server actions for backend only work. The getting started setup will start you with GET and POST actions. Should be enough to get started. I don't know what "SPA" means to anyone anymore. But to me it means single entry point, huge initial load of the entire app. No framework does this anymore.
genetic-orange
genetic-orangeOP12mo ago
Tanner covered this well on X. Found it after I posted: https://x.com/tannerlinsley/status/1829278625369297131?s=46
Tanner Linsley (@tannerlinsley) on X
@fitimbyttyqi @tan_stack Yep. You'll be able to use it for client-side only stuff too. We're still working on that SPA experience, so as of right now, you could just use TanStack Router + Vite and get 90% of start. But I'd like to make it easy for people to do something in between so you can have an SPA
Twitter
plain-purple
plain-purple12mo ago
I'm also interested in using Start as a SPA PWA offline first approach. That frameworks doesnt do it any more is simply wrong, even Remix added the SPA mode not long ago. For an app which requires full authorisation this approach can make sense, especially if with backends like Hasura where the whole security is baked into RLS of the database. For sure the initial load of the page is big but its needed to be able to cache everything for offline use. I use currently Vite + vite-plugin-pwa but interested if I can use Start sometimes to easily integrate api endpoints. I am aware that server functions wouldn't work but currently I juggle Vercel / AWS lambda endpoints but would love to use api routes similar I am defining other routes.

Did you find this page helpful?