camelon

Examples

camelon runs in any modern JavaScript runtime — a browser service worker included. So the interactive demos throughout these docs aren't talking to a server: each one is a separate camelon instance answering its own requests inside your browser. Open the Network tab and watch the worker handle them.

Each app below is a complete, runnable camelon project under examples/ in the repo. Run any of them with pnpm dev in its directory (deno task dev for the Deno one).

counter

The smallest app. A Datastar counter: signals on the client, two resource routes that patch count back over SSE. examples/counter.

Per-route head export — a route overrides the document <title> and adds its own styles, merged tag-by-tag with the document head. examples/head.

chat

Streaming SSE chat. The response route appends words to a message bubble with patchElements(html, { selector, mode: 'append' }), then returns the final element. examples/chat.

session

Login, logout, and a guarded dashboard. Cookie sessions, a _middleware.ts auth guard, and one-read flash messages. examples/session.

db

A fruit store with a cart, backed by an injected client through the db arg. examples/db.

deno-counter

The counter app on Deno — Deno.serve(await createHandler(...)), no Express, no Node. Proof the core is runtime-agnostic. examples/deno-counter.

browser-counter

camelon running inside a browser service worker. The worker answers the page's own fetches; there is no server. The bundle is built on Node (stubbing node:*), the browser only runs it. examples/browser-counter.