Supercharging Your Dev Experience With Turborepo

Rate this content
Bookmark
Slides

Monorepos is a hot topic in the TypeScript/JavaScript community these days, but getting a high performing monorepo setup from the ground up can be challenging. In this talk, we will see how Turborepo can help you to move your monorepo tasks at light speed.

This talk has been presented at React Day Berlin 2022, check out the latest edition of this React Conference.

FAQ

A monorepo is a code management strategy where all projects, such as apps or libraries, reside within a single repository, as opposed to a multirepo strategy where each project has its own repository. Monorepos facilitate code reuse, shared standards, and easier collaboration across teams.

Companies like Google and Facebook use monorepos because they allow for easier code reuse, shared standards across all projects, and streamlined collaboration. Additionally, monorepos support atomic changes across multiple projects in a single commit, ensuring consistency and synchronization.

Tuburepo ensures efficient task execution by never repeating the same work, caching results, and scheduling tasks based on CPU availability and task dependencies. It allows parallel processing of independent tasks and sequential processing of dependent tasks, enhancing performance and reducing build times.

In monorepos, workspaces are utilized to manage dependencies of various packages within the repository. Tools like npm, pnpm, and YARN support workspaces, which help in isolating code by ensuring packages are self-contained with their own sets of dependencies, thus maintaining clear boundaries within the monorepo.

Shared standards in a monorepo ensure that all projects within the repository follow the same coding and configuration guidelines, which simplifies management and enhances code quality. For instance, having a single ESLint or TypeScript configuration across multiple packages ensures consistency and eases maintenance.

Caching in Tuburepo significantly speeds up the development process by storing the results of previously executed tasks. When a task is re-run without changes, Tuburepo uses the cache to skip execution and provide the previous results, thus saving time and computational resources.

Tuburepo, specifically designed for JavaScript and TypeScript ecosystems, optimizes building and testing in monorepos by caching tasks, running tasks in parallel, and ensuring that tasks are executed efficiently according to their dependencies. It also enables shared caching across CI systems and development teams.

Bruno Paulino
Bruno Paulino
26 min
05 Dec, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
This Talk explores the benefits of using TuberApple, a tool for supercharging the development experience. It highlights the advantages of monorepos, such as code reuse, shared standards, improved team collaboration, and atomic changes. TuberApple, specifically Tuburepo, offers efficient task execution through caching and optimized scheduling. It simplifies monorepo development by allowing parallel execution of tasks and seamless coordination of changes. Tubo, another tool within TuberApple, enables smart task execution, declaring task dependencies, and efficient caching in monorepos.

1. Introduction to TuberApple

Short description:

Hello, everyone. Thanks for joining me today. We're going to talk about how to supercharge your dev experience with TuberApple. A little bit about me. My name is Bruno Paulino. I'm a tech lead at Any26, a company building a platform for engineers to build web applications and libraries. We'll discuss monorepo, multirepos, and how companies organize their code.

Hello, everyone. Thanks for joining me today. We're going to talk about how to supercharge your dev experience with TuberApple.

A little bit about me. My name is Bruno Paulino. I'm a tech lead at this cool company called Any26. We're building the bank that we love to use. And I'm a software engineer focused on the web. And there, at Any26, we're building the platform for all the engineers to build web applications on top of it. Not just web applications, but also web libraries. You could think of design system components, for example. And there, I don't like to call ourselves as DevOps. We actually like to call ourselves DevOps. So we actually help web engineers to ship these as fast as possible to the browser. I'm also bpaulino0 on Twitter. So if you use Twitter and you want to follow me, please do. I'm there.

So let's just jump right in. This presentation is actually divided in two parts. The first one, we are going to talk about monorepo, multirepos and how you can use them. And the second part, we're going to actually talk about tuberepo. And then to close it, we're going to see a nice live demo. But before we start, I want to talk about multirepos, monorepos and how companies actually organize their code.

The most common approach is actually to have multirepos, right? You go to a company and then they have several different projects and they organize projects in different repositories. That's the most sensible way of doing it. You have several different teams working in different projects. They have their own toolings, they have their own standards and so on, and that's pretty common and very reasonable, right? You want to give teams the independency of actually using their own tools, using their own ways of building software and shipping as fast as possible. But there is another way, right? There is a way of actually organizing your code in the same repository. There is monorepos. Don't confuse monorepos with monoliths.

