Nemesia guide
This guide explains Nemesia from first mount to production cleanup. It is written for developers integrating behavior into HTML rendered by a backend, static-site generator, or CMS.
Start here
- Getting started — install Nemesia and mount a first component.
- HTML contract — understand roots, refs, options, and nested ownership.
- Applications and registration — create an app and control its scope.
- Concrete components — define class-based behavior and root constraints.
Component APIs
- Refs — request required, optional, and repeated elements.
- Options — parse typed values from root attributes.
- Events and lifecycle — attach listeners and release resources.
Advanced usage
- Dynamic DOM observation — support content added or removed after initial mount.
- Distributed components — attach delegated behavior to an app scope.
- TypeScript and diagnostics — public exports, warnings, errors, and bundles.
- Recipes — practical patterns for common website interactions.
Mental model
Nemesia has deliberately narrow responsibilities:
- HTML comes from somewhere else.
- A component class describes behavior for one existing root.
- Fields request the refs and options that behavior needs.
- Invalid markup skips only the invalid instance.
- The app owns mounted instances and cleans them up deterministically.
If a page needs client-side templates, routing, stores, or reactive rendering, use a framework designed for those jobs. Nemesia is designed as the layer between server HTML and repetitive vanilla JavaScript code.