sercrod

Integration notes

Sercrod is designed to stay small and focused. It does not try to own your whole stack. Instead, you drop it into existing pages, docs, or applications where attribute-based behavior is helpful.

This page describes common integration patterns and what to pay attention to when combining Sercrod with other tools.

1. Plain HTML pages

The simplest integration is a static HTML file with a Sercrod host in it. The rough steps are:

  1. Include sercrod.js on the page.
  2. Add one or more <serc-rod> hosts.
  3. Use directives such as *let, *print, *if, *for, or *input inside each host.

A minimal example is shown in Guide: first page. In that setup, existing HTML can stay as it is. Only the parts that need behavior are wrapped in a host.

You do not have to restructure the whole site into components just to use Sercrod. It works well for a few interactive blocks on an otherwise static page.

2. Docs and content sites

A common use case is documentation or content-heavy sites where:

3. With static site generators and SSR

For static site generation or server side rendering, Sercrod can be run in a headless browser using tools like Playwright. In that mode it acts as an attribute based templating layer:

The details of this pipeline, including template files and the Node or Playwright setup, are described in SSG and SSR.

4. As a leaf inside other frameworks

Sercrod can be used as a leaf component inside other frameworks or libraries. In this pattern:

A typical contract looks like this:

This works well when you want to keep a template in plain HTML but still connect it to a parent state. It is not intended for bidirectional state sharing or deep cross integration. In most cases, Sercrod should own only a small, well defined subtree.

5. With CMS or existing backends

When integrating with a CMS or existing backend:

If the CMS has a block or component system, Sercrod can be used to implement a few blocks that rely on attributes and small JSON fragments, while the rest of the site keeps using the CMS standard features.

6. Progressive enhancement

Where possible, use Sercrod as progressive enhancement:

In this style, Sercrod improves the experience when available, but the site remains functional and readable otherwise.

7. When not to use Sercrod

Sercrod is not a replacement for a full application framework. You may not want to use it when:

Used in the right scope, Sercrod is a small, predictable layer that lets you keep HTML in control while adding just enough behavior where attributes make sense.