Ship Your UI Faster With Turborepo

Rate this content
Bookmark

Iteration velocity is the key to unlocking the potential of your technical teams and business. In this talk, we'll build the groundwork for a highly scalable monorepo using Turborepo and talk about the philosophies behind architecting codebases for teams of all scales. Through the power of Remote Caching, we'll never do the same work twice and we'll deliver your applications at the speed of Turbo.

This talk has been presented at DevOps.js Conf 2024, check out the latest edition of this Tech Conference.

FAQ

TurboPak is an incremental bundler optimized for JavaScript and TypeScript, written in Rust for bare metal speeds. It features function-level caching and creates an optimized graph the first time, making it faster than traditional bundlers like Webpack.

TurboPak is led by Tobias Koppers, the creator of Webpack.

TurboRepo is a high-performance build system for JavaScript and TypeScript codebases. It offers features like incremental building, remote caching, and parallel execution to make builds, lints, tests, and other tasks as fast as possible.

You can set up TurboRepo by running the command 'npx create turbo@latest' which will prompt you to grab a few files from GitHub, setting you up with your own monorepo.

Benefits include faster builds, the ability to use one shared library across multiple applications, and the efficiency of handling tasks in parallel. It also offers remote caching to save time across CI machines and development environments.

TurboRepo can run multiple development scripts in parallel and supports hot reloading. Changes made in one part of the monorepo can propagate instantly across the entire repository, improving development speed and efficiency.

Function-level caching in TurboPak allows for a deeper analysis of module graphs, enabling the bundler to do as little work as possible by focusing only on the necessary parts. This leads to faster bundling times compared to traditional module-level caching.

TurboRepo integrates with CI/CD tools like GitHub Actions, Jenkins, and GitLab CI/CD to utilize remote caching and incremental builds. This reduces the amount of work CI/CD machines need to do, making the entire process faster and more efficient.

The TurboToken is used for remote caching in TurboRepo, allowing different CI/CD machines to share cached builds and other tasks. This ensures that repeated work is minimized, saving time and computational resources.

You can report issues or bugs with TurboPak on the Next.js repository on GitHub. The development team encourages users to share their experiences and report any problems they encounter.

Anthony Shew
Anthony Shew
21 min
14 Nov, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Turboverse focuses on making the development process faster and more efficient. TurboPak is an incremental bundler with function-level caching, and TurboRepo is a high-performance build system with features like incremental building, remote caching, and parallel execution. TurboRepo can optimize task runners, set up monorepos, and speed up development time. vclink-repo enables seamless integration with the Vercel remote cache, and Conformance and Codoners provide static analysis and automated code reviews. TurboPak and TurboRepo offer faster CI processes and exciting advancements in web bundling.

1. Introduction to Turboverse

Short description:

You're writing, building, and shipping more code than ever. But your CI times have been increasing, and your local developer experience is getting worse. Welcome to the Turboverse, where we focus on making your development process faster and more efficient, from start to finish.

You're writing, building, and shipping more code than ever. It's great to be building a product that your customers love, but your CI times have slowly been creeping upwards. Your local developer experience keeps getting a little worse, and your CI complexity continues to increase. The time it takes to get from idea to ship has slowly gone upwards. That's because you have to sit and wait for things. A lot like these ships. But what if that didn't have to be the case? Hello and welcome to the Turboverse. I'm Anthony. I'm TurboDX. I like to joke that I'm a full stack comedian, but real job TurboDX. These problems I described are things that I get to think a lot about in my role. How can we make sure you never do the same work twice? When you do need to do new work, how do we just make sure it's plain fast and that it's as little work as possible? How do we make sure that all the way from solo developer to the largest enterprise applications in the world, that you have a great experience all the way from start to finish?

2. Exploring TurboPak and TurboRepo

Short description:

Let's explore TurboPak, an incremental bundler optimized for JavaScript and TypeScript. It features function-level caching for faster bundle creation. TurboPack is currently being tested with the Next.js development server and has achieved a 93.9% passing rate for Next.js tests. TurboRepo is a high-performance build system for JavaScript and TypeScript codebases, leveraging learnings from organizations like Meta and Google. It offers features such as incremental building, remote caching, and parallel execution to make your builds faster. Our Vercel team has saved over 8,500 hours in the past two weeks using TurboRepo.

Let's explore TurboPak and talk a little bit about the underlying architecture. And then we'll jump into a demo and use both of these tools to ship our first set of applications with a fully distributed caching layer. We'll also talk about how this repo works mechanically, the benefits of monorepos, and things to think about at a higher level when you're architecting a monorepo.

