liveBook · Manning

Chapter 15: Building an app

What you will learn in chapter 15 of Vanilla Web

Introduces Luma Books and outlines the static Vanilla Web app that the chapter builds.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces Luma Books and outlines the static Vanilla Web app that the chapter builds.

Key terms: Luma Books, JSON file, Web Components, IndexedDB, metadata

15.1 Planning

The section plans Luma Books around a small set of complementary techniques and clear responsibilities for each part of the app.

Key terms: smallest useful set, data-binding techniques, router, store, page components, small reusable components, shared cart state

15.2 Setting up the project

The section establishes the app’s HTML entry point and a small, responsibility-based CSS structure.

Key terms: index.html, manifest, favicon, module entry point, theme.css, base.css, layout.css, components.css, @layer

15.2.1 The document metadata

This section explains how the app’s document metadata coordinates with routing, styling, module loading, and installability.

Key terms: character encoding, viewport, width=device-width, initial-scale=1, viewport-fit=cover, <title>, client-side router, renderElement(), document.title, theme-color, --color-primary

15.3 Screens and app architecture

The section maps Luma Books’ six routes to screens and describes a persistent application shell whose outlet displays the current page.

Key terms: route-level screens, /products/:id, /order/:id, application shell, /src/app-shell.js, route outlet, page components

15.4 Routing and navigation

This section shows how the app connects route definitions to web-component pages while keeping link, programmatic, and optional animated navigation usable across browser capabilities.

Key terms: route table, lazy import, custom element name, URLPattern, path-matcher.js, literal segments, :name parameters, Navigation API, history-router.js, real <a href> links

15.5 Loading and persisting data

This section shows how the app loads book data, caches it for failed fetches, and stores local cart and order data in IndexedDB.

Key terms: books-api.js, fetch(), AbortSignal, IndexedDB, idb-promises.js, micro-library, IndexedDB requests and transactions, Promises, books, cart

15.6 Web components

This section shows how the app uses web components for its header, catalog, detail screen, and checkout, including safe rendering and form submission across a shadow boundary.

Key terms: cart store, unsubscribe function, disconnectedCallback(), book object, cart service, <template>, textContent, innerHTML, book-rating, value attribute

15.7 Data flow and reactivity

This section explains how the cart store notifies components of state changes while leaving rendering to the components.

Key terms: EventTarget, subscribeCart(), cart store, queueMicrotask(), change events, synchronous updates, store, DOM, components, cart data

15.8 Making the app installable and offline-capable

This section shows how the app uses a web app manifest and a conservatively caching service worker to support installation and offline use.

Key terms: web app manifest, /manifest.webmanifest, installation dialog, service worker, precache, application shell, network-first, IndexedDB, /offline.html, /src/services/pwa.js

15.9 Testing and running

The section explains the app’s browser-based smoke test, what it checks, and where to open the app and test locally.

Key terms: smoke test, edge case, browser-based smoke test, catalog, cart quantity, IndexedDB, test runner

15.10 Deployment notes

The section explains how to deploy Luma Books with route fallbacks, correct resource headers and caching, and a GitHub Pages workaround.

Key terms: application routes, fallback, rewrite rule, client-side router, /deploy/, real file, file extension, MIME type error, .webmanifest, application/manifest+json

15.11 Closing notes

The closing notes present Luma Books as a small application that brings the book’s Vanilla Web techniques together while keeping each file’s purpose clear.

Key terms: Luma Books, Vanilla Web, framework

15.12 Summary

Concepts explained in this chapter

← Chapter 14: Beyond basics

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.