Core SDK
Message middleware
LLM middleware on the Worker and client-side send hooks.
FluxyChat does not expose a client.use() message pipeline in the browser SDK. Middleware patterns split between Worker-side processing and LLM middleware for agents.
Worker-side
Worker-side validation, templates, moderation, and rate limits run before Durable Object broadcast. Declarative publish middleware lives in fluxy.config (onPublish allow/block/mask) via @fluxy-chat/config, bundled as apps/worker/fluxy.config.js. That is the FluxyChat equivalent of a one-file server rules deploy. You still ship it with the Worker, not a second CLI.
LLM middleware (agents)
The SDK exports LLM middleware helpers for composing provider calls on the server:
import { composeMiddlewares } from "@fluxy-chat/sdk";
// Used in custom agent/tool servers, not in browser clientsAgent tool execution flows through toolExecuteUrl on the agent profile.
Client patterns
For client-side filtering (analytics, UI transforms), subscribe to useChat messages:
const { messages } = useChat({ roomId, client });
const visible = messages.filter((m) => !m.deletedAt);For send-time validation, validate in your UI before calling sendMessage.
Templates
Server-rendered template messages bypass free-text middleware:
await client.createMessage(roomId, "", null, undefined, clientMessageId, {
templateId: "tpl_welcome",
templateVars: { name: "Jane" },
});See Message templates and Moderation.