Episode Sponsor - Wix Studio
We'd like to thank this episode's sponsor for their support!
Wix Studio: The Web Platform for Agencies and Enterprises
Wix Studio is the new web platform tailored to designers, developers and marketers who build websites for others or for large organizations. The magic of Wix Studio is its advanced design capabilities which makes website creation efficient and intuitive.
Check out Wix Studio today.
How to support the show
Patreon
Prices subject to change and are listed in USD
- Support the show from as little as ~$1/month
- Get a shoutout at the end of the episode (while supplies last) for just ~$3/month
- Help support the HTML All The Things Podcast: Click Here
Show Notes
Introduction
Goal: Set the stage and explain why monorepos are relevant in modern development.
- What is a monorepo?
- Single repository that houses the code of multiple (usually intervening” projects
- Polyrepo is the opposite where each project has it’s own repository
- Why are developers increasingly adopting monorepos?
- With the rise of full-stack development and microservices monorepos have become more and more relevant
- Monorepo DX has also gotten significantly better over the years with tools like pnpm, turbopack, nx
- Your personal context: Using TurboRepo at work and your curiosity to explore its benefits and challenges.
- We took the dive into a monorepo at my current workplace because we kept developing web apps and wanted a central UI library that’s easily shared between them
- This evolved into shared utilities, database abstractions, image creation, etc
- Tease the key points you’ll cover: "We’ll dive into the perks, the pitfalls, and how TurboRepo fits into the picture."
The Case for Monorepos: Why Teams Love Them
Goal: Highlight the advantages, citing examples and your TurboRepo experience.
- Simplified Dependency Management:
- How shared dependencies and tools are easier to manage in a monorepo.
- Personal example: A situation where this saved time or reduced errors.
- Code Sharing and Reusability:
- How monorepos promote better modularity and DRY principles.
- Easily share UI libs without having to publish a package to npm for example
- Example: Reusing components or utilities across multiple projects effortlessly.
- Consistency Across Teams:
- Uniform tooling, linting, and formatting.
- One config to rule them all
- The role of TurboRepo in setting up consistent workflows.
- Improved Collaboration:
- Everyone works in the same ecosystem, making cross-team collaboration smoother.
- CI/CD Streamlining:
- TurboRepo-specific example: Faster builds through caching and efficient pipelines.
The Challenges of Monorepos: What to Watch Out For
Goal: Discuss the downsides and how they might affect teams.
- Scaling Issues:
- Large monorepos can become unwieldy; build times, search, and navigation can slow down.
- Your TurboRepo experience: Does caching mitigate this for you?
- Overhead of Tooling:
- Need for robust tools like TurboRepo, Nx, or Bazel to manage the complexities.
- Example of any setup frustrations or ongoing maintenance struggles.
- Access Control Challenges:
- When certain teams only need access to part of the monorepo.
- How (or if) TurboRepo addresses this.
- Risk of Entanglement:
- Breaking changes can ripple across the entire repo, affecting unrelated projects.
- Anecdote: A time when a dependency update caused unforeseen issues.
Deep Dive into TurboRepo
Goal: Share your first-hand experience with TurboRepo.
- What Sets TurboRepo Apart:
- It’s integration into vercel which is the current hosting provider we are using
- It’s ability to cache builds to make them faster
- Although this has caused more headaches then it’s solved and mostly been turned off in our use case
- The TurboRepo Workflow:
- All apps under the /apps folder, all libraries under the /lib folder
- Differences between app and lib are that apps are the ones being deployed and libs are used by the apps
- Each app has it’s own dependencies and scripts that you can run to launch the dev server, update db, run tests, etc
- There are commands to run all apps but are rarely used due to the overhead
- Any shared UI component will go into a lib package called UI and can be imported into any app
- All prisma clients are also shared inside lib can be used interchangeably in any app
- Sharing code between apps is extremely easy with this and also keeping typesaftey is a top notch experience
- There is a bash script to help with limiting the apps that run a vercel deployment so that we have faster staging branch deployments
- Pros and Cons:
- Pros
- Really good for collaboration
- Easy to share code
- Type Safety
- Ease of deployment
- Cons
- Can be complex to onboard
- Caching doesn’t work very well and caused some deployment headaches (even in prod)
- Has some git management complexities due to many devs working on one repo in completely different projects
Alternatives and When Monorepos Might Not Be the Best Fit
Goal: Acknowledge other perspectives and tools.
- When Polyrepos Shine:
- Smaller teams, projects with minimal overlap, or scenarios where access control is critical.
- Alternatives to TurboRepo:
- Quick mentions of Nx, Bazel, or Lerna.
- Hybrid Approaches:
- Some teams use both monorepos and polyrepos for specific needs.
Wrap-Up and Final Thoughts
Goal: Summarize key insights and encourage engagement.
- Recap:
- The biggest benefits (e.g., collaboration, code sharing).
- The challenges (e.g., scaling, setup complexity).
- TurboRepo’s role and your personal takeaway.
- Your Verdict:
- Are monorepos worth it for most teams?
- Would you recommend TurboRepo?
- Call to Action:
- Ask listeners to share their own experiences with monorepos and TurboRepo.
- Mention any related topics you could cover in future episodes (e.g., deep dives into CI/CD for monorepos, Nx vs. TurboRepo).
Links