Struggling to Choose a Type-Safe Backend for a Podcast Streaming Service Without a Monorepo

I’m building a podcast streaming service using Next.js for the web and a React Native app for mobile. I’m not sure what to do about the backend. I really want to use tRPC for both, but tRPC feels a bit complex since I don’t want to use a monorepo (it’s an extra headache). I want to keep them in separate repositories. Here’s my current idea: - Use raw Next.js API routes (without tRPC) and consume that API in the React Native app. - Alternatively, use Hono.js as a serverless framework, host it on Cloudflare Workers, and consume it in both Next.js and React Native. The problem is that neither approach will be type-safe, and I think that will cause more headaches in the long run. You might suggest using GraphQL with a type generation tool, but I’ve tried writing GraphQL backends before and found the experience horrible. What should I do? I’d love to hear your thoughts.
10 Replies
niko
nikoOP3d ago
also I want to pick good architecture from beginning because when it'll scale I dont want to try changing some stuff in backend
Neto
Neto3d ago
can't you export the hono type as a dep?
Neto
Neto3d ago
RPC - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
Neto
Neto3d ago
or "publish" the whole app as well or a git submodule
[api repo]

[nextjs repo]
[api repo]

[rn repo]
[api repo]
[api repo]

[nextjs repo]
[api repo]

[rn repo]
[api repo]
when you make changes to the api repo, just pull it in the specific other repo
niko
nikoOP3d ago
wow I didnt know about that is there tool for type generation such as graphql-cli? i'm building rn for trpc, made it as well to use that for my use case but i was getting CORS errors in another project when i was making request
Neto
Neto3d ago
You should ignore the export type part Use the submodule and avoid a whole lot of issues
niko
nikoOP3d ago
okay that looks fine
Neto
Neto3d ago
It’s not the standard these days but should work in your case You just need to check how to deploy stuff with submodules But regardless, it’s an option
niko
nikoOP3d ago
so in my use case graphql is the best option i guess right? its standard
Neto
Neto3d ago
Do you want to use code generation? You can use OpenAPI + openapi generator
Want results from more Discord servers?
Add your server