Build fluency with Bun's built-in API vocabulary — HTTP servers, file I/O, SQLite, bundling, and native password hashing.
0 / 5 completed
1 / 5
In a PR review, a colleague replaces Node's http.createServer with Bun.serve(). A junior asks what Bun.serve() provides over Node's HTTP module. The answer is:
Bun.serve() is Bun's built-in HTTP server using the Web Request/Response API. It supports TLS, WebSockets, and static routes out of the box with significantly higher throughput than Node's http module.
2 / 5
During a standup, a script reads a large file. Your teammate suggests using Bun.file() instead of fs.readFile(). The advantage is:
Bun.file(path) creates a lazy BunFile. Data is read only when you call .text(), .json(), .arrayBuffer(), or .stream() — reducing unnecessary I/O.
3 / 5
In a design review, the team wants SQLite persistence without a separate process. A colleague proposes bun:sqlite. What is bun:sqlite?
bun:sqlite is a first-class Bun module (no npm install) wrapping the SQLite3 C library. It provides a synchronous Database class with prepared statements and excellent performance.
4 / 5
In a standup, a security-conscious teammate asks how to hash a password securely in Bun without installing bcrypt. You mention Bun.password. What does it provide?
Bun.password.hash() and .verify() provide native bcrypt and Argon2 hashing — no bcrypt npm package or native recompilation required. Algorithm is configurable.
5 / 5
During a PR review, a build script uses Bun.build() instead of esbuild directly. A colleague asks what Bun.build() does. The correct answer is:
Bun.build() is Bun's native bundler (powered by the same engine as Bun's runtime). It supports entrypoints, splitting, external packages, minification, and multiple target formats — no esbuild dep needed.