So first, let's jump into TurboPak. TurboPak is an incremental bundler optimized for JavaScript and TypeScript. We're writing in Rust for bare metal speeds led by the creator of Webpack, Tobias Koppers. On top of that raw speed, we're also making it smarter. If I jump over here to the core concepts, you'll see some information about the TurboEngine. With the TurboEngine, we're getting down to doing as little work as possible, like we were talking about before. The TurboEngine features function-level caching so that we can do as little work as possible to create the bundles for your application. Previously in Webpack, we could only do this at the module level, at the file level. But with function-level caching, we can understand your module graphs much deeper. Because we can analyze the relationships throughout your code more deeply, we can just be faster by going straight to the things that we need to bundle, look at, and analyze, instead of creating a much larger graph. Additionally, Webpack is designed such that it creates an unoptimized graph first, and then optimizes that graph. In TurboPack, we're just making that optimized graph the first time, as you can imagine, a bit faster. At the time of this recording, we're using the Next.js development server as the proving ground for TurboPack. You can visit areweterboyet.com to see that no, we're not Turbo Yet completely. These are all the tests that are in the Webpack bundler. And additionally, we've stacked a few on top now that we've got better coverage for TurboPack to find out if the Next.js development server TurboPack is ready to go and be shipped out of beta and to stable. You can see that we're currently sitting at 93.9% of those Next.js tests passing. But once we're done there, we'll actually have a really nice head start on getting TurboPack to build for production those Next.js applications. You can try this out today in your Next.js 14 project using //Turbo on the dev script of your Next.js application. We look forward to hearing your experience, and we would appreciate if you run into any issues to report those bugs on the Next.js repo on GitHub.

But your bundler is only one part of the story. Now let's talk about TurboRepo and do a little bit of a demoing and talk about some mechanics. TurboRepo is a high-performance build system for JavaScript and TypeScript codebases. We're taking some of the learnings from the largest monorepoing organizations in the world, like Meta and Google, and making those techniques friendly, usable, and productive for everyone. Through features like incremental building, remote caching, parallel execution, and much more, we can make your builds, lints, tests, and any other tasks that you need done as fast as possible. As a proof point, here's a quick screen grab that I grabbed off of Vercel.com for our Vercel team to show how much time we've saved over the past two weeks. Looks like we've saved almost more than 8,500 hours.

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

Turbopack. Why? How? When? and the Vision...
React Day Berlin 2022React Day Berlin 2022
32 min
Turbopack. Why? How? When? and the Vision...
The Talk discusses TurboPack, a successor to Webpack, aiming to create a framework-independent, flexible, and extensible tool for the open-source community. It addresses performance challenges by integrating SWC into Next.js. The challenges with Next.js and Webpack include orchestration issues, backward compatibility constraints, and cache invalidation problems. TurboEngine and TurboPack provide constant performance in incremental builds, leveraging Rust's predictable performance and parallelism. The Talk also covers topics like dependency tracking, task graphs, cache invalidation, lazy asset graphs, and the integration of TurboPack with Next.js. The future plans involve reconfiguring Webpack and TurboEngine, moving computations to the cloud, providing insights into builds, and facilitating migration and integration with JavaScript projects.
The Core of Turbopack Explained (Live Coding)
JSNation 2023JSNation 2023
29 min
The Core of Turbopack Explained (Live Coding)
Tobias Koppers introduces TurboPack and TurboEngine, addressing the limitations of Webpack. He demonstrates live coding to showcase the optimization of cache validation and build efficiency. The talk covers adding logging and memorization, optimizing execution and tracking dependencies, implementing invalidation and watcher, and storing and deleting invalidators. It also discusses incremental compilation, integration with other monorepo tools, error display, and the possibility of a plugin system for Toolpag. Lastly, the comparison with Bunn's Builder is mentioned.
Less Cruft, More Power: Leverage the Power of the Web Platform
C3 Dev Festival 2024C3 Dev Festival 2024
30 min
Less Cruft, More Power: Leverage the Power of the Web Platform
This talk focuses on the powerful features of CSS and HTML that can level up developer skills and enhance web UI. Scroll-driven animations, popover API, and anchor positioning are explored as ways to create dynamic effects, improve performance, and increase accessibility. The talk also emphasizes the benefits of building presentations with CSS and HTML, separating logic from styling, and leveraging core platform features. Wishlist features for the web platform and the challenges of pushing updates across browsers are discussed.
JS on the Big Screen: Making TV Apps
JSNation 2024JSNation 2024
22 min
JS on the Big Screen: Making TV Apps
JavaScript is widely used in web, mobile, and backend development, and now it is also being used to create TV apps. TVs with web-based operating systems can be targeted with JavaScript applications, and React is commonly used for TV app development. React Native allows for cross-platform TV app development, except for Roku. User interactions and focus management are important considerations in TV app development. Performance optimization is crucial for TV apps, as TVs have lower device scores and limited RAM. Spatial virtualization can significantly improve TV app performance.
Canva’s App UI Kit: Empowering Developers With Modern Web Technologies
React Summit US 2023React Summit US 2023
8 min
Canva’s App UI Kit: Empowering Developers With Modern Web Technologies
Watch video: Canva’s App UI Kit: Empowering Developers With Modern Web Technologies
Welcome to the Canva Tech talk where the Canva tech stack, React component structure, and UI kit for developers are discussed. Canva uses Java, Go, Bash, TypeScript, and React for development. TypeScript, MobX, and React were chosen to enable hundreds of developers to work on the code base productively. Canva's internal component library was explored and released under a semi-open source license, allowing for quick delivery and sharing of improvements with the community. The developer community has added numerous app integrations accessible to Canva's 150 million monthly active users.
Nested Interactive Elements: A Nightmare in Accessibility
React Summit 2024React Summit 2024
9 min
Nested Interactive Elements: A Nightmare in Accessibility
Nested Interactive Elements in Nightmare Accessibility can cause issues with screen readers and other assistive tools, making it difficult for users to interact with websites. Mitigation strategies include unnesting elements, using CSS overlay, and being cautious when modifying roles. It is recommended to involve users of assistive tools in focus groups and share solutions online.