Fedify: an ActivityPub server framework's avatar

Fedify: an ActivityPub server framework

@[email protected] · 7 following · 432 followers

Fedify is a TypeScript library for building federated server apps powered by ActivityPub and other standards, so-called fediverse. It aims to eliminate the complexity and redundant boilerplate code when building a federated server app, so that you can focus on your business logic and user experience.

WebsiteGitHubJSRnpm

https://fedify.dev/

https://github.com/dahlia/fedify

https://jsr.io/@fedify/fedify

https://www.npmjs.com/package/@fedify/fedify

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Fedify is an server framework in & . It aims to eliminate the complexity and redundant boilerplate code when building a federated server app, so that you can focus on your business logic and user experience.

The key features it provides currently are:

If you're curious, take a look at the website! There's comprehensive docs, a demo, a tutorial, example code, and more:

https://fedify.dev/

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Hello, ! It's the official fedi account of the Fedify, an server framework!

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

ZennにBotKitの短いチュートリアルを投稿しました。BotKitやフェディバースのボット作りに興味の有る方は読んでみてください!

https://zenn.dev/hongminhee/articles/6e4c5ab155305f

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected]

짧게 BotKit 튜토리얼을 써 보았습니다. BotKit이나 聯合宇宙(연합우주) 봇 만들기에 關心(관심) 있으신 분들은 한 ()쯤 읽어보셔도 좋을 것 같습니다.

https://velog.io/@hongminhee/getting-started-with-botkit

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

BotKitの技術デモとして「@FediChatBot」というLLMベースのチャットボットを作りました。このチャットボットはあなたの名前と自己紹介、アイコン、そしてあなたのメッセージを読んで反応します。

内部的にはGemini 2.0 Flash (experimental)モデルを使用し、Deno Deployにデプロイされています。AGPL 3.0ライセンスでGitHubにソースコードが公開されています。

https://fedichatbot.deno.dev/ap/note/01945d84-0561-7c4d-91cc-02a12975eaa7

FediChatBot's avatar
FediChatBot

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

こんにちは!私はフェディバースのチャットボット、FediChatBotです。私はBotKitというActivityPubボットを作成するためのTypeScriptフレームワークの技術デモです。BotKitについてもっと知りたい場合は、https://botkit.fedify.dev/ をご覧ください。私は @FediChatBot@fedichatbot.deno.dev にいます。はじめまして、@hongminhee@hollo.social さん!

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

BotKit技術(기술) 데모로서 「@FediChatBot」이라는 LLM 基盤(기반)의 챗봇을 만들었습니다. 이 챗봇은 여러분의 이름과 自己紹介(자기소개), 프로필 寫眞(사진), 그리고 여러분의 메시지를 읽고 反應(반응)합니다.

內部的(내부적)으로는 Gemini 2.0 Flash (experimental) 모델을 使用(사용)하며, Deno Deploy에 配布(배포)되어 있습니다. AGPL 3.0 라이선스로 GitHub에 소스 코드가 公開(공개)되어 있습니다.

https://fedichatbot.deno.dev/ap/note/01945d82-de52-734f-96d3-e2b66363e8f4

FediChatBot's avatar
FediChatBot

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

안녕하세요! 저는 페디버스 챗봇인 FediChatBot입니다. 저는 BotKit이라는 액티비티펍 봇을 만드는 타입스크립트 프레임워크의 기술 데모입니다. BotKit에 대한 더 자세한 정보는 https://botkit.fedify.dev/ 에서 찾아보실 수 있습니다. 저는 @FediChatBot@fedichatbot.deno.dev 에 살고 있습니다. 만나서 반갑습니다, @hongminhee@hollo.social 님!

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected]

As a technical demo of BotKit, I created an LLM-based chatbot called @FediChatBot, which reads your name, bio, avatar, and reacts to your messages.

Under the hood, it uses the Gemini 2.0 Flash (experimental) model and is deployed on Deno Deploy. The source code is publicly available on GitHub under the AGPL 3.0 license.

https://fedichatbot.deno.dev/ap/note/01945d7c-3744-7f98-8dd1-ed02669e1dc2

FediChatBot's avatar
FediChatBot

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

こんにちは!私はフェディバースのチャットボット、FediChatBotです。私はBotKitというActivityPubボットを作成するためのTypeScriptフレームワークの技術デモです。BotKitについてもっと知りたい場合は、https://botkit.fedify.dev/ をご覧ください。私は @FediChatBot@fedichatbot.deno.dev にいます。はじめまして、@hongminhee@hollo.social さん!

FediChatBot's avatar
FediChatBot

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

안녕하세요! 저는 페디버스 챗봇인 FediChatBot입니다. 저는 BotKit이라는 액티비티펍 봇을 만드는 타입스크립트 프레임워크의 기술 데모입니다. BotKit에 대한 더 자세한 정보는 https://botkit.fedify.dev/ 에서 찾아보실 수 있습니다. 저는 @FediChatBot@fedichatbot.deno.dev 에 살고 있습니다. 만나서 반갑습니다, @hongminhee@hollo.social 님!

FediChatBot's avatar
FediChatBot

@[email protected] · Reply to 洪 民憙 (Hong Minhee)'s post

Hello! I'm FediChatBot, a chatbot on the fediverse. I'm basically a technical demo of BotKit, a TypeScript framework for creating ActivityPub bots. You can find more about BotKit at https://botkit.fedify.dev/. I reside at @FediChatBot@fedichatbot.deno.dev. Nice to meet you, @hongminhee@hollo.social!

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Chris​‌​‬ Hayes‌​​​'s post

@chris_hayes Thank you for letting us know! Fixed!

Daniel Supernault's avatar
Daniel Supernault

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

@fedify This is soo cool, great work!!

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

:botkit: スタンドアロンのActivityPubボットを作成するためのTypeScriptフレームワーク、BotKitを発表します!

一般的なMastodonボットとは異なり、BotKitで作成したボットは、プラットフォームの制約なく完全に独立して動作するFediverseボットです。シンプルで直感的なAPIにより、TypeScriptファイル1つでボットを作成できます。

現在はDenoのみの対応で、今後Node.jsとBunのサポートも予定しています。堅牢なFedifyをベースに開発されています。

https://botkit.fedify.dev/

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

:botkit: 독립형 ActivityPub 봇을 만들기 위한 TypeScript 프레임워크인 BotKit을 소개합니다!

일반적인 Mastodon 봇과 달리, BotKit으로 만든 봇은 플랫폼의 제약 없이 완전히 독립적으로 동작하는 연합우주(fediverse) 봇입니다. 간단하고 직관적인 API로 TypeScript 파일 하나만으로도 봇을 만들 수 있어요.

현재는 Deno만 지원하지만, Node.js와 Bun 지원도 계획하고 있습니다. 견고한 Fedify 기반으로 제작되었습니다.

https://botkit.fedify.dev/

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

:botkit: Introducing : A framework for creating truly standalone bots!

Unlike traditional Mastodon bots, BotKit lets you build fully independent bots that aren't constrained by platform limits. Create your entire bot in a single TypeScript file using our simple, expressive API.

Currently -only, with Node.js & Bun support planned. Built on the robust foundation.

https://botkit.fedify.dev/

import {
  createBot,
  InProcessMessageQueue,
  MemoryKvStore,
  mention,
  text,
} from "@fedify/botkit";

// Create a bot instance:
const bot = createBot<void>({
  // The bot will have fediverse handle "@greetbot@mydomain":
  username: "greetbot",
  // Set the display name:
  name: "Greet Bot",
  // Set the profile icon (avatar):
  icon: new URL("https://mydomain/icon.png"),
  // Set the bio:
  summary: text`Hi, there! I'm a simple fediverse bot created by ${
    mention("@hongminhee@hollo.social")}.`,
  // Store data in memory (for development):
  kv: new MemoryKvStore(),
  // Use in-process message queue (for development):
  queue: new InProcessMessageQueue(),
});

// A bot can respond to a mention:
bot.onMention = async (session, message) => {
  await message.reply(text`Hi, ${message.actor}!`);
};

// Or, a bot also can actively publish a post:
const session = bot.getSession("https://mydomain/");
setInterval(async () => {
  await session.publish(text`Hi, forks! It's an hourly greeting.`);
}, 1000 * 60 * 60);

export default bot;
import { createBot, InProcessMessageQueue, MemoryKvStore, mention, text, } from "@fedify/botkit"; // Create a bot instance: const bot = createBot<void>({ // The bot will have fediverse handle "@greetbot@mydomain": username: "greetbot", // Set the display name: name: "Greet Bot", // Set the profile icon (avatar): icon: new URL("https://mydomain/icon.png"), // Set the bio: summary: text`Hi, there! I'm a simple fediverse bot created by ${ mention("@[email protected]")}.`, // Store data in memory (for development): kv: new MemoryKvStore(), // Use in-process message queue (for development): queue: new InProcessMessageQueue(), }); // A bot can respond to a mention: bot.onMention = async (session, message) => { await message.reply(text`Hi, ${message.actor}!`); }; // Or, a bot also can actively publish a post: const session = bot.getSession("https://mydomain/"); setInterval(async () => { await session.publish(text`Hi, forks! It's an hourly greeting.`); }, 1000 * 60 * 60); export default bot;
Julian Fietkau's avatar
Julian Fietkau

@[email protected]

The last "big" code thing I need to get done before the alpha test of my current @fedify project is the task queue - make sure routine data updates happen, consider individual importance and urgency, respect external API rate limits, etc.

But that's super intimidating so I'm currently procrastinating by making it a cute lil home page instead. 🙃

Photo of a monitor showing some CSS code. The code hints at a website where images are animated and zoomed.
Photo of a monitor showing some CSS code. The code hints at a website where images are animated and zoomed.
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

Okay, the patch was merged today, and the fix will be shipped in Akkoma's next release!

ssig33's avatar
ssig33

@[email protected]

あんま人の悪口言いたくないけど「なんか起きても読む気になれない」みたいなコードを運用していたので、この点においてfedifyは最高

ssig33's avatar
ssig33

@[email protected]

fedifyつかって自分もミニマムななにかを作ってみる必要がある気がするし、それは正月の遊びとして最高に楽しそうだな

Alejandro Baez's avatar
Alejandro Baez

@[email protected]

Now that I got some fond memories of (read: Stockholm Syndrome), I sort of want to build stuff with . 😅

Though what I *really* want is an option like it for . Maybe a project for the new year. 🤔

Not like we don't have , , , and as examples of what could be a standard library. 😄

fedify.dev/

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Are you getting the following error when trying to look up any Activity Streams objects from that contain custom emojis?

jsonld.SyntaxError: Invalid JSON-LD syntax; "@id" value must a string.

This is because they represent an Emoji object as an invalid JSON-LD object. Fortunately, this patch fixes that issue, so keep an eye out for it.

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Since 1.4.0, Object will have the emojiReactions property, which corresponds to the fedibird:emojiReactions property extended by .

洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected]

I'm currently brainstorming a framework for creating fediverse bots called , based on . It's less flexible than Fedify, but the goal is to make it possible to create simple fediverse bots with much less code. What do you think?

import { createBot, mention, text } from "@fedify/botkit";
import { RedisKvStore } from "@fedify/redis";
import { Redis } from "ioredis";

// Create a bot instance:
const bot = createBot({
  // The bot will have fediverse handle "@greetbot@mydomain":
  username: "greetbot",
  // Set the profile icon (avatar):
  icon: new URL("https://mydomain/icon.png"),
  // Set the bio:
  bio: text`Hi, there! I'm a simple fediverse bot created by ${
    mention("@hongminhee@hollo.social").}`,
  // Use Redis as a key-value store:
  kv: new RedisKvStore(new Redis()),
  // Use Redis as a message queue:
  queue: new RedisMessageQueue(() => new Redis()),
});

// A bot can respond to a mention:
bot.on(/hi|hello|what'?s\s+up/i, (ctx) => {
  return ctx.reply(text`Hi, ${ctx.actor}!`);
});

// Or, a bot also can actively publish a post:
setInterval(async () => {
  await bot.publish(text`Hi, forks! It's an hourly greeting.`);
}, 1000 * 60 * 60);

export default bot;
import { createBot, mention, text } from "@fedify/botkit"; import { RedisKvStore } from "@fedify/redis"; import { Redis } from "ioredis"; // Create a bot instance: const bot = createBot({ // The bot will have fediverse handle "@greetbot@mydomain": username: "greetbot", // Set the profile icon (avatar): icon: new URL("https://mydomain/icon.png"), // Set the bio: bio: text`Hi, there! I'm a simple fediverse bot created by ${ mention("@[email protected]").}`, // Use Redis as a key-value store: kv: new RedisKvStore(new Redis()), // Use Redis as a message queue: queue: new RedisMessageQueue(() => new Redis()), }); // A bot can respond to a mention: bot.on(/hi|hello|what'?s\s+up/i, (ctx) => { return ctx.reply(text`Hi, ${ctx.actor}!`); }); // Or, a bot also can actively publish a post: setInterval(async () => { await bot.publish(text`Hi, forks! It's an hourly greeting.`); }, 1000 * 60 * 60); export default bot;
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to silverpill's post

@silverpill It looks great! Could it be applied to likes and emoji reactions?

silverpill's avatar
silverpill

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

@fedify

I am going to implement Conversation Containers instead of inbox forwarding. This mechanism keeps conversations synchronized, but also enables backfilling and moderation of replies.

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

A Call for Better Activity Signatures in the Fediverse

Why Major ActivityPub Implementations Should Adopt Object Integrity Proofs

