Introduction

What is Ascua

A UI framework without a Virtual DOM. You write HTML inside TypeScript, a WebAssembly compiler turns it into DOM operations, and the browser gets 4.01 kB of runtime.

The idea on one screen

ts
import { signal } from "ascua";

function Counter() {
  const count = signal(0);

  return view`
    <button onclick=${() => count.update((c) => c + 1)}>
      Clicks: ${() => count()}
    </button>`;
}

That is real HTML —onclick, not onClick— inside a TypeScript template. view does not exist at runtime: the compiler replaces it with the calls that build that button, and puts one effect on the only spot that reads a signal, the text. When count changes, that effect writes to that text node. The function does not run again, no new tree is built and nothing is diffed.

Why no Virtual DOM

A Virtual DOM framework answers a change by rebuilding a representation of the tree and comparing it with the previous one to work out what to touch. The work grows with the size of the tree, not the size of the change.

Ascua sets up once, at compile time, the link between each piece of data and the node that shows it. From then on, changing the data runs the DOM operation that belongs to it. There is nothing to work out because nothing was forgotten. It is the same model as Solid or Svelte 5; what changes is where each piece lives.

Three ideas

1. A closure is reactive; nothing else is. ${() => count()} follows the signal; ${count()} is evaluated once. You can tell what may change by looking at the template, without knowing the types.

2. HTML, not JSX. Attributes are HTML attributes, markup can be copied and pasted as is, and a <style> inside a template is scoped CSS extracted at compile time.

3. WebAssembly where it pays off. The compiler is written in Rust and ships as a single 109 KB .wasm that runs in Node, Bun, Deno and the browser —the playground is that same file—. In the browser, though, the DOM lives in JavaScript and crossing the boundary costs more than the operation, so the runtime is JavaScript.

Sites with islands

On top of the runtime, the Vite plugin turns src/routes/ into a site: one HTML page per file, with JavaScript only in the islands. It can be built as static files or as a server with form actions, middleware and signed cookies, and that server runs on Node, Bun, Deno and Cloudflare Workers.

sh
npm create ascua@latest my-site

If you come from Fresh, the model is the same: From Fresh compares them side by side.

What it ships

Package What it is gzip
ascua Signals, DOM operations, SSR and hydration 4.01 kB
ascua-router The route as a signal, with params and links that do not reload 1.03 kB
ascua-query Remote data with a cache per key, like TanStack Query 2.15 kB
ascua-security CSP with hashes, secure headers, signed cookies, CSRF defense —
vite-plugin-ascua Compiles the templates, and the site kit —
create-ascua A new site, ready for dev and build —

A whole application —runtime, a counter and a keyed list— weighs 4.22 kB gzip.

When it fits, and when it does not

It fits if you want HTML to read as HTML, the bundle measured in single-digit kilobytes and every piece auditable in an afternoon.

It does not fit if you need the React ecosystem —its components, its hooks, JSX— or Server Components: they are non-goals, not missing features.

Where to go next

  • Getting started: a new site, or the runtime by hand.
  • Reactivity and Templates: signals, and how a template turns them into the DOM.
  • Sites: routes, data, islands, layouts, middleware and where it runs.
  • From Fresh: what maps one to one, and what Ascua does not have yet.

Components, styles, the router and the API reference are in Spanish for now.