Bun: Running your first Bun program

Bun runs JavaScript/TypeScript server-side.

Let’s create the simplest program in an empty folder. Create a hello.js file:

console.log('hello')

Run it using

bun hello.js

This is like running node hello.js.

But using Bun’s JavaScript runtime instead of Node.js

Rename hello.js to hello.ts to make it a TypeScript file, and run it using bun hello.ts.

Works in the same way. This is because of Bun’s built-in TypeScript support.

Lessons in this unit:

0: Introduction
1: Installing Bun
2: ▶︎ Running your first Bun program
3: Working with packages
4: Bun's built-in features
Want to learn more? Check out our courses