Queues with TanStack Start?

I'm testing out using TanStack Start for an application, based on the framework quick start in the cloudflare docs (https://developers.cloudflare.com/workers/framework-guides/web-apps/tanstack/) but I'm not seeing a way to customize the worker code if I want to also add a Queue Consumer or a DO. Does anyone know how I can do that? It looks like react router, for example, will give you a way to generate a request handler (https://github.com/remix-run/react-router-templates/blob/main/cloudflare-d1/workers/app.ts).
Cloudflare Docs
TanStack
Create a TanStack Start application and deploy it to Cloudflare Workers with Workers Assets.
5 Replies
Razboy20
Razboy205mo ago
It should be the same as interacting with normal cf stuff; you can access it under the env that cf provides I.e. just call getBindings()
a-poor
a-poorOP5mo ago
Wouldn’t that be for pushing to a queue / interact with a DO but not if i wanted to export a DO class or a queue consumer? I thought that all had to be in the same worker export (which tanstack start generates for the final build but doesn’t seem to allow you to add anything)
Razboy20
Razboy205mo ago
You’re right, hm Practically, Tanstack isn’t the one generating the worker bundle, it’s Nitro under the hood that’s where “preset” comes from Tanstack start integration is still a little funky (cloudflare vite plugin can do more), you might be able to just write a queue/durable object class in a “use server” file (don’t remember whether tanstack still uses that format or not), then make a wrangler.json with the durable object/queue configuration
a-poor
a-poorOP5mo ago
Gotcha thanks. Maybe better options will show up once it’s out of beta. I’ll give that a try!
Razboy20
Razboy205mo ago
Yeah it’s a bit of an unfortunate case, I would like it to be better too! Love Tanstack and what they’re doing.

Did you find this page helpful?