Building Full Stack React Apps with Bun

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2025
November 18 - 21, 2025
New York, US & Online
The biggest React conference in the US
Learn More
In partnership with Focus Reactive
Upcoming event
React Summit US 2025
React Summit US 2025
November 18 - 21, 2025. New York, US & Online
Learn more
Bookmark
Rate this content

FAQ

Bun is faster because it optimizes processes like package installation by reducing JSON parsing time and utilizing efficient file copying and system calls. It also integrates tools that share components, reducing redundancy.

Bun is designed as a drop-in replacement for Node.js, with ongoing efforts to improve Node.js compatibility. The team runs over 2,000 tests from the Node.js test suite, with compatibility improving by approximately 1% each week.

Bun's bundler includes features like React fast support, a CSS parser, an HTML parser with HTML re-writer, tree-shaking, minification, and code-splitting. It also allows console.log to echo from the browser to the terminal, which is useful for debugging.

Bun supports monorepos, but there are some improvements needed to enhance the experience. Bun recently added catalog support similar to PNPM and is working on implementing PNPM-style symlink node modules folder for workspaces.

Yes, Bun aims to work with various frameworks and tools, including Next.js and React Router. There are ongoing efforts to integrate Bun's built-in modules into these tools for better compatibility.

Bun is interested in working with cloud providers to introduce the Bun runtime, although specific details or partnerships are not disclosed at this time.

Bun's package manager speeds up installations by minimizing the time spent on JSON parsing and optimizing file copying processes. It checks the manifest in a binary format to ensure efficiency.

Bun includes a jest-compatible test runner called Bun test, which is significantly faster than jest, allowing for rapid testing of JavaScript code with built-in support for JSX, TSX, and more.

Bun is an incredibly fast JavaScript runtime designed to be a drop-in replacement for Node.js. It also functions as a package manager, bundler, and test runner, aiming to simplify JavaScript development by integrating these tools into one.

Yes, Bun supports full-stack React applications by allowing HTML imports that work ahead of time and in development. It enables building both the front-end and back-end simultaneously with bun build.

Jarred Sumner
Jarred Sumner
14 min
13 Jun, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Bun is a fast JavaScript runtime aiming to improve Node.js compatibility and streamline the development toolchain. It offers seamless full-stack development capabilities with features like WebSocket support and code-splitting. The efficient package management in Bun optimizes production processes by reducing parsing time and system calls. Bun's collaboration plans include enhancing monorepo support and integrating with frameworks and routers for improved functionality and runtime efficiency.

1. JavaScript Tooling with Bun

Short description:

Bun is a fast JavaScript runtime designed as a drop-in replacement for Node.js. It includes a package manager and a test runner. The tool is continuously improving Node.js compatibility and aims to streamline the development toolchain.

Thanks, everyone. Over the years, JavaScript tooling got too slow and complicated. Our answer to that is Bun. Bun is an incredibly fast JavaScript runtime. On every commit, we run over 2,000 tests from the Node.js test suite. We designed Bun from the beginning to be a drop-in replacement for Node.js. We're still working on that. That's what most of the team spends most of their time on is Node.js compatibility.

But it's getting better basically every day. The total percentage is going up roughly 1 per cent every week or so of Node.js' test suite passing in Bun. Bun is also a package manager. It's really fast. A lot of people have said that if you can RM-RF Node modules, that is slower than installing packages with Bun install. To do that, we did a lot of work on what is the fastest way to copy files on every single platform target, and also, sometimes, like file system.

Bun test is a really fast jest-compatible test runner. You can use it with JSX, TSX, all that stuff is built in. You can import and require in the same file. This is the comparison. It's 20 times faster than jest to SSR, 1,000 React components, but then just to print the help menu, it's three or four times faster. This is kind of like, Bun is four different things in one. It's a package manager, it's a bundler, it's a run time, it's a test runner. We intend to replace much of the tool chain with one simple tool.

2. Full-Stack Development with Bun

Short description:

The Bun runtime, test runner, package manager, and bundler work together seamlessly. APIs such as WebSocket, S3 client, Postgres client, and password hashing are included. The bundler features React fast support, CSS and HTML parsers, tree-shaking, and code-splitting. The next Bun version will support full-stack development with HTML imports and route setups.

Each of these things kind of work together, so, like, the runtime uses the bundler. The test runner also uses the bundler and transpiler. The runtime uses the package manager to automatically install packages. If you don't, you have a Node modules folder. The package manager uses the shell to have cross-platform shell scripts, so that way your packaged JSON scripts with like RM or CD or LS or any of those commands just work, whether it's Windows or Postix, so that way you don't need to install RimRath, for example. And we built in a lot of APIs. This list is going to grow. There's still a lot more that we want to do. We have a WebSocket server, we have an S3 client, we have a Postgres client, we have password hashing and verification. A lot of apps can be built without any dependencies. And there's also the bundler.

