t3-oss / create-t3-app

The best way to start a full-stack, typesafe Next.js app
https://create.t3.gg
MIT License
25.52k stars 1.18k forks source link

feat: Adding an option to create t3 in turborepo #327

Closed azezsan closed 2 years ago

azezsan commented 2 years ago

Is your feature request related to a problem? Please describe.

T3 is very good modern day stack but I struggle to put T3 in a turborepo there is a lot of things to setup and it's hard to know which is the best practice when building the turborepo

Describe the solution you'd like to see

I wish there was an option to select whether you would like T3 to be built in a normal repo or a turborepo/monorepo

if you would look to the T3 stack, it fits perfectly with turborepo, as turborepo is by vercel and it expects you to be using a stack very similar to T3

Desribe alternate solutions

.

Additional information

No response

c-ehrlich commented 2 years ago

I have never used turborepo, but would there be any differences between T3 in a turborepo and just a normal Next.js app in a turborepo?

azezsan commented 2 years ago

I have never used turborepo, but would there be any differences between T3 in a turborepo and just a normal Next.js app in a turborepo?

I'm not an expert but I don't think there is a difference, as far as I know, it's just that monorepos are a good repo structure for large businesses/projects and makes the repo easy to scale, bug testing and much more since everything will be in the same repo, here is a video by Vercel that goes much more in-depth https://www.youtube.com/watch?v=YX5yoApjI3M&t=

nexxeln commented 2 years ago

Hey, I'm interested as to what you're putting in the monorepo. If you need just a single t3 web app, turborepo is probably unecessary.

If you're trying to integrate tRPC into an expo react-native app, I think that is outside the scope of create-t3-app. For now these will help you get started:

I would love to know what you're trying to do exactly.

azezsan commented 2 years ago

I don't have an exact use case at the moment, but I'm planning to build a saas using this stack and I do believe that at some point I will probably be looking to scale to more areas, maybe I would like to have a desktop app and a Web app which is very common, I wouldn't want electron to be in it's on repo, and having both the web app and desktop app use the same design system/components from the same files can save a lot of time and makes sure that they look the same, testing will be easier as well.

for building a large saas it just felt like a no-brainer to have the right foundation for expansion later on to whatever area that fits best

c-ehrlich commented 2 years ago

I still don't see what we can offer here though. I think anyone who wants a "turborepo starter" should just find one with Next.js and swap that app for a T3 App.

azezsan commented 2 years ago

I still don't see what we can offer here though. I think anyone who wants a "turborepo starter" should just find one with Next.js and swap that app for a T3 App.

Currently, tRPC asks for a file structure that isn't compatible with how turborepo works, the idea of turborepo is to have the server and the components easily accessible so you can build other things and link them to the same server and the same design system, what you can offer is an easier way that connects all these technologies while following the best practices that they recommend, as this isn't as simple as just installing a npm package and it will be compatible, it's kind of a hassle to setup really.

juliusmarminge commented 2 years ago

Look out for my upcoming blog post on how to convert your T3-app into a monorepo with a shared trpc router.

Should be up in a few days!

As for the CLI including this as an option, this would increase the complexity by magnitudes.

azezsan commented 2 years ago

Look out for my upcoming blog post on how to convert your T3-app into a monorepo with a shared trpc router.

Should be up in a few days!

As for the CLI including this as an option, this would increase the complexity by magnitudes.

That would be super helpful I'll for sure be looking for that tutorial 👍🏻

avrapaulo commented 2 years ago

@juliusmarminge Really good post. It will help me a lot. Can you change https://github.com/juliusmarminge/turbo-tutorial/tree/bad6fd74335558355ab55b498d9bdbe9cd54fb7c to be public? And the other ones also 🙏

juliusmarminge commented 2 years ago

@juliusmarminge Really good post. It will help me a lot. Can you change https://github.com/juliusmarminge/turbo-tutorial/tree/bad6fd74335558355ab55b498d9bdbe9cd54fb7c to be public? And the other ones also 🙏

Post should be all done now and links should point to the right places. Here is the final repo: https://github.com/juliusmarminge/create-t3-turbo

azezsan commented 2 years ago

thank you so much for the post, it saved me and others so much time I wish you the best @juliusmarminge ^^

ldmsh commented 2 years ago

thanks for the post