Skip to content
Writing

TanStack Start on Cloudflare Workers

tanstack · cloudflare

This site runs on TanStack Start deployed to Cloudflare Workers. The pairing is good, but a few edges drew blood. Here are the notes I wish I had read first.

What was smooth

File-based routing felt immediate. Dropping a file under src/routes/ and getting a typed route back is the kind of small delight that compounds. Intent-based preloading on link hover made navigation feel instant with zero extra code.

What bit

The worker runtime is not Node. Anything that reaches for fs, path, or a native module fails at the edge, not in dev:

The dev server is forgiving. The deploy is not. Test the build, not just npm run dev.

A couple of habits that saved me:

  • Run npm run build before every push, not just before release.
  • Keep loaders returning serializable data only. A React component or a class instance will not cross the SSR boundary.
  • Generate the Cloudflare env types with npm run cf-typegen and commit them.

None of this is hard once you know it. The trick is knowing it before the deploy, not after.