Introduction

Sparke turns an ordinary multi-page site into an instant SPA – with one script tag, no build step, and no framework.

Sparke turns a standard multi-page app into an instantly snappy SPA. It aggressively preloads content while the browser is idle, then atomically swaps pages in from memory when you click a link – no build step, no config, no framework.

It's pure progressive enhancement, so it fails safely: if JavaScript is unavailable, the browser just behaves as a normal MPA.

One script tag. No package, no bundler. Add it, and your existing site is instant.

The one-liner

Drop a single tag into your <head>. Use defer so it runs after the document parses.

Self-hosted (recommended)html
<script src="/js/sparke.min.js" defer></script>
Or via CDNhtml
<script
  src="https://cdn.jsdelivr.net/gh/benshawuk/sparke@1/sparke.min.js"
  defer
></script>

Sparke works with any server-rendered multi-page site - plain HTML, Astro, or HTML enhanced with Alpine, or HTMX etc.
Just use defer and put it in the <head>.

It's not for client-rendered SPA frameworks like React, Vue, Svelte or Solid - those already own rendering and routing, which is exactly the job Sparke does for server-rendered HTML. Astro is a perfect fit, though: every route it ships is a real HTML page.

Why it's instant

HTMX, Turbo and Livewire only hit the network after you click, so every navigation is gated on a round trip. Sparke flips the order: it preloads reachable same-origin pages into memory while the browser is idle, before you click. So the click is an instant in-memory swap with no request on the critical path.

Network work happens A click feels like
HTMX / Turbo / Livewire After the click Delay = round trip
Sparke (true SPA) Before the click, while idle Instant swap from memory

Those libraries solve a different problem (server-driven partials, reactivity, no-reload forms) and run happily alongside Sparke. Every page Sparke serves is still a complete, server-rendered document – so you keep the SEO, the no-JS fallback, and the progressive enhancement of an MPA.

What Sparke handles

Sparke intercepts same-origin http/https <a href> links. It lets the browser handle everything else: a target other than _self, download, rel="external", hash-only links, mailto:/tel:/javascript:, and any route you exclude with data-ignore.

Next steps