Skip to content

Droplets

Server-rendered components you can embed from any stack, as a Vite plugin on Hono. Write each one in Svelte, Vue, Solid, React, Preact, Hono JSX, Handlebars or Lit.
Terminal window
npm create droplets@latest my-widgets

GitHub · npm · MIT licensed

Droplets serves each of your components at its own URL, as a fragment of server-rendered HTML. Any server that can make an HTTP request (nginx, PHP, WordPress, Express, Next.js, FastAPI) fetches the fragment, pastes it into its page and loads one script; the component then comes alive there, with its own data, styles and JavaScript.

It is for teams that need the same interactive widgets in several apps or stacks, that add components to an existing site piece by piece, or that ship UI on their own schedule. For one application in one framework, that framework’s own meta-framework does the job better.

<!-- Any page, any server: paste the fragment, load one script. -->
<script type="module" src="https://drops.example.com/index.js"></script>
<acme-widgets data-droplet="hello">
<!-- GET https://drops.example.com/droplets/hello?who=Ana -->
<h1>Hello Ana!</h1>
</acme-widgets>
The shop on a WordPress page: hover a droplet for its framework, SSR, hydration, prerender and actions; then a comment goes up live.

The component is the unit

A droplet is one component with its own URL, served by a small Hono server. Ask for it as an HTML fragment; it brings its own data, styles and JavaScript.

Server-rendered, hydrated when it matters

Each droplet decides whether it renders on the server, whether and when it hydrates (at once, when visible, on first interaction) and whether it is prerendered.

Plain Vite

vite dev with hot updates on any host page, vite build for the browser and the server, node dist/server.js, Bun, Deno or a Cloudflare Worker to run.

Errors have a place

Every droplet can have its own error page, rendered on the server or in the browser when a load or the component fails.

Droplets grew out of SvelteKit: + files, loads, form actions, hooks and prerendering, reshaped for components that live inside someone else’s page. It is an independent project, not affiliated with Svelte or SvelteKit. What is a droplet? explains the rest.