1. Built-in module
bun:sqlite is a built-in module — no npm install or native build step needed.
import { Database } from "bun:sqlite";Typorithm · medium
Step 1 of 8 · intro card
Bun APIs
bun:sqlite is a built-in, zero-dependency, synchronous SQLite driver. Open a Database, prepare a statement with db.query, and run it with .all(...) (all rows), .get(...) (one row), or .run(...).
bun:sqlite ships inside Bun, so you import { Database } from "bun:sqlite" with no npm install and no native compile step — it is a true zero-dependency embedded database.
new Database("app.db") opens the file synchronously; there is no connection pool or await because SQLite is embedded in the process.
db.query(sql) prepares a statement once; ? placeholders are bound when you execute, and .all(args) returns every matching row while .get(args) returns the first.
bun:sqlite is built in — no dependency.
Database is synchronous; no await needed.
Use ? placeholders and .all()/.get() to run.
import { Database } from "bun:sqlite";
const db = new Database("app.db");
const rows = db.query("SELECT * FROM users WHERE age > ?").all(18);Connect each part of the code to the concept before you type.
bun:sqlite is a built-in module — no npm install or native build step needed.
import { Database } from "bun:sqlite";Creating a Database opens (or creates) the embedded SQLite file synchronously.
new Database("app.db")db.query prepares a statement; the ? is a placeholder bound at execution time.
db.query("SELECT * FROM users WHERE age > ?")all(18) binds 18 to the ? placeholder and returns every matching row as objects.
.all(18)Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.