I imagine it would be best to handle that in a trpc middleware. You could create a fastify plugin since trpc context gives you access to the fastify request and reply, but I think that would make it trickier since fastify has no awareness of the batching like you said.