In the official documentation for trpc, the section for server action advises to use Unkey for setting up rate limiting on your trpc server.
You can find code examples of this implementation here: https://trpc.io/blog/trpc-actions#rate-limiting