Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
12 replies
Gabriel

How can I use a TurboRepo to have multiple Apps? Do I use multiple Next.JS projects? Help with infra

Hi folks, I need some help in understanding how I can setup my infrastructure

I want:
- Any number of apps, that consume a single backend. (Or maybe I need multiple backends, I still don't know.)
- My idea is to have one single TRPc Endpoint being served on one MASTER server, which would probably be a Next.JS app on Vercel.
- An infrastructure that allows me to deploy any number of applications when I want, in order to scale my company in any way I want.
- TurboRepo would be used for me to have my apps (E.G.): my Master Next.JS application, and then my Expo React Native app, and then my other webapps (these other webapps I still don't understand how I need to handle)

Ok, so these are a few points I need. And as you just read from this last bullet point I wrote, Ideally I would have a TurboRepo for ALL of my apps. However, I still do not understand how to do it in a correct way. Should I have multiple Next.Js applications? But wouldn't that make me have multiple servers in Vercel? (serverless functions, I know. But still, a separate "server"). I don't want to scatter my backend all around, but I still want to use my Create-T3-App as my MASTER app.

Yesterday, I deployed the starter turboRepo project to Vercel, which contains 2 Next.JS apps. And as you would Imagine, since Next.JS is a backend framework, It deploys the serverless functions for these 2 apps, so essentially, I have 2 "backends". In doing this, I tried to envision how I could scale this monorepo to have multiple apps, just like this way I tried with these 2 apps. After some thought, I created this diagram:
https://excalidraw.com/#json=4ztK98vS0jiYkz68Y30nM,EFvIKEsJoQj33wKH3o9IqA -- Excalidraw link
image.png
Excalidraw
Excalidraw is a virtual collaborative whiteboard tool that lets you easily sketch diagrams that have a hand-drawn feel to them.
Excalidraw — Collaborative whiteboarding made easy
Was this page helpful?