Skip to content

Add @fastify/tanstack renderer for TanStack Router SSR#421

Open
jamcalli wants to merge 5 commits intofastify:mainfrom
jamcalli:main
Open

Add @fastify/tanstack renderer for TanStack Router SSR#421
jamcalli wants to merge 5 commits intofastify:mainfrom
jamcalli:main

Conversation

@jamcalli
Copy link
Copy Markdown
Contributor

@jamcalli jamcalli commented Apr 14, 2026

Hi,

This adds a @fastify/tanstack renderer for TanStack Router SSR support.

I've been working on this in my own fork and it appears to be working well. I haven't included documentation updates yet as I wanted to check for upstream interest first. Totally understand if it's one more thing to maintain. I did include an example at examples/tanstack-vanilla-ts.

The PR also aligns the RendererOption/RendererFunctions types in renderer.ts with the actual runtime signatures. The existing types had drifted from options.ts and the runtime call sites. This was surfaced by building the first TypeScript renderer.

Cheers.

Checklist

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 14, 2026

⚠️ No Changeset found

Latest commit: 29c3f80

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@onlywei
Copy link
Copy Markdown
Collaborator

onlywei commented Apr 15, 2026

Hi @jamcalli -- biggest problem with this is that I don't have permission to create more packages under the @fastify namespace, otherwise I would have done so for this other repo I have: https://github.com/onlywei/fastify-tanstack-start

@jamcalli
Copy link
Copy Markdown
Contributor Author

That is a bit of a problem. I gave your implementation a once over. Your Start use case is useful for sure. My approach was to include just the TanStack Router as a renderer mirroring how @fastify/react and @fastify/vue are handled directly within the Fastify-Vite.

How would you go about obtaining permissions? It seems like something that should be obtainable given the nature of shipping the plugins as individually installed packages. I'm sure there will be interest in including Svelte etc. somewhere down the pipeline.

@climba03003
Copy link
Copy Markdown
Member

Hi @jamcalli -- biggest problem with this is that I don't have permission to create more packages under the @fastify namespace, otherwise I would have done so for this other repo I have: https://github.com/onlywei/fastify-tanstack-start

@onlywei
Let me knows how can I helps you.
I can publish the package if you review the code here and add the required permission afterward.
So, you have permission to release it later.

@onlywei
Copy link
Copy Markdown
Collaborator

onlywei commented Apr 17, 2026

@climba03003 If you're able to help, #345 is higher on my priority list than this one.

I haven't fully decided whether it's better to just support Tanstack Router or fully support Tanstack Start yet. I think that's worth a discussion with @jamcalli here.

@jamcalli
Copy link
Copy Markdown
Contributor Author

@climba03003 If you're able to help, #345 is higher on my priority list than this one.

I haven't fully decided whether it's better to just support Tanstack Router or fully support Tanstack Start yet. I think that's worth a discussion with @jamcalli here.

I personally find TanStack Start a bit opinionated. The renderer approach handles route discovery, streaming, dehydrating router state, and preloading assets while allowing Fastify to handle everything else. It's more aligned with the existing renderer plugins. The full Start appears to hand most things off to Start's built handler, and Fastify becomes more of a host. I think the approaches are largely mutually exclusive.

This was just something I was messing around with though, and I'm not trying to argue that it should be included. Ultimately that's up to you, but I thought it was worthwhile submitting to see if you'd want it upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants