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

@adonis-agora/collaboration-client

v0.8.1

Published

Client-side React hooks for @adonis-agora/collaboration — collaborative docs, presence, comments and versions. Part of the Agora ecosystem.

Readme

@adonis-agora/collaboration-client

React client hooks for @adonis-agora/collaboration — collaborative documents, presence, anchored comments and version control with automatic transport selection (Hocuspocus self-hosted or PartyKit edge).

React 18/19 · zero dependencies beyond yjs stack · ESM.

Install

pnpm add @adonis-agora/collaboration-client

Server side: install @adonis-agora/collaboration and run node ace collaboration:init to publish the REST routes these hooks consume.

Usage

Wrap your app once:

import { CollaborationProvider } from '@adonis-agora/collaboration-client'

<CollaborationProvider
  baseUrl="https://api.app"
  getHeaders={() => ({ cookie: sessionCookie })}
>
  <App />
</CollaborationProvider>

Then per collaborative view:

import {
  useCollabDoc,
  useAwareness,
  useComments,
  useVersions,
} from '@adonis-agora/collaboration-client'

function Writing({ docName }: { docName: string }) {
  // Y.Doc shared per docName (cached across mounts), + connection status
  const { doc, status, error } = useCollabDoc(docName)
  const { peers } = useAwareness(docName)          // who's online
  const { comments, create, resolve, remove } = useComments(docName, 'text')
  const { versions, create: createVersion, restore } = useVersions(docName)

  if (status === 'error') return <p>{error?.message}</p>

  return (
    <>
      {/* feed `doc` into Tiptap / ProseMirror / Monaco… */}
      {peers.map((peer) => <Avatar key={peer.clientId} name={peer.name} />)}
    </>
  )
}

How it works

  1. useCollabDoc fetches an ephemeral token from GET {baseUrl}/collaboration/token?doc=<name> (your auth middleware protects this route).
  2. The response's engine field picks the transport:
    • yjsHocuspocusProvider against the Adonis server (wsUrl path)
    • partykitYPartyKitProvider straight to the Cloudflare room
  3. Comments and versions are REST, not CRDT state — they live in your database via the server package's storage.
  4. Sessions survive component unmounts; one Y.Doc per document name per provider.

Custom transport

Bring your own sync engine by injecting a factory:

<CollaborationProvider baseUrl="…" createTransport={(info, doc, docName) => new MyTransport(info, doc)}>

API

| Hook | Returns | |---|---| | useCollabDoc(docName) | { doc: Y.Doc, status: 'connecting'\|'connected'\|'disconnected'\|'error', error } | | useAwareness(docName) | { peers: CollabPeer[], status } | | useComments(docName, space?) | { comments, loading, error, refresh, create, resolve, remove } | | useVersions(docName) | { versions, loading, error, refresh, create, restore } |

License

MIT