Tutorial series
Build a community library app with Next.js
Build a small full-stack app in Next.js 16 one part at a time: a book catalogue in SQLite, search, editing with server actions, librarian sign-in, lending, caching, tests and a deploy to your own server.
Start a community library app with Next.js 16
You will plan a small community library app, create it with Next.js 16.4, and end with a navigable skeleton of a home page, a book list and a page per book, styled with CSS Modules, plus a written data model for the rest of the series.
Beginner · 20 min
List and search books with server components and URL search params
You will turn the library's book list into a searchable, paged catalogue that reads SQLite on every request, keeps the search in the URL, streams results behind a loading placeholder and filters to books on the shelf with one small client component.
Intermediate · 25 min
Add and edit books with server actions and Zod validation
You will give the library app an add-a-book page and an edit page whose forms post to Next.js 16 server actions, are checked by a Zod 4 schema on the server, show each mistake next to its field and redirect to the saved book.
Intermediate · 26 min
Sign in librarians with Better Auth and protect actions
You will add email and password sign-in for librarians to the community library app with Better Auth 1.7, store sessions in its SQLite database, and end with an app where only a signed-in librarian can add or edit books, even when someone calls a server action directly.
Intermediate · 28 min
Lend and return books safely with database transactions
You will let librarians lend and take back books from each book's page, with the loan rules enforced inside one SQLite transaction so two clicks at once can never lend the same book twice or push a member past three books, plus an overdue list.
Intermediate · 30 min
Cache library pages with Next.js 16 Cache Components and refresh them on change
You will cache the library catalogue with the "use cache" directive, cacheLife and cacheTag, refresh it with updateTag after every edit or loan and with revalidateTag from outside the app, and end with a fast catalogue that never serves a lent book as available.
Advanced · 30 min
Test the library app: loan rules in Vitest, journeys in Playwright
You will unit test part 6's loan rules with Vitest 5 against a fresh SQLite file per test, and drive the librarian journey through the production build with Playwright 1.65, ending with one npm test command that would have caught the double-lend bug from part 6.
Intermediate · 34 min
Deploy the library app to a Linux server with Node, systemd and Nginx
You will build the community library app as a standalone Next.js release, run it on an Ubuntu 26.04 server as a systemd service behind Nginx with its SQLite database in /var/lib, apply migrations on every deploy and back the database up every night.
Intermediate · 35 min
Store the library books in SQLite with Drizzle ORM
You will turn the library's data model into SQLite tables with Drizzle ORM 0.45, create them with drizzle-kit migrations, seed twenty books, and end with a server-only data module that the Next.js pages read the catalogue from.
Intermediate · 25 min