Bun for Beginners
From empty folder to deployed app
Notify me
Get notified when Part II ships.
One email per release. No spam, no upsells. Just the next set of chapters when they're ready.
Part I — Orientation and First Success
CH 00
Free
Introduction
What this book is, the four pillars of Bun, and how the chapters fit together.
CH 01
Free
Initial Setup
Install Bun on macOS, Linux, or Windows. Get Git working. Confirm everything runs before we write a line of code.
CH 02
Free
Your First Bun Project
Scaffold a project with bun init, write a server with Bun.serve, return HTML, add routes, and run it all in watch mode.
CH 03
Free
Your First Real Bun Script
Build a command-line word counter. Read arguments and files with Bun's built-in APIs. Install your first package with bun add.
CH 04
Free
Test What You Built
Extract countWords into its own file, write tests with bun:test, and use watch mode to get instant feedback as you code.
Part II — Build the Notes App
CH 05
Planned
Routes, Layout, and Static Files
Add multiple routes, share a layout across pages, and serve CSS and images from a public folder.
CH 06
Planned
Forms, Notes, and Application State
Accept form submissions, hold notes in memory, and render them back to the page. Lays the groundwork for SQLite in the next chapter.
CH 07
Planned
Persist Notes with SQLite
Replace in-memory state with bun:sqlite, design a simple notes table, and migrate the form to write rows that survive a restart.
CH 08
Planned
Validate Input and Handle Errors
Reject empty notes, surface validation errors back to the form, and handle malformed requests gracefully.
CH 09
Planned
User Accounts
Add a users table, a sign-up form, and password hashing so notes can belong to people instead of one shared list.
CH 10
Planned
Sessions and Login
Build a login form, set HttpOnly session cookies, and protect routes that require an account.
CH 11
Planned
Authorization and Ownership
Tie each note to its owner so users only see and edit their own notes, and keep route handlers honest about who can do what.
CH 12
Planned
Tags and Search
Add tags to notes, render a tag filter in the sidebar, and wire up a basic full-text search across the notes table.
CH 13
Planned
Polish and Pagination
Pagination, empty states, timestamps, and the small UX details that make the app feel real instead of half-finished.
Part III — Ship It
CH 14
Planned
Prepare for Production
Environment variables, structured logs, error pages, and a build that runs cleanly in CI before it ever touches a server.
CH 15
Planned
Deploy to a VPS
Provision a small Linux VPS, transfer the build, and run it under systemd so it survives reboots and crashes.
CH 16
Planned
Domains, HTTPS, and Logs
Point a domain at the box, terminate TLS with Caddy, and learn to read the logs you'll need on day one in production.
CH 17
Planned
Next Steps
Ideas for where to take the app next, and a short tour of what we deliberately left out so the book could finish.