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

@fedify/vocab

v2.0.1

Published

Activity Vocabulary library

Downloads

4,955

Readme

@fedify/vocab: ActivityPub vocabulary for Fedify

JSR npm

This package provides a collection of type-safe objects that represent the Activity Vocabulary and vendor-specific extensions for the Fedify framework. It is the core vocabulary library that powers ActivityPub object handling in Fedify applications.

Features

  • Type-safe objects for Activity Vocabulary types (Create, Note, Person, etc.)
  • Vendor-specific extensions (Mastodon, Misskey, etc.)
  • JSON-LD serialization and deserialization
  • Immutable object design with clone() method for modifications
  • Support for looking up remote objects
  • Actor handle resolution via WebFinger

Installation

deno add jsr:@fedify/vocab # Deno
npm add @fedify/vocab # npm
pnpm add @fedify/vocab # pnpm
yarn add @fedify/vocab # Yarn
bun add @fedify/vocab # Bun

Usage

Instantiation

You can instantiate an object by calling the constructor with properties:

import { Create, Note } from "@fedify/vocab";

const create = new Create({
  id: new URL("https://example.com/activities/123"),
  actor: new URL("https://example.com/users/alice"),
  object: new Note({
    id: new URL("https://example.com/notes/456"),
    content: "Hello, world!",
  }),
});

JSON-LD serialization

Deserialize from JSON-LD:

import { Create } from "@fedify/vocab";

const create = await Create.fromJsonLd({
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "id": "https://example.com/activities/123",
  "actor": "https://example.com/users/alice",
  "object": {
    "type": "Note",
    "id": "https://example.com/notes/456",
    "content": "Hello, world!",
  }
});

Serialize to JSON-LD:

const jsonLd = await create.toJsonLd();

Immutability

All objects are immutable. Use clone() to create modified copies:

import { Note } from "@fedify/vocab";
import { LanguageString } from "@fedify/vocab-runtime";

const noteInEnglish = new Note({
  id: new URL("https://example.com/notes/123"),
  content: new LanguageString("Hello, world!", "en"),
});

const noteInChinese = noteInEnglish.clone({
  content: new LanguageString("你好,世界!", "zh"),
});

Looking up remote objects

import { lookupObject } from "@fedify/vocab";

const object = await lookupObject("https://example.com/users/alice");

Documentation

For comprehensive documentation, please refer to:

Related packages

  • @fedify/fedify: The main Fedify framework
  • @fedify/vocab-runtime: Runtime utilities for vocabulary objects
  • @fedify/vocab-tools: Code generation tools for Activity Vocabulary

License

MIT License