2. Benefits of Monorepos

Short description:

So you can still have a monorepo and you can still have microservices, for example, inside of the monorepo. The first reason is code reuse, making it easier to share code with teammates. The second reason is shared standards, allowing for consistent configuration and adoption across projects. Team collaboration is also improved, as engineers can easily share pull requests and work together without additional setup. Finally, atomic changes can be made, ensuring that all apps and packages work together seamlessly.

So you can still have a monorepo and you can still have microservices, for example, inside of the monorepo. The only difference from a monorepo to a multirepo approach is actually that you have all your apps or packages, libraries inside of the same repository.

But then you might ask yourself, why do I need to have a monorepo? Why do I need to put all my code together in the same repository instead of having them separately in individual repositories? There must be a good reason for other companies doing that, right? Like why monorepos are so hot in those companies, for example, Google, Netflix, Facebook, and Twitter, they all use monorepos in some shape or form. And there must be very good reasons for them not to go with the multi-repo approach, right? And let's talk about them.

The first one is actually code reuse. If you have everything under the same repository, then it's much easier for you to share code with your teammates. Like think about it, you could have a modules package where you have all your database modules, and you can also have a package there with your UI components. And then everybody else in your team can just reuse them without having to reinvent anything or to re-import anything or to install any extra package.

The other reason you might want to consider a monorepo is to have shared standards. In a monorepo, you can actually have true shared standards across your code base. Because think about it, you could have a yeslin config where it's completely share across all the packages, and then you can update in one single place. And then every other package can benefit from it immediately. So if you're using TypeScript, for example, you can have one single TypeScript configuration shared across all of your projects. So it was also very easy to adopt and share stuff among the packages inside of the monorepo.

Another thing that works really well in the monorepo setup is team collaboration. So if you have everything under the same repository, you can easily share a pull request with other engineers and get feedback because they have already all the context around the code base. They don't have to set up anything. They don't have to install a different node version. They don't have to set up any SDK in the machine or anything like this because they have been working in the same code base. They have every tool installed already. So they don't have to figure out anything. If you need to do a pair programming session, for example, it's just much easier to do it. You can just share a screen, fire up the dev server, and then everything is in there. You don't need to clone anything. You don't need to do any setup. It's just much easier and much faster for a big team.

Another big selling point for monorepo is atomic changes. If you have a single repository, you can actually change several different apps and packages at the same time, in the same pull requests. This way, you can actually guarantee that everything is going to work together.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Vite: Rethinking Frontend Tooling
JSNation Live 2021JSNation Live 2021
31 min
Vite: Rethinking Frontend Tooling
Top Content
Vite is a next-generation build tool that leverages native ES modules for improved performance. It eliminates the need for bundling and improves hot module replacement. Vite provides an opinionated default configuration while still allowing advanced customization through plugins. It is framework agnostic and can be used for React and other applications. Vite is being adopted by Next.js and Create React App, and integration with Nuxt 3 offers significant speed improvements.
React Compiler - Understanding Idiomatic React (React Forget)
React Advanced 2023React Advanced 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
Watch video: React Compiler - Understanding Idiomatic React (React Forget)
Joe Savona
Mofei Zhang
2 authors
The Talk discusses React Forget, a compiler built at Meta that aims to optimize client-side React development. It explores the use of memoization to improve performance and the vision of Forget to automatically determine dependencies at build time. Forget is named with an F-word pun and has the potential to optimize server builds and enable dead code elimination. The team plans to make Forget open-source and is focused on ensuring its quality before release.
Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
NPM workspaces help manage multiple nested packages within a single top-level package, improving since the release of NPM CLI 7.0. You can easily add dependencies to workspaces and handle duplications. Running scripts and orchestration in a monorepo is made easier with NPM workspaces. The npm pkg command is useful for setting and retrieving keys and values from package.json files. NPM workspaces offer benefits compared to Lerna and future plans include better workspace linking and adding missing features.
Remix Flat Routes – An Evolution in Routing
Remix Conf Europe 2022Remix Conf Europe 2022
16 min
Remix Flat Routes – An Evolution in Routing
Top Content
Remix Flat Routes is a new convention that aims to make it easier to see and organize the routes in your app. It allows for the co-location of support files with routes, decreases refactor and redesign friction, and helps apps migrate to Remix. Flat Folders convention supports co-location and allows importing assets as relative imports. To migrate existing apps to Flat Routes, use the Remix Flat Routes package's migration tool.
Principles for Scaling Frontend Application Development
React Summit 2023React Summit 2023
26 min
Principles for Scaling Frontend Application Development
Top Content
Watch video: Principles for Scaling Frontend Application Development
This Talk discusses scaling front-end applications through principles such as tearing down barriers, sharing code in a monorepo, and making it easy to delete code. It also emphasizes incremental migration, embracing lack of knowledge, and eliminating systematic complexity. The Talk highlights the use of automation in code migration and the importance of removing barriers to enable smoother code migration.
Automating All the Code & Testing Things with GitHub Actions
React Advanced 2021React Advanced 2021
19 min
Automating All the Code & Testing Things with GitHub Actions
Top Content
We will learn how to automate code and testing with GitHub Actions, including linting, formatting, testing, and deployments. Automating deployments with scripts and Git hooks can help avoid mistakes. Popular CI-CD frameworks like Jenkins offer powerful orchestration but can be challenging to work with. GitHub Actions are flexible and approachable, allowing for environment setup, testing, deployment, and custom actions. A custom AppleTools Eyes GitHub action simplifies visual testing. Other examples include automating content reminders for sharing old content and tutorials.

Workshops on related topic

React at Scale with Nx
React Summit 2023React Summit 2023
145 min
React at Scale with Nx
Top Content
Featured WorkshopFree
Isaac Mann
Isaac Mann
We're going to be using Nx and some its plugins to accelerate the development of this app.
Some of the things you'll learn:- Generating a pristine Nx workspace- Generating frontend React apps and backend APIs inside your workspace, with pre-configured proxies- Creating shared libs for re-using code- Generating new routed components with all the routes pre-configured by Nx and ready to go- How to organize code in a monorepo- Easily move libs around your folder structure- Creating Storybook stories and e2e Cypress tests for your components
Table of contents: - Lab 1 - Generate an empty workspace- Lab 2 - Generate a React app- Lab 3 - Executors- Lab 3.1 - Migrations- Lab 4 - Generate a component lib- Lab 5 - Generate a utility lib- Lab 6 - Generate a route lib- Lab 7 - Add an Express API- Lab 8 - Displaying a full game in the routed game-detail component- Lab 9 - Generate a type lib that the API and frontend can share- Lab 10 - Generate Storybook stories for the shared ui component- Lab 11 - E2E test the shared component
Integrating LangChain with JavaScript for Web Developers
React Summit 2024React Summit 2024
92 min
Integrating LangChain with JavaScript for Web Developers
Featured Workshop
Vivek Nayyar
Vivek Nayyar
Dive into the world of AI with our interactive workshop designed specifically for web developers. "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" offers a unique opportunity to bridge the gap between AI and web development. Despite the prominence of Python in AI development, the vast potential of JavaScript remains largely untapped. This workshop aims to change that.Throughout this hands-on session, participants will learn how to leverage LangChain—a tool designed to make large language models more accessible and useful—to build dynamic AI agents directly within JavaScript environments. This approach opens up new possibilities for enhancing web applications with intelligent features, from automated customer support to content generation and beyond.We'll start with the basics of LangChain and AI models, ensuring a solid foundation even for those new to AI. From there, we'll dive into practical exercises that demonstrate how to integrate these technologies into real-world JavaScript projects. Participants will work through examples, facing and overcoming the challenges of making AI work seamlessly on the web.This workshop is more than just a learning experience; it's a chance to be at the forefront of an emerging field. By the end, attendees will not only have gained valuable skills but also created AI-enhanced features they can take back to their projects or workplaces.Whether you're a seasoned web developer curious about AI or looking to expand your skillset into new and exciting areas, "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" is your gateway to the future of web development. Join us to unlock the potential of AI in your web projects, making them smarter, more interactive, and more engaging for users.
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
React Day Berlin 2022React Day Berlin 2022
86 min
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
Top Content
WorkshopFree
Hussien Khayoon
Kahvi Patel
2 authors
Using a library might seem easy at first glance, but how do you choose the right library? How do you upgrade an existing one? And how do you wade through the documentation to find what you want?
In this workshop, we’ll discuss all these finer points while going through a general example of building a code editor using CodeMirror in React. All while sharing some of the nuances our team learned about using this library and some problems we encountered.
Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
WorkshopFree
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.