Settings

Theme

Show HN: Backlit – Lit Web Component SSR for Drupal via Go and WASM, No Node.js

bennypowers.dev

3 points by bennypowers 14 days ago · 0 comments · 1 min read

Reader

Two years ago I posted about server-rendering Lit web components in Drupal using a Node.js sidecar container. It worked but felt like a proof of concept -- Docker, inter-container networking, an extra process to babysit.

Backlit replaces all of that with two lines:

  composer require bennypowers/backlit  
  drush en backlit
Composer downloads a pre-compiled Go binary for your platform. The binary embeds a WASM module (QuickJS + @lit-labs/ssr, compiled via Javy). Drupal pipes page HTML to the binary's stdin; rendered Declarative Shadow DOM HTML comes back on stdout. The WASM instance stays warm across requests: ~350ms cold start once per PHP-FPM worker, ~0.32ms per render after that.

The funny part: I didn't build this for Drupal. I built lit-ssr-wasm to add live component previews to `cem serve` -- a dev server for custom elements manifest tooling (https://github.com/bennypowers/cem). Once the WASM module existed, the Drupal integration was an afternoon's work.

WASM is to backend runtimes what web components are to the browser: write it once, run it anywhere.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection