Using tRPC without the back-end lock-in. I like it now, but wanna be flexible in the future.

Hey, everyone! My use-case here is that I'm using NextJS for a project that relies on somewhat complex relationships, and am already doing some heavy-lifting, but not to the point where Node doesn't make sense right now, especially given the Need for Speed™. I was thinking graphql, but realistically, it's just very hard to get right, and you need a team of people who eat that stuff for breakfast to make it right, so, of course, REST was the next candidate. Obviously, we know the issues. tRPC is looking good, and I've NEVER tried it before, but it's looking exactly like what I need. Problem: tRPC definitely does seem lock you into the JS (TS) ecosystem, so, if your back-end becomes .NET, you're screwed. Or...are you? Are there patterns around tRPC that can consume, say, a JSON file to populate its client-side typings? In essence, I really tRPC, but wanna give myself some leeway in the distant future on the back-end, since I am certain that I'll be changing it. Thanks 🙂
2 Replies
Matvey
Matvey8mo ago
With https://kubb.dev you can generate react-query hooks (the same library trpc uses) from an openapi schema, so you can use sny language on the backend
Kubb: Generate SDKs for all your APIs
OpenAPI to TypeScript, React-Query, Zod, Zodios, Faker.js, MSW and Axios.
srikrsna
srikrsna8mo ago
https://github.com/bufbuild/knit You can write your backend in 10ish languages and it also has the features of GraphQL