Usually there are tools that automate code generation for you. But recently, there's been a new framework called tRPC.
https://github.com/trpc/trpc
Also, they made an example repo with react native:
https://github.com/KATT/zart
tRPC gives you full stack safety. So monorepos is the way to go if you use tRPC.