npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fluxy-chat/sdk

v0.2.1

Published

Fluxychat JavaScript/TypeScript SDK — WebSocket rooms, REST messages, FluxyRealtimeProvider, useChat with loadMore

Downloads

325

Readme

@fluxy-chat/sdk

Client for a Fluxychat Worker (self-hosted or Fluxychat Cloud): rooms, messages, WebSockets, agents, and optional React useChat.

The SDK talks to your Worker URL. It does not include LLM API keys — only your Fluxy project API key or member JWT.

Install

npm install @fluxy-chat/sdk
# or
pnpm add @fluxy-chat/sdk

Requires React 18+ if you use useChat (peer dependency).

What you must configure

| Piece | Who sets it | Notes | |--------|-------------|--------| | Worker baseUrl | You | e.g. https://fluxychat-worker.<account>.workers.dev or your custom domain | | Project API key (fc_…) | Worker / console | Mint JWTs via POST /auth/token with header X-Fluxy-Api-Keyserver-side only | | Member JWT | Your backend or Fluxychat console | Passed to FluxyChatClient / useChat as token | | LLM provider keys | Worker secrets or console | For agents; never embed in the npm package |

Minimal backend (mint JWT)

curl -X POST "$WORKER_URL/auth/token" \
  -H "Content-Type: application/json" \
  -H "X-Fluxy-Api-Key: fc_your_project_key" \
  -d '{"userId":"alice","roles":["member"],"ttlSeconds":3600}'

Use the returned token in the browser.

Quick start (React)

Option A — explicit client

import { FluxyChatClient, useChat } from "@fluxy-chat/sdk";

const client = new FluxyChatClient({
  baseUrl: process.env.NEXT_PUBLIC_FLUXYCHAT_WORKER_URL!,
  userId: "alice",
  token: memberJwtFromYourBackend,
});

function Room({ roomId }: { roomId: string }) {
  const { messages, sendMessage, connectionStatus, loadMore, hasMore, isLoadingMore } =
    useChat({ roomId, client });
  // render messages; call loadMore() when the user scrolls to the top
}

Option B — FluxyRealtimeProvider (hosted Next.js or custom mint)

Wrap your app (or chat layout) once. The provider refreshes the member JWT before expiry and on auth errors.

import { FluxyRealtimeProvider, useChat } from "@fluxy-chat/sdk";

export function ChatLayout({ children }: { children: React.ReactNode }) {
  return (
    <FluxyRealtimeProvider
      workerUrl={process.env.NEXT_PUBLIC_FLUXYCHAT_WORKER_URL!}
      connectUrl="/api/fluxy/connect"
    >
      {children}
    </FluxyRealtimeProvider>
  );
}

function Room({ roomId }: { roomId: string }) {
  const { messages, sendMessage, loadMore, hasMore } = useChat({ roomId });
  // …
}

For your own backend mint flow, pass authTokenProvider={() => fetch("/api/chat-token").then(r => r.json())} instead of connectUrl.

Pagination

GET /api/messages supports a before cursor (createdAt of the oldest visible message). The SDK sorts history chronologically and exposes:

  • hasMore — another page may exist
  • isLoadingMoreloadMore() in flight
  • loadMore() — prepends older messages

Self-host vs hosted cloud

  • Self-host: deploy apps/worker from the monorepo, run D1 migrations, set secrets. See apps/worker/.dev.vars.example.
  • Hosted cloud: use the Fluxychat dashboard on Vercel; sign in with Clerk; project + API keys are provisioned for you.

Full operator docs: docs/dashboard-integration.md.

Agents

Agent invokes run on the Worker (POST /agents/:id/invoke). Configure provider keys on the Worker or per-project in the console. The SDK exposes REST helpers only.

Support

Questions: [email protected] · Issues: github.com/AlessandroFare/fluxychat/issues

License

MIT — see LICENSE.