SSR patterns

VSN.js is designed for SSR-first sites. Treat the HTML from your backend as the source of truth, then enhance it with behaviors.

Progressive enhancement

Start with working HTML:

<button class="card">Add to cart</button>

Then enhance:

behavior .card {
  on click() { addToCart(); }
}

Partial updates

Use vsn-get to refresh specific fragments rather than re-rendering everything.

Hydration-like flows

If you need client state, store it in scope, not in the DOM. You can still read initial values from attributes.