Want the Fastest JS Apps? How about using BunJS?
https://slides.com/davidcrowther/bunjs
David Crowther
Sr Web Dev - FHD Latin America Homeland
Jon Summers
Performance/Scalability


What is BunJS?
What is BunJS?
- A new JavaScript runtime comparable to NodeJS and Deno
- Beta recently released
- Much faster and has some nice things built in
- Not likely ready for you to use for production
- You might be able to use it to run tasks
- You may want to consider alternative tools like fnm or pNpm
BunJS Features
BunJS Features
- Built on JavaScriptCore from WebKit
- NodeJS and Deno use V8
- JavaScriptCore is considered faster but more difficult to work with
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
BunJS Features
- Built on JavaScriptCore from WebKit
- Written in Zig (similar to C or Rust)
- Has a native bundler (no Webpack)
- You can write TypeScript (native transpiler)
- Compatible with NPM modules (loads them very fast)
- ENV variables load automatically
- Fast native test runner
- Includes SQLite
https://www.youtube.com/watch?v=FMhScnY0dME (3:15)
How fast is Bun?
https://www.youtube.com/watch?v=O-NWCjC9iRw (0:40-3:26)
https://www.youtube.com/watch?v=X5V6RXJBp8I (7:40-16:20)
Perf Testing Gem
- https://github.com/wg/wrk
-
brew install wrk
-
wrk -t8 -c256 -d30s http://127.0.0.1:3000/)
Getting Started With BunJS
https://www.youtube.com/watch?v=X5V6RXJBp8I (5:10-7:40)
Install/Run BunJS
- https://bun.sh/
-
Install bun with
-
curl https://bun.sh/install | bash
-
- Create and run a server
-
touch server.ts
-
export default { port: 3000, fetch() { return new Response("Hello, World!") } }
-
bun server.ts
-
Resources...
- https://bun.sh/: Install bun with curl https://bun.sh/install | bash
- JavaScript just got way faster: https://www.youtube.com/watch?v=FMhScnY0dME (play 0:00-3:14)
- What is the Bun JavaScript Runtime?: https://www.youtube.com/watch?v=O-NWCjC9iRw (play 0:40-3:26)
- What is Bun?: https://syntax.fm/show/488/what-is-bun-the-new-js-runtime (play 3:31-23:25)
- Bun roadmap: https://github.com/oven-sh/Bun/issues/159
-
Getting started with bun.js web server - performance: https://www.youtube.com/watch?v=X5V6RXJBp8I (play 5:10-22:11
- Installation
-
Performance
- https://github.com/wg/wrk
- brew install wrk
- wrk -t8 -c256 -d30s http://127.0.0.1:3000/)
- Comparison of Deno & BunSuggestions:
- YouTube search: https://www.youtube.com/results?search_query=bun+js+for+beginners
- How to install Bun JS on Ubuntu 22.04 LTS | Linux | Faster JS Runtime | Bun: https://www.youtube.com/watch?v=3S2In1X07G8&list=PLT8tjCYKynKsXBrCf7KiQ6Y-6U304DjXT
Resources...
- https://bun.sh/: Install bun with curl https://bun.sh/install | bash
- JavaScript just got way faster: https://www.youtube.com/watch?v=FMhScnY0dME (play 0:00-3:14)
- What is the Bun JavaScript Runtime?: https://www.youtube.com/watch?v=O-NWCjC9iRw (play 0:40-3:26)
- What is Bun?: https://syntax.fm/show/488/what-is-bun-the-new-js-runtime (play 3:31-23:25)
- Bun roadmap: https://github.com/oven-sh/Bun/issues/159
-
Getting started with bun.js web server - performance: https://www.youtube.com/watch?v=X5V6RXJBp8I (play 5:10-22:11
- Installation
-
Performance
- https://github.com/wg/wrk
- brew install wrk
- wrk -t8 -c256 -d30s http://127.0.0.1:3000/)
- Comparison of Deno & BunSuggestions:
- YouTube search: https://www.youtube.com/results?search_query=bun+js+for+beginners
- How to install Bun JS on Ubuntu 22.04 LTS | Linux | Faster JS Runtime | Bun: https://www.youtube.com/watch?v=3S2In1X07G8&list=PLT8tjCYKynKsXBrCf7KiQ6Y-6U304DjXT
What can I do with Bun right now?
Demos
- David's portfolio site (https://github.com/crowtherdr/drcrowther-webd/tree/react-ts)? Yes
- Frontier CRA? No
- CRA? No
- System test apps? No
Resources...
YouTube playlist: https://www.youtube.com/playlist?list=PLy626RPaflBuyOEJwk3p2yef4bD7fbWg0
-
Built and ran David's portfolio app with no changes: https://github.com/crowtherdr/drcrowther-webd/tree/react-ts
- May take multiple install runs because of lockups. Seems to often get hung up on core-js-pure.
- Bun has a common cache like Pnpm.
- Speed of install depends on presence of node_modules, ~/.bun/install/cache, and/or bun.lockb
-
Deploy to a production server?
- Digital Ocean: Install and Run Bun JS In Real Server: https://www.youtube.com/watch?v=lDGrDOGyOr0 (6:21)
-
What about a Frontier app? Does it just need a 'bunrc' change?
-
Make a .bunfig.toml file with .npmrc configuration for Artifactory:
```
[install.scopes]
fs = "https://username:password@familysearch.jfrog.io/artifactory/api/npm/fs-npm-prod-virtual/"
``` - Couldn't get `bun install` to work on an existing app (fs-webdev/latam) or a new Frontier app (fr-init)
-
-
Using SQLite: https://github.com/oven-sh/bun#bunsqlite-sqlite3-module
- How to build a Rest APIs CRUD App with Bun.js and Hono.js Web Framework and SQLite: https://www.youtube.com/watch?v=a_WFb8xU8tc (30:08)
-
https://sqlitebrowser.org/dl/
- macOS with Brew: brew install --cask db-browser-for-sqlite
Resources...
YouTube playlist: https://www.youtube.com/playlist?list=PLy626RPaflBuyOEJwk3p2yef4bD7fbWg0
-
Built and ran my portfolio app with no changes.
- May take multiple install runs because of lockups. Seems to often get hung up on core-js-pure.
- Bun has a common cache like Pnpm.
- Speed of install depends on presence of node_modules, ~/.bun/install/cache, and/or bun.lockb
-
Deploy to a production server?
- Digital Ocean: Install and Run Bun JS In Real Server: https://www.youtube.com/watch?v=lDGrDOGyOr0 (6:21)
-
What about a Frontier app? Does it just need a 'bunrc' change?
-
Make a .bunfig.toml file with .npmrc configuration for Artifactory:
```
[install.scopes]
fs = "https://username:password@familysearch.jfrog.io/artifactory/api/npm/fs-npm-prod-virtual/"
``` - Couldn't get `bun install` to work on an existing app (fs-webdev/latam) or a new Frontier app (fr-init)
-
-
Using SQLite: https://github.com/oven-sh/bun#bunsqlite-sqlite3-module
- How to build a Rest APIs CRUD App with Bun.js and Hono.js Web Framework and SQLite: https://www.youtube.com/watch?v=a_WFb8xU8tc (30:08)
-
https://sqlitebrowser.org/dl/
- macOS with Brew: brew install --cask db-browser-for-sqlite
BunJS-SORT2022
By David Crowther
BunJS-SORT2022
- 358