chapter fourteen

14 Beyond basics

 

This chapter covers

  • Choosing small libraries and tools without giving up the platform
  • Using static generation, lazy loading, and performance budgets deliberately
  • Adding offline behavior with service workers and Cache Storage
  • Making a Vanilla app installable with a manifest and the right metadata

14.1 Micro-libraries

By this point in the book, we have already built real features with the platform itself: components, routing, data loading, local persistence, and reactive updates. That changes how you should evaluate micro-libraries. They are small layers that remove friction once you already understand the primitives underneath.

A good micro-library sharpens a task that is still slightly awkward in raw browser APIs. A bad one quietly grows into a framework-shaped dependency that owns too much of your architecture.

A micro-library is a focused tool with a narrow contract. It usually solves one repeated problem well:

  • rendering tagged templates
  • wrapping IndexedDB with Promises
  • patching DOM trees efficiently
  • managing a small shared store
  • dispatching events with a cleaner API

The goal is to remove repetitive glue code while keeping the resulting application easy to inspect, debug, and replace later, without hiding this is just the Web and not a new layer on top of it.

That makes micro-libraries a good fit for Vanilla projects. You can adopt one for a single concern without surrendering routing, rendering, data flow, or deployment to a larger runtime.

14.1.1 Design patterns

14.1.2 Why JavaScript fits micro-libraries

14.1.3 Limitations

14.1.4 Adoption checklist

14.1.5 Creating a micro-library

14.1.6 Architecture

14.1.7 Integration

14.1.8 Documentation

14.1.9 Typing declarations

14.1.10 Packaging

14.2 Useful micro-libraries today

14.3 Lit for components

14.4 Wrec for components

14.5 Static site generation

14.5.1 Advantages