Anyone using pulumi and turborepo? Is it worth the...
# typescript
Anyone using pulumi and turborepo? Is it worth the effort? I want to structure my monorepo somehow but I'm not sure what's the best way. I have 2 nodejs apps, I want to share some data between those apps, and everything is deployed with pulumi today
I’ve set up our infra in as a package in turbo repo. This means it won’t be built into the apps but also allows it to use turbos features and dependency installation at the root. Unless your apps need have the Pulumi infrastructure as a dependency it was much hassle to set up.
Thanks Philip, I understand. Do you recommend porting the rest (my apps, but not pulumi) to turborepo?
I'd avoid merging pulumi with an application code. There are lots of bugs(read features) in pulumi preventing usage of modern TS/JS features. At best you'll need 2 "mono repos" 1 for pulumi and 1 for apps
that said, unless you plan to building pulumi TS into JS yourself, then you need to add this in
Copy code
  name: nodejs
     typescript: false
then pulumi will use the
version of your code. I am not sure how much fun is it when running locally but I ran into the situation where this solved problems with dependencies while using
- because pulumi required several packages hoisted
@dazzling-sundown-39670 Jan isn't wrong but I haven't had any issues using Turbo repo. If you only need one set of infra then maybe keeping them separate makes sense (which is what I've done with my orgs common infra) however we have many smaller apps and so it make it easier to put the infra in our turbo repo
. I haven't had issues with TS
My pulumi setup is not big, I only have 2 apps and a serverless function deployed. This is my structure now:
Copy code
├── apps
│   ├── cms
│   ├── fn-cron-runner
│   └── nextjs
└── pulumi
Each app + pulumi is just their "own" thing, I don't use workspaces either. Do you think using Turborepo would be beneficial for me at all, other than for sharing code between the apps?
If your apps don't need each other as dependencies (or sharing code) then I wouldn't see the need really. The reason we use Trubo is because we have shared types, common functions and integrations between backend and frontend (cms). So Pulumi being part of it wasn't part of that decision. I'd say keep them separate unless you want to utilize packages.
Great, thank you very much, then I will wait until I need to have those. Appreciate it
@incalculable-plastic-17510 this is the first time I was reading about turbo, I am not JS expert but a bit familiar with lerna. Which package manager are you using for your code?
So turbo works with
but I would suggest using pnpm for it. I've had fastest builds and also if pulumi is a package then you can run
pnpm i
in the root and it will manage all dependencies for you. Also allows you to build in your pulumi commands as scripts in the pulumi
and run them from the root which works really well then with docker compose