Use CSR when
- You are prototyping or building an internal browser-only app.
- The initial HTML does not need server-rendered component content.
- You want the smallest setup: one HTML file, one client entry, and component modules.
Dathra apps are built around custom elements created withdefineComponent().
Start with CSR if you only need a browser-rendered app, or use SSR when you want the server
to emit Declarative Shadow DOM before hydration.
Register a custom element in JavaScript and place the tag directly in HTML. This is the simplest way to ship a client-only app.
Render Declarative Shadow DOM on the server and hydrate the same custom element on the client.
jsx: "preserve"andjsxImportSource: "@dathra/core"so the
Dathra transformer receives JSX.classand event props
such asonClick.defineComponent()props.foo.valuestyles/cssThe docs app in this repository follows the SSR shape: a root custom element, a server entry
that renders that element, and a client entry that registers components before calling hydrate(document).
src/DocsAppRoot.tsxdefines the root Web Componentsrc/entry-server.tsxrenders the root component to DSDsrc/entry-client.tsbinds client state and hydratesvite.config.tsinstalls the Dathra Vite plugin in SSR modeAfter the first app runs, use the concept docs to understand the primitives behind the quick starts: