Back to browse
Backlit – Lit Web Component SSR for Drupal via Go and WASM, No Node.js

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

by bennypowers·Mar 19, 2026·3 points·0 comments

AI Analysis

●●SolidBig BrainNiche Gem

Go binary with embedded WASM replaces Node.js sidecar for Lit SSR in Drupal.

Strengths
  • 350ms cold start per PHP-FPM worker, then 0.32ms per render with warm WASM
  • 9MB static binary requires no container networking or process monitoring
  • Safe failure mode returns original HTML unchanged if binary unavailable
Weaknesses
  • Drupal-only integration limits audience to shrinking CMS market
  • No component library shipped—users must provide their own Lit definitions
Target Audience

Drupal developers, web component authors, PHP developers

Similar To

@lit-labs/ssr · 11ty · Astro

Post Description

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.

Similar Projects

DesignMid

Terminal Style Web Component

Terminal UI component for docs when xterm.js and terminal-react already exist.

CozyEye Candy
spider-hand
101mo ago