SynergyJS v0.4.x · 4.1 KB gzipped

Declarative Custom Elements without the Virtual DOM tax.

SynergyJS is a 4KB standards-first JavaScript library for building reactive Web Components using native HTML5 <template> elements, fine-grained Proxy state binding, and zero-build ES modules.

import { define } from 'synergy'

define('counter-widget', () => {
  return {
    count: 1,
    increment() {
      this.count += 1
    }
  }
})

Why SynergyJS?

Modern frontend toolchains routinely ship 40KB to 120KB of runtime JavaScript before rendering a single interactive component. SynergyJS takes the opposite path: it builds directly on top of browser-native Custom Elements v1, standard DOM mutation primitives, and ES6 Proxies to deliver ergonomic reactivity in roughly 4KB minified and gzipped.

Native HTML Templates

Author standard markup using <template> tags with Mustache-style interpolations and attribute bindings—no JSX compiler required.

Fine-Grained Proxy State

Mutate properties directly on your component view-model. SynergyJS tracks exact DOM text and attribute nodes and updates only what changed.

Light & Shadow DOM

Render into encapsulated Shadow DOM or stay in the Light DOM for effortless global CSS styling and predictable search crawler indexing.

Declarative Markup Meet Native Web Standards

When you register a component with define(tagName, factory, options), SynergyJS walks your template once, records surgical node pointers for dynamic expressions like {{ title }} or each="item in items", and binds DOM event listeners directly to methods on the returned state object.

<template id="todo-list">
  <form onsubmit="addTodo">
    <input name="draft" value="{{ draft }}" placeholder="Add task..." />
    <button type="submit">Add ({{ items.length }})</button>
  </form>
  <ul>
    <template each="todo in items">
      <li completed="{{ todo.done }}">{{ todo.text }}</li>
    </template>
  </ul>
</template>

Production Tooling, SSR Verification & QA Workflows

Because Web Components often power documentation portals, marketing landing pages, and SaaS authentication flows, shipping them to production requires validating both search engine crawlability and end-to-end form behavior:

Explore the Documentation

Ready to build with SynergyJS? Start with the Installation & Getting Started guide, learn how Declarative Templates & Repeated Blocks work under the hood, or dive straight into SSR Prerendering & Search Hydration.