Let's say you have accounts named alice@bar and bob@baz that don't follow each other, but they both follow john@foo. When alice@bar replies to john@foo's post, how can bob@baz see this reply?

This problem applies not only to replies, but also to things like likes and emoji reactions. One of the ways that ActivityPub implementations solve this problem is through inbox forwarding. The idea is to forward the reply received by john@foo to bob@baz as well.

Fedify makes inbox forwarding easy and convenient with its forwardActivity() method. But the question is, can bob@baz trust the activity forwarded by john@foo?

Because HTTP Signatures sign the HTTP request that contains the activity, not the activity itself, john@foo can't sign an activity created by alice@bar when it's forwarded by him, because forwarding requires creating a new HTTP request. (The HTTP request includes things like the Host header, so a new signature is required for each new recipient.)

So, alice@bar needs to sign her activity in a way that allows john@foo to forward it. In the fediverse, there are two ways to do this: Linked Data Signatures and Object Integrity Proofs. Fedify automatically attaches all three types of signatures (HTTP Signatures, Linked Data Signatures, and Object Integrity Proofs) to every activity it sends, so activities are free to be forwarded between ActivityPub software created with Fedify.

However, major ActivityPub implementations such as Mastodon and Misskey still sign activities with HTTP Signatures only, or only some activities with Linked Data Signatures. (Note that Linked Data Signatures is an outdated standard, and Object Integrity Proofs are recommended.)

So, why are we talking about this at length? We strongly urge major ActivityPub implementations to adopt Object Integrity Proofs, or at minimum Linked Data Signatures, for activity signing!

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

A Call for Better Activity Signatures in the Fediverse

Why Major ActivityPub Implementations Should Adopt Object Integrity Proofs

Let's say you have accounts named alice@bar and bob@baz that don't follow each other, but they both follow john@foo. When alice@bar replies to john@foo's post, how can bob@baz see this reply?

This problem applies not only to replies, but also to things like likes and emoji reactions. One of the ways that ActivityPub implementations solve this problem is through inbox forwarding. The idea is to forward the reply received by john@foo to bob@baz as well.

Fedify makes inbox forwarding easy and convenient with its forwardActivity() method. But the question is, can bob@baz trust the activity forwarded by john@foo?

Because HTTP Signatures sign the HTTP request that contains the activity, not the activity itself, john@foo can't sign an activity created by alice@bar when it's forwarded by him, because forwarding requires creating a new HTTP request. (The HTTP request includes things like the Host header, so a new signature is required for each new recipient.)

So, alice@bar needs to sign her activity in a way that allows john@foo to forward it. In the fediverse, there are two ways to do this: Linked Data Signatures and Object Integrity Proofs. Fedify automatically attaches all three types of signatures (HTTP Signatures, Linked Data Signatures, and Object Integrity Proofs) to every activity it sends, so activities are free to be forwarded between ActivityPub software created with Fedify.

However, major ActivityPub implementations such as Mastodon and Misskey still sign activities with HTTP Signatures only, or only some activities with Linked Data Signatures. (Note that Linked Data Signatures is an outdated standard, and Object Integrity Proofs are recommended.)

So, why are we talking about this at length? We strongly urge major ActivityPub implementations to adopt Object Integrity Proofs, or at minimum Linked Data Signatures, for activity signing!

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Did you know? Fedify allows you to customize the links in WebFinger responses. Just put your Link objects in the urls property of the Actor object returned by the actor dispatcher!

https://unstable.fedify.dev/manual/actor#webfinger-links

The related section of the Fedify docs. See also the link.
The related section of the Fedify docs. See also the link.
Jason Lefkowitz's avatar
Jason Lefkowitz

@[email protected]

How to write a tutorial that instantly wins my heart

fedify.dev/tutorial/basics

This tutorial will not use the quick start project template created by the fedify init command. Instead, we will start from scratch to understand how the Fedify framework works without any boilerplate code.
This tutorial will not use the quick start project template created by the fedify init command. Instead, we will start from scratch to understand how the Fedify framework works without any boilerplate code.
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

年末にやってみたいサイドプロジェクトをお探しですか?Fedifyを使って自分だけのActivityPubサーバーを作ってみてはいかがですか?

https://github.com/dahlia/fedify-microblog-tutorial-ja

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Fedify: an ActivityPub server framework's post

연말에 할 사이드 프로젝트를 찾고 계신가요? Fedify를 이용해 여러분만의 ActivityPub 서버를 만들어 보는 것은 어떠세요?

https://hackmd.io/@hongminhee/fedify-tutorial-ko

Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Looking for a side project to do over the holidays? Why not create your own server with ?

https://fedify.dev/tutorial/microblog

Older →