Setting up monorepos for AI: submodules versus subtrees
I've been building my app for 8 months now, and i ended up having 5 repositories
nextjs app
databases
customer facing API
node-sdk that wraps the api
react-sdk, for both reusing shared component and customer facing components
So i thought, it's gonna be great if i create a mono repo with submodules. But it was terrible. I realized that turborepo does not like external packages, and as i tried to reuse my own customer facing libs, the DX became terrible. It was very time consuming to ship a feature. Even when i wanted to use Codex or Cursor 3, it was not able to show git diff properly, also i was not able to use Cursor's cloud agents properly to ship complex features.
So after a while i felt that i need to change my setup and i read about git subtrees, it was such a game changer! now i have 3 repos only, one mono repo and two customer facing sdk-s, but i work on the monorepo only, i commit, and then i sync the changes to the sdks with one command.
I use vercel as a backend, and that supports monorepos. Cursor works like a charm, my DX is a dream, i ship features like there's no tomorrow. I love this setup.
I am curious what's ur setup that provides a great DX and also makes ur AI env more productive?

Replies
Submodules felt powerful in theory but in practice they kept getting in the way. The constant syncing and broken context made development slower than expected. Switching to a cleaner monorepo setup brought a noticeable improvement in flow.
@new_user___0932026a86e905cf4b2b7f7 yes exactly. submodules seems super fine, however that makes life complicated.
STILL EXPERIMENTING with different structures, but this approach makes a strong case for keeping things more centralized. Simplicity seems to win when speed and consistency matter.
@josephine_roux yep, and even the cloud agents work pretty well. now i have a flow like, during the day i am working on specs, and i trigger them during nights. i start with reviews in the morning.
Bro this is the exact journey I see so many people go through 😂 Submodules + Turborepo is a special kind of hell when Cursor has to index everything. Switched to subtrees last year too and never looked back, one command to push SDK changes is pure chef’s kiss. My current setup that feels magical with Cursor: Turborepo + pnpm workspaces (no external packages nonsense) + one single monorepo for everything except the public SDKs. AI agents actually understand the full context now. What’s your subtree sync command look like? Curious how you scripted it.
@second_son_of_god i have a bash script that handles all the subtree management, but the important part is here:
Farcaster Store
We're on the same backend and also, all Cursor users (though I throw in some Claude Code work from time to time). Our NX-based monorepo works extremely well for us:
TypeScript-centric - so even MCP services etc can use the same domain logic, schema and other shared libs
Rules, shared libs, build system, multiple apps, different outputs - very simple
Tailwind-based style tokens and shared UI components - also straightforward
I'm finding myself consolidating more and more standalone service/app repos into the monorepo. Hope that helps.