Loading...
bun Logo

Bun Online Compiler

Practice Bun using this online Bun compiler. Run Bun apps within your browser without downloading any software.

Start Coding
A BRIEF INTRODUCTION

Bun Runtime Environment

Bun is a modern JavaScript runtime like Node or Deno. It was built from scratch to focus on three main things:

  • Start fast (it has the edge in mind).
  • New levels of performance (extending JavaScriptCore, the engine).
  • Being a great and complete tool (bundler, transpiler, package manager). Bun is designed as a drop-in replacement for the current JavaScript & TypeScript apps or scripts — on your local computer, server or on the edge. Bun natively implements hundreds of Node.js and Web APIs, including ~90% of Node-API functions (native modules), fs, path, Buffer and more.

The goal of Bun is to run most of the world's JavaScript outside of browsers, bringing performance and complexity enhancements to your future infrastructure, as well as developer productivity through better, simpler tooling. Bun uses the JavaScriptCore engine, which tends to start and perform a little faster than more traditional choices like V8. Bun is written in a low-level programming language with manual memory management. Most of Bun is written from scratch including the JSX/TypeScript transpiler, npm client, bundler, SQLite client, HTTP client, WebSocket client and more.

Bun in your browser

Many developers want to try-out/experiment with Bun but they're forced to install it locally which is a painful process as different versions need to be installed locally and maintained.

Don't worry we've got your back! Using the online Bun compiler you can quickly code, collaborate, compile, run & share NodeJS code for free. The Bun online compiler by codedamn is robust and feature-rich, running the latest released version of Bun. Getting started is easy and fast since the editor shows sample boilerplate code. Feel free to add any packages you like by using the Buns own package manager in the integrated terminal. For example,

Bun install express

Bun vs Node.js vs Deno

Bun is about three times faster than Node and Deno when server-rendering React or running database queries. Bun's speed stems from the fact that it is built around Webkit's JavaScriptCore framework, which tends to be faster than the more traditional V8 JavaScript engine used for Chrome, Deno and Node.js.

Another factor leading to increased speed is that the Bun JavaScript runtime is written in Zig, a low-level programming language that can be read by system hardware. This makes it simpler to write faster software due to low-level control over memory and lack of hidden control flow -- such as surprise jumps away to call functions, according to Bun.

While Deno and Node.js can run on multiple platforms, Bun is tied to high-performance Unix variants of macOS (x86 and Arm), Linux or Microsoft Windows Subsystem for Linux (WSL), which limits its use.

Codedamn Bun Compiler

The codedamn online compiler utilizes the power of cloud computing to give you a fast and reliable coding experience. When you boot the online Bun compiler, a docker container is started on a remote linux computer. This docker container is already setup with Bun which can run your javaScript and check for any errors or problems. As your code is executed, the output / errors will show up on the integrated terminal of the online Bun compiler.

Try out the Bun online compiler

Serve some HTML through your bun server running on process.env.PUBLIC_PORT (1337), edit your index.ts file,

// index.ts

Bun.serve({
    fetch(req: Request) {
        return new Response(`
        <meta charset="UTF-8">
        <h1>Hello World from bun 🤩</h1>
        `, {
            headers: {
                'Content-Type': 'text/html',
            }
        });
    },
    error(error: Error) {
        return new Response("Uh oh!!" + error.toString(), { status: 500 });
    },
    port: 1337
})

console.log("Bun is cool!")

Now, to execute your typeScript code simply start the server and refresh the browser preview

bun run index.ts
Bun is cool!

🚨 Pro Tip!

Start your bun server with nodemon to avoid re-starting it every time you make a change. Install nodemon using

Bun install nodemon

Then start your server like this,

nodemon --exec "pnpm index.ts" ./index.ts

Frequently asked questions

Upgrade to codedamn Pro Plan and unlock more courses for accelerated learning. Unlimited courses, interactive learning and more.

Free

  • HD video content
  • Certificate of completion
  • Mentorship from codedamn staff
  • Full learning path unlocked
  • Unlimited playgrounds/compiler usage

Pro

  • HD video content
  • Certificate of completion
  • Mentorship from codedamn staff
  • All exclusive courses unlocked
  • Unlimited playground/compiler usage
Try Pro (7-day risk-free moneyback guarantee)