Nowadays, Buns Bundler has React fast support built in. It has a CSS parser. It also has an HTML parser with HTML re-writer. We also have tree-shaking, a minifier, code-splitting. A slightly less common feature that we have, or like less common relative to other bundlers is you can echo console.log from the browser to the terminal. This is really useful for AI agents where they normally can't debug stuff in your browser very easily. You normally need to install some MCP thing, but we just made it so console.log streams to the browser over the same WebSocket connection it does for HMR. We also have plugins you would expect. You can use it with Tailwind and Svelte.

How do you build a full-stack React application when most of what I just described is very focused on the front-end or the back-end, but, for a full-stack, you need both the front-end and the back-end together? In the next version of Bun, you can just import HTML, and that works both ahead of time and in development. This is what it looks like today. There's routes in bun.serve. You specify where do you want the HTML file to be rendered, and then you can also have API routes in there as well. So then you're running your React app in development, or potentially in production this way. And you can see that the routes also support request parameters. This would be for like a URL shortener. It uses request and response APIs, the web standards. And you can see that there's almost no configuration here. That's all you had to do.

QnA

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

How Bun Makes Building React Apps Simpler & Faster
React Day Berlin 2022React Day Berlin 2022
9 min
How Bun Makes Building React Apps Simpler & Faster
BUN is a modern all-in-one JavaScript runtime environment that achieves new levels of performance. It includes BUN dev, a fast front-end dev server, BUN install, a speedy package manager, and BUN run, a fast package runner. BUN supports JSX, has optimized React server-side rendering, and offers hot module reloading on the server. The priorities for BUN include stability, node compatibility, documentation improvement, missing features in BUN install, AST plugin API, native Windows support, Bundler and Minifier optimization, and easier deployment to production. BUN's AST plugin API allows for bundle-time JavaScript execution and embedding code, potentially inspiring new frameworks.
Server Components with Bun
Node Congress 2023Node Congress 2023
7 min
Server Components with Bun
Top Content
Bun is a modern JavaScript runtime environment that combines a bundler, transpiler, package manager, and runtime. It offers faster installation of NPM packages and execution of package.json scripts. Bun introduces a new JavaScript and TypeScript bundler with built-in support for server components, enabling easy RPC with the client. This allows for code splitting and running code that streamingly renders React or any other library from the server and mixes it with client code, resulting in less JavaScript sent to the client.
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
Node Congress 2023Node Congress 2023
29 min
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
The Talk explores the magic behind Node.js and delves into its components, including V8, libuv, and the C++ bridge. It discusses the workflow and execution process, the use of NodeMod, and the understanding of console functions. The Talk also covers Node.js functions and scheduling, the introduction of runtimes, and the collaboration between JavaScript runtimes. It concludes with insights on content production, the choice of Node.js, and the inspiration behind it.
Is Bun 'Actually' Faster?
React Advanced 2024React Advanced 2024
24 min
Is Bun 'Actually' Faster?
Welcome to React Advanced London. Today's agenda: what is bun? Features, benchmark, demo, key takeaways. Bun provides a better developer experience, faster CI, and decreased app file size. Building bun on top of Zig prioritizes performance, stability, and compatibility. Install bun with npm or download the binary from the official website. Bun is a comprehensive development toolkit with a fast and efficient package manager. Learn how to benchmark CLI commands using Hyperfine with flags. Compare different package managers. Bond is fast and provides a few features in its package manager: install, add, remove, update, link. Test the bond test runner against vtest and jest using hyperfine. Discover the features supported by the test runner and the importance of bundling in JavaScript applications. Learn about the main.js code, the performance comparison of different bundlers, and the features offered by Bun, including loaders and macros. Explore macros in Bonn and how to optimize the code by including the type macro. Discover the benefits of Bonn, such as reducing CPU usage and fast installation of node dependencies.

Workshops on related topic

Advanced TypeScript for Bun and Node.js
JSNation US 2024JSNation US 2024
103 min
Advanced TypeScript for Bun and Node.js
Workshop
Adrian Hajdin
Adrian Hajdin
Learn the full potential of TypeScript by using advanced features like Type Inference, Type Guards, Generics, Transformers, and Utility Types with asynchronous programming in both Node.js (using Express.js) and Bun.js (using Hono.js), all while understanding best practices for building strongly typed APIs with different databases.OverviewIn this workshop, we’ll kick off with a discussion on the recent updates in Node.js and Bun.js, focusing on their built-in TypeScript support. You'll learn how to set up TypeScript in both runtimes and create strictly typed APIs using Express.js and Hono.js. Through hands-on demos, we'll explore integration with various databases like MongoDB and Postgres, leveraging advanced TypeScript features to build robust applications. By the end of the workshop, you'll be equipped with the knowledge to optimize TypeScript code for performance and design patterns, ensuring your APIs are both efficient and maintainable.Learning Goals- Introduction to Node.js’s and Bun.js’s TypeScript support- Advanced TypeScript Features: Generics, Type Guards, Mapped Types, etc.- Middleware and Dependency Injection with Express.js and Hono.js- Design Pattern and Performance Enhancements in TypeScript- Unit and Integration Testing with TypeScript- Database Integration: MongoDB, Postgres, Prisma, and others- Best Practices for Robust API Development in both Node.js and Bun.js