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

fediverse-account

v0.1.0

Published

Type a Fediverse handle or a WebID and get back an account you can act with: post, read its timeline, follow, reply, favourite, boost. Works out whether the account lives on a Mastodon-family server or on a Solid pod through FediPod, sends the person to s

Downloads

128

Readme

fediverse-account

The library lets an app take a Fediverse handle or a WebID and act as that account.

  • login — sends the person to wherever their account signs in, their Mastodon server or their pod, and brings them back to where they were.
  • resume — on every page load, finishes a sign-in they are coming back from. Otherwise does nothing.
  • current — the signed-in account, or nothing.
  • signOut — signs them out, at their server or pod as well as in the browser.
  • describe — says what an address is without signing in: a Mastodon account or a pod account, and its handle.

Once signed in, the account gives you:

  • post — publishes a post as them, public, unlisted or followers-only.
  • reply — answers a post.
  • timeline — their home timeline, newest first.
  • follow — follows someone by handle.
  • favourite, boost — as they say.
  • profile — who they are as their server or pod shows them: name, handle, picture, bio, counts, profile page, and the WebID for a pod account.
  • notice — a sentence to show them, or nothing. A browser-based FediPod account gets: "Because you have a browser-based account, your posts and interactions will only go out to the Fediverse when your browser is opened to your account."
  • handle, name, kind — who they are, and whether the account is on Mastodon or a pod, for an app that wants to know.
  • signOut — the same as above.

The app never asks which kind it has. A Mastodon account acts at once. A pod account's actions are carried out by its own agent, at once for a DeviceAgent or Server account, and when fedipod.net is next open for a browser-based one.

Three files, no dependencies. It runs in a page and in a service worker.

The demo shows the sign-in and the profile that comes back.

Get it

From a CDN, with nothing to install:

import { fediAccount } from 'https://cdn.jsdelivr.net/npm/[email protected]/fedi-account.mjs';

Or from npm:

npm install fediverse-account
import { fediAccount } from 'fediverse-account';

Use

import { fediAccount } from 'fediverse-account';
const accounts = fediAccount({ dbName: 'my-app', clientName: 'My app' });

await accounts.resume();                                   // on every page load

signInButton.onclick = () => accounts.login(addressField.value);

const me = await accounts.current();                       // null when nobody is signed in
if (me?.notice) show(me.notice);
await me.post({ text: 'Hello from my app' });
for (const p of await me.timeline({ limit: 20 })) render(p);
await me.follow('@[email protected]');
await me.reply(p.url, 'Well said');
await me.signOut();

The details

  • fediAccount({ dbName, clientName }) — sets the library up for your app, once. dbName keeps this app's sign-ins apart from another app's on the same origin. clientName is what the person sees on the consent screen.
  • login(address, { returnTo, redirectUri })@[email protected] goes to Mastodon; @[email protected], or a WebID, goes to the pod. They come back to this page unless redirectUri says otherwise, and are returned to where they were unless returnTo says otherwise.
  • post({ text, inReplyTo, visibility })visibility is public, unlisted or followers.
  • reply(post, text) — the post is named by its address or its id.
  • timeline({ limit }) — each post as { id, url, author: { id, handle, name }, html, published, inReplyTo }.
  • fetch — the raw authenticated fetch, for anything the above does not cover.
  • actor — the account's ActivityPub id.

Every action answers { sent: true } when the server did it, or { queued: true } when the account's own agent will carry it out.

What it cannot do

  • An address whose server is neither a Mastodon-family server nor a Solid pod is refused with a sentence naming the host.
  • A browser-based FediPod account acts when its browser is open. Posts, follows and replies wait at the account's outbox until fedipod.net is next open in some browser, and its timeline is the one that browser last built. The account's notice says so; show it.
  • A Mastodon account has no pod. An app that keeps things on a pod has nowhere to keep them for such a person.

Where the sign-in goes, and what stays in the browser

A Mastodon account signs in at its own server, which asks the person to approve your app once. The token it grants stays in their browser and is handed back to the server at sign-out.

A pod account signs in at the pod's login provider. The key that proves the sign-in is made in the browser and cannot be read out of it, even by a script on the page. The person stays signed in across browser restarts until they sign out, and sign-out is reported to the provider.