sst icon indicating copy to clipboard operation
sst copied to clipboard

[QUESTION] Is it possible to integrate SST into an existing Turborepo project?

Open aaron5670 opened this issue 3 years ago • 10 comments

Hi all! 👋

First of all, thank you for this great tool. I really love it!

I have a small question. I have a large project built with Turborepo and Next.js. But now I want to use SST, but I can't find a way how to combine my existing Turborepo project with a new SST project.

Do you guys maybe have an example for me? Or is this even possible?

Thanks in advance!

aaron5670 avatar Feb 01 '23 18:02 aaron5670

yes I used to use turborepo alongside SST, hard to give a general answer it just depends on your setup

I wish say however because of how SST/CDK works you probably won't see much benefit in using turborepo alongside of it

thdxr avatar Feb 03 '23 02:02 thdxr

Okay, thank you. So you dont use SST with Turbo, but next to it in the same project repository?

aaron5670 avatar Feb 03 '23 06:02 aaron5670

@thdxr Do you perhaps have an example of what your package.json from the root directory looks like? 😄

aaron5670 avatar Feb 03 '23 18:02 aaron5670

I asked myself the same question last week. I tried using SST along with T3-stack and turborepo (from https://github.com/t3-oss/create-t3-turbo) and was not able to get it workin. (I disabled the expo workspace because I wanted to test deploying the nextjs-app only)

On the other hand I was able to integrate SST and t3stack without turbo (using https://github.com/t3-oss/create-t3-app) even with usage of prisma.

I really like how SST deploys everything to aws-lamba but I did not like using SST without a monorepo. Removing turbo from https://github.com/t3-oss/create-t3-turbo and using pnpm workspaces instead, seems like a bad idea to me. Unfortunately I have not the required understanding on how to integrate SST with a monorepo like turbo which puts me a bit on hold using SST. If I come up with a solution I will post it here.

philippmossier avatar May 02 '23 16:05 philippmossier

Yeah Turbo isn't terribly helpful. But we default to supporting pnpm and if you run npx create-sst@latest it'll create a mono repo for you.

jayair avatar May 02 '23 23:05 jayair

@jayair how would you setup an SST monorepo with a shared ui library and configs without Turbo? Would multiple apps in one SST monorepo be declared in the same sst.config.ts -> stacks(app) ?

seb-lewis avatar Jun 03 '23 19:06 seb-lewis

Yeah we do a mono repo is our standard setup https://docs.sst.dev/start/standalone

jayair avatar Jun 04 '23 02:06 jayair

If I have an existing turborepo with an app in apps/my-app, where should the SST files be?

I'm okay to move files around after runing yarn create sst or equivalent.

  1. Should sst.config.ts be inside apps/my-app or in the root of the turborepo?
  2. Should the /stacks folder be inside apps/my-app or in the root of the tuborepo?
  3. Should the packages/core and packages/functions from SST be inside apps/my-app or under my turborepo /packages folder?

I can understand it if doesn't work well but it still works right? @thdxr would it be possible to create a super minimal example of SST with turborepo or clarify where some of the files should be moved to as per questions 1/2/3 above?

paulwongx avatar Sep 19 '23 18:09 paulwongx

sst.config.ts needs to be in the root. stacks/ isn't a real "workspace" so it can be wherever. The rest of your workspaces depend on your package manager config.

jayair avatar Sep 19 '23 23:09 jayair

Any news on this... I've got a mono repo with 5 nextjs apps.

sst dev turbo dev breaks links

Having sst dev inside each packages dev script throws an error about to many sst instances.

magicspon avatar Jun 26 '24 17:06 magicspon