b
LearnBun.org
Chapters

Bun for Beginners

From empty folder to deployed app

Code on GitHub →

Bun for Beginners
Get the rest of the book.
Part II — eight chapters that turn the routing groundwork from Part I into a real Notes app. Part III ships in a few weeks (production deploy + ops).
·Forms, validation, and application state
·SQLite persistence and user accounts
·Sessions, login, and authorization
·Edit, delete, search, and pagination
Part II — Build the Notes App
CH 05
Routes, Layout, and Static Files
Add multiple routes, share a layout across pages, and serve CSS and images from a public folder.
Free
CH 06
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.
Paid
CH 07
Persist Notes with SQLite
Replace the in-memory notes array with Bun's built-in SQLite driver. Notes survive restarts, tests get a clean database every run, and we get our first look at the data on disk.
Paid
CH 08
Validate Input and Handle Errors
Reject empty notes, show form errors with the user's input preserved, replace the bare 404 with a styled page, and add a top-level error handler so a broken request never leaks a stack trace.
Paid
CH 09
User Accounts
Add a sign-up form, hash passwords with Bun's built-in argon2id, and store users in the database.
Paid
CH 10
Sessions and Login
Turn a user account into a session — a login form, a sessions table, a cookie that survives a refresh, a logout route, and a currentUser() helper so the rest of the app can ask who is asking.
Paid
CH 11
Authorization and Ownership
Tie every note to a user, gate the routes that create and read them, and let the nav reflect who is logged in — so each account sees only its own notes.
Paid
CH 12
Edit and Delete
Split the test file along module lines, add edit and delete routes parameterized by note ID, gate them with the same auth-and-ownership pattern, and flash a confirmation message on the redirect home.
Paid
CH 13
Search and Pagination
Add a search box that filters notes by title or body, page the list so the home page stays readable past a couple of dozen notes, and keep ownership where the last two chapters left it.
Paid
Feedback