Fedify: an ActivityPub server framework's avatar

Fedify: an ActivityPub server framework

@[email protected] · 7 following · 371 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]

Though we have OpenTelemetry Semantic Conventions 1.28.0, it does not yet define attributes related to the fediverse. So is taking the initiative to define semantic attributes related to the ActivityPub protocol and its related protocols. If you have any ideas, please leave a comment!

https://gist.github.com/dahlia/7ad0f197a3a87072707996b2ee14a749

Semantic attributes for ActivityPub

The OpenTelemetry Semantic Conventions currently do not have a specification for ActivityPub.  However, Fedify provides a set of semantic attributes for ActivityPub.  The following table shows the semantic attributes for ActivityPub:

Attribute 	Type 	Description 	Examples
activitypub.activity.id 	string 	The IRI of the activity object. 	"https://example.com/activity/1"
activitypub.activity.type 	string[] 	The qualified IRI(s) of the activity type(s). 	["https://www.w3.org/ns/activitystreams#Create"]
activitypub.activity.to 	string[] 	The IRI(s) of the recipient collections/actors of the activity. 	["https://example.com/1/followers/2"]
activitypub.activity.cc 	string[] 	The IRI(s) of the carbon-copied recipient collections/actors of the activity. 	["https://www.w3.org/ns/activitystreams#Public"]
activitypub.activity.resend_count 	int 	The ordinal number of activity resending attempt (if and only if it's retried). 	3
activitypub.actor.id 	string 	The IRI of the actor object. 	"https://example.com/actor/1"
activitypub.actor.type 	string[] 	The qualified IRI(s) of the actor type(s). 	["https://www.w3.org/ns/activitystreams#Person"]
activitypub.object.id 	string 	The IRI of the object or the object enclosed by the activity. 	"https://example.com/object/1"
activitypub.object.type 	string[] 	The qualified IRI(s) of the object type(s). 	["https://www.w3.org/ns/activitystreams#Note"]
activitypub.object.in_reply_to 	string[] 	The IRI(s) of the orig
Semantic attributes for ActivityPub The OpenTelemetry Semantic Conventions currently do not have a specification for ActivityPub. However, Fedify provides a set of semantic attributes for ActivityPub. The following table shows the semantic attributes for ActivityPub: Attribute Type Description Examples activitypub.activity.id string The IRI of the activity object. "https://example.com/activity/1" activitypub.activity.type string[] The qualified IRI(s) of the activity type(s). ["https://www.w3.org/ns/activitystreams#Create"] activitypub.activity.to string[] The IRI(s) of the recipient collections/actors of the activity. ["https://example.com/1/followers/2"] activitypub.activity.cc string[] The IRI(s) of the carbon-copied recipient collections/actors of the activity. ["https://www.w3.org/ns/activitystreams#Public"] activitypub.activity.resend_count int The ordinal number of activity resending attempt (if and only if it's retried). 3 activitypub.actor.id string The IRI of the actor object. "https://example.com/actor/1" activitypub.actor.type string[] The qualified IRI(s) of the actor type(s). ["https://www.w3.org/ns/activitystreams#Person"] activitypub.object.id string The IRI of the object or the object enclosed by the activity. "https://example.com/object/1" activitypub.object.type string[] The qualified IRI(s) of the object type(s). ["https://www.w3.org/ns/activitystreams#Note"] activitypub.object.in_reply_to string[] The IRI(s) of the orig
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

Though we have OpenTelemetry Semantic Conventions 1.28.0, it does not yet define attributes related to the fediverse. So is taking the initiative to define semantic attributes related to the ActivityPub protocol and its related protocols. If you have any ideas, please leave a comment!

https://gist.github.com/dahlia/7ad0f197a3a87072707996b2ee14a749

Semantic attributes for ActivityPub

The OpenTelemetry Semantic Conventions currently do not have a specification for ActivityPub.  However, Fedify provides a set of semantic attributes for ActivityPub.  The following table shows the semantic attributes for ActivityPub:

Attribute 	Type 	Description 	Examples
activitypub.activity.id 	string 	The IRI of the activity object. 	"https://example.com/activity/1"
activitypub.activity.type 	string[] 	The qualified IRI(s) of the activity type(s). 	["https://www.w3.org/ns/activitystreams#Create"]
activitypub.activity.to 	string[] 	The IRI(s) of the recipient collections/actors of the activity. 	["https://example.com/1/followers/2"]
activitypub.activity.cc 	string[] 	The IRI(s) of the carbon-copied recipient collections/actors of the activity. 	["https://www.w3.org/ns/activitystreams#Public"]
activitypub.activity.resend_count 	int 	The ordinal number of activity resending attempt (if and only if it's retried). 	3
activitypub.actor.id 	string 	The IRI of the actor object. 	"https://example.com/actor/1"
activitypub.actor.type 	string[] 	The qualified IRI(s) of the actor type(s). 	["https://www.w3.org/ns/activitystreams#Person"]
activitypub.object.id 	string 	The IRI of the object or the object enclosed by the activity. 	"https://example.com/object/1"
activitypub.object.type 	string[] 	The qualified IRI(s) of the object type(s). 	["https://www.w3.org/ns/activitystreams#Note"]
activitypub.object.in_reply_to 	string[] 	The IRI(s) of the orig
Semantic attributes for ActivityPub The OpenTelemetry Semantic Conventions currently do not have a specification for ActivityPub. However, Fedify provides a set of semantic attributes for ActivityPub. The following table shows the semantic attributes for ActivityPub: Attribute Type Description Examples activitypub.activity.id string The IRI of the activity object. "https://example.com/activity/1" activitypub.activity.type string[] The qualified IRI(s) of the activity type(s). ["https://www.w3.org/ns/activitystreams#Create"] activitypub.activity.to string[] The IRI(s) of the recipient collections/actors of the activity. ["https://example.com/1/followers/2"] activitypub.activity.cc string[] The IRI(s) of the carbon-copied recipient collections/actors of the activity. ["https://www.w3.org/ns/activitystreams#Public"] activitypub.activity.resend_count int The ordinal number of activity resending attempt (if and only if it's retried). 3 activitypub.actor.id string The IRI of the actor object. "https://example.com/actor/1" activitypub.actor.type string[] The qualified IRI(s) of the actor type(s). ["https://www.w3.org/ns/activitystreams#Person"] activitypub.object.id string The IRI of the object or the object enclosed by the activity. "https://example.com/object/1" activitypub.object.type string[] The qualified IRI(s) of the object type(s). ["https://www.w3.org/ns/activitystreams#Note"] activitypub.object.in_reply_to string[] The IRI(s) of the orig
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

If you are using on , the minimum supported Deno version will be raised to 2.0.0 starting with Fedify 1.3.0.

モナコ広告 :fedibird1: @技術・雑談's avatar
モナコ広告 :fedibird1: @技術・雑談

@[email protected]

本日の 勉強会の発表資料を置きました!

FedifyでActivityPubサーバを作ってみた(第5回FediLUG勉強会)
docswell.com/s/monaco_koukoku/

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

@[email protected]

Thanks to @robin_maki, integration support has been added to ! This feature will be included in Fedify 1.3.0.

https://unstable.fedify.dev/manual/integration#sveltekit

SvelteKit

This API is available since Fedify 1.3.0.

SvelteKit is a framework for building web applications with Svelte. Fedify has the @fedify/fedify/x/sveltekit module that provides a hook handler to integrate Fedify with SvelteKit. Put the following code in your hooks.server.ts file:

import { createFederation } from "@fedify/fedify";
import { fedifyHook } from "@fedify/fedify/x/sveltekit";

const federation = createFederation<string>({
  // Omitted for brevity; see the related section for details.
});

// This is the entry point to the Fedify hook from the SvelteKit framework:
export const handle = fedifyHook(federation, (req) => "context data");
SvelteKit This API is available since Fedify 1.3.0. SvelteKit is a framework for building web applications with Svelte. Fedify has the @fedify/fedify/x/sveltekit module that provides a hook handler to integrate Fedify with SvelteKit. Put the following code in your hooks.server.ts file: import { createFederation } from "@fedify/fedify"; import { fedifyHook } from "@fedify/fedify/x/sveltekit"; const federation = createFederation<string>({ // Omitted for brevity; see the related section for details. }); // This is the entry point to the Fedify hook from the SvelteKit framework: export const handle = fedifyHook(federation, (req) => "context data");
robin's avatar
robin

@[email protected]

오늘에한일
fedify에 SvelteKit 지원을 추가했다
스벨트에 영광은 영원할것이다

洪 民憙(ホン・ミンヒ)'s avatar
洪 民憙(ホン・ミンヒ)

@[email protected]

Fedify CLIの隠れた便利機能をご紹介!

• 賢いオブジェクト検索
• インタラクティブなインボックステスト
• 見やすいNodeInfo表示
• 柔軟なローカル開発
• シェル統合
• カスタムUser-Agentサポート(Fedify 1.3.0の新機能)

ActivityPubの実装をデバッグする際に、これらの機能が大変役立ちます!

詳細は記事をチェックしてみてください。

zenn.dev/hongminhee/articles/9

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

@[email protected]

Did you know the CLI can help debug federation?

Learn about hidden features like:

• Smart object lookup with content negotiation
• Interactive inbox testing with a web UI
• NodeInfo visualization
• Local development tunneling
• And more!

dev.to/hongminhee/hidden-gems-

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

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

내일 행사를 위해 급하게 처음으로 기여하는 분들을 위한 이슈를 만들고 있습니다!

Fedify 저장소의 이슈 목록.

• Display icon/image on fedify lookup [enhancement, good first issue]
• fedify node breaks favicon on terminal emulators without truecolor [bug, good first issue]
• Use Fedify to the latest version in example projects [good first issue]
• Specify engines property to package.json [good first issue]
• More examples [documentation, good first issue, help wanted]
Fedify 저장소의 이슈 목록. • Display icon/image on fedify lookup [enhancement, good first issue] • fedify node breaks favicon on terminal emulators without truecolor [bug, good first issue] • Use Fedify to the latest version in example projects [good first issue] • Specify engines property to package.json [good first issue] • More examples [documentation, good first issue, help wanted]
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

내일 서울 서초구 오픈업 플레이그라운드에서 이뤄지는 Open Contribution Jam 2024에 메인테이너(@hongminhee)가 참여합니다. Fedify에 기여해보고 싶은 분들은 와주시면 메인테이너가 성심껏 도와드리겠습니다! 자세한 행사 정보는 아래 링크를 참고하시면 됩니다.

https://festa.io/events/6342

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

@[email protected]

내일 서울 서초구 오픈업 플레이그라운드에서 이뤄지는 Open Contribution Jam 2024에 메인테이너(@hongminhee)가 참여합니다. Fedify에 기여해보고 싶은 분들은 와주시면 메인테이너가 성심껏 도와드리겠습니다! 자세한 행사 정보는 아래 링크를 참고하시면 됩니다.

https://festa.io/events/6342

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

@[email protected]

We are going to add instrumentation support for to . What kind of spans or events would you like to be instrumented?

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

@[email protected]

Have you heard of Val Town? Val Town is a kind of code pastebin + serverless function.

Actually, works just fine with Val Town. Here's a piece of ActivityPub software, implemented in about 170 lines of code, running on Val Town. Of course, it's built with Fedify!

Give it a follow @demo, and it will follow you back.

Curious to see how it was implemented? Check out the source code!

https://www.val.town/v/minhee/FedifyOnValTown

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

@[email protected]

Starting with 1.3.0, you'll be able to use different message queues for incoming and outgoing activities!

https://unstable.fedify.dev/manual/mq#using-different-message-queues-for-different-tasks

Using different message queues for different tasks

This API is available since Fedify 1.3.0.

In some cases, you may want to use different message queues for different tasks, such as using a faster-but-less-persistent queue for outgoing activities and a slower-but-more-persistent queue for incoming activities. To achieve this, you can pass FederationQueueOptions to the CreateFederationOptions.queue option.

For example, the following code shows how to use a PostgresMessageQueue for the inbox and a RedisMessageQueue for the outbox:

const federation = createFederation<void>({
  queue: {
    inbox: new PostgresMessageQueue(
      postgres("postgresql://user:pass@localhost/db")
    ),
    outbox: new RedisMessageQueue(() => new Redis()),
  },
  // ... other options
});

Or, you can provide a message queue for only the inbox or outbox by omitting the other:

const federation = createFederation<void>({
  queue: {
    inbox: new PostgresMessageQueue(
      postgres("postgresql://user:pass@localhost/db")
    ),
    // outbox is not provided; outgoing activities will not be queued
  },
  // ... other options
});
Using different message queues for different tasks This API is available since Fedify 1.3.0. In some cases, you may want to use different message queues for different tasks, such as using a faster-but-less-persistent queue for outgoing activities and a slower-but-more-persistent queue for incoming activities. To achieve this, you can pass FederationQueueOptions to the CreateFederationOptions.queue option. For example, the following code shows how to use a PostgresMessageQueue for the inbox and a RedisMessageQueue for the outbox: const federation = createFederation<void>({ queue: { inbox: new PostgresMessageQueue( postgres("postgresql://user:pass@localhost/db") ), outbox: new RedisMessageQueue(() => new Redis()), }, // ... other options }); Or, you can provide a message queue for only the inbox or outbox by omitting the other: const federation = createFederation<void>({ queue: { inbox: new PostgresMessageQueue( postgres("postgresql://user:pass@localhost/db") ), // outbox is not provided; outgoing activities will not be queued }, // ... other options });
taichan's avatar
taichan

@[email protected]

fedify使ったAPubリレーの実装組みたいと思ってたの急に思い出した

^Kur0den\d{4}$ :irai_houki_tyuu:'s avatar
^Kur0den\d{4}$ :irai_houki_tyuu:

@[email protected]

暇なときに読もうと思ってもってきたfedify本を読んでる
物理本、やっぱり良き

モナコ広告 :fedibird1: @技術・雑談's avatar
モナコ広告 :fedibird1: @技術・雑談

@[email protected]

Fedify本、ついに完走!
他鯖のフォロイーの投稿を読めるようになったぞい :blobcatalt:

monaco koukoku's microblog
フォローボタン・投稿ボタン・マイクロブログのタイムラインがある。
monaco koukoku's microblog フォローボタン・投稿ボタン・マイクロブログのタイムラインがある。
もちもちずきん :teto_zuho: 🍆's avatar
もちもちずきん :teto_zuho: 🍆

@[email protected]

帰ったらFedifyの本読むんや

段風桜 Dampuzakura(わかいい)'s avatar
段風桜 Dampuzakura(わかいい)

@[email protected]

じゃあもうそれこそFedifyでPixelfedみたいなやつ作るか

もちもちずきん :teto_zuho: 🍆's avatar
もちもちずきん :teto_zuho: 🍆

@[email protected]

Fedify使ってGoogle+そっくりさん作りたいかもしれない

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

@[email protected]

Star History of , , and :

star-history.com/#dahlia/fedif

Star History of Fedify, Hollo, and LogTape.
Star History of Fedify, Hollo, and LogTape.
Renaud Chaput's avatar
Renaud Chaput

@[email protected] · Reply to Renaud Chaput's post

@Montreal_Weather But if you plan to have this many bots, I would encourage you to not rely on Mastodon for those bots, but implement your own (very simple) ActivityPub software, it will be much easier for you.
For example see shkspr.mobi/blog/2024/02/a-tin, or fedify.dev for NodeJS

モナコ広告 :fedibird1: @技術・雑談's avatar
モナコ広告 :fedibird1: @技術・雑談

@[email protected]

ようやくFedifyを触り始めた。WSL+DockerでNode.jsの環境をサクッと作って、コードはVSCodeで書けるようにした。後から環境設定が取っ散らからなくて良さそう。

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

@[email protected]

Flyers for and to be used at an open source event in Japan!

https://mstdn.y-zu.org/@Yohei_Zuho/113440544215822210

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

@[email protected] · Reply to Sebastian Lasse's post

@sl007 Okay, we're adding a mention for it!

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

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

for @loops!

The terminal screen of the output of the `fedify node loops.video` command:

loops.video
===========
Software:
  loops v0.1.0
  https://joinloops.org/
  https://github.com/px-loops/loopd
Protocols:
  activitypub
Users:
  8,726 (total)
  8,726 (active half year)
  8,726 (active month)
Local posts:
  1,195
Local comments:
  819
Open registrations:
  Yes
The terminal screen of the output of the `fedify node loops.video` command: loops.video =========== Software: loops v0.1.0 https://joinloops.org/ https://github.com/px-loops/loopd Protocols: activitypub Users: 8,726 (total) 8,726 (active half year) 8,726 (active month) Local posts: 1,195 Local comments: 819 Open registrations: Yes
洪 民憙 (Hong Minhee)'s avatar
洪 民憙 (Hong Minhee)

@[email protected]

for .social! :pixelfed:

The terminal screen of the output of the `fedify node pixelfed.social` command:

pixelfed.social
===============
Software:
  pixelfed v0.12.3
Protocols:
  activitypub
Users:
  124,264 (total)
  22,376 (active half year)
  7,212 (active month)
Local posts:
  35,773,844
Local comments:
  0
Open registrations:
  No
The terminal screen of the output of the `fedify node pixelfed.social` command: pixelfed.social =============== Software: pixelfed v0.12.3 Protocols: activitypub Users: 124,264 (total) 22,376 (active half year) 7,212 (active month) Local posts: 35,773,844 Local comments: 0 Open registrations: No
💜 Wysteria 🪷🪷🪷's avatar
💜 Wysteria 🪷🪷🪷

@[email protected]

neofetch, but for ActivityPub servers #FedifyNode

Screenshot of the terminal output of the fedify node command, which resembles Neofetch. Output:

baraag.net
==========
Software:
  mastodon v4.3.1
Protocols:
  activitypub
Users:
  294,891 (total)
  66,290 (active half year)
  44,517 (active month)
Local posts: 
  14,734,899
Local comments:
  0
Open registrations:
  No
Screenshot of the terminal output of the fedify node command, which resembles Neofetch. Output: baraag.net ========== Software: mastodon v4.3.1 Protocols: activitypub Users: 294,891 (total) 66,290 (active half year) 44,517 (active month) Local posts: 14,734,899 Local comments: 0 Open registrations: No
Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected] · Reply to Sebastian Lasse's post

@sl007 That's good idea! We will add a list of projects that use Fedify soon!

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

@[email protected]

Starting with 1.3.0, you can customize the User-Agent header for every HTTP request that Fedify makes.

https://unstable.fedify.dev/manual/federation#useragent

userAgent

This API is available since Fedify 1.3.0.

The options for making User-Agent header in the HTTP requests that Fedify makes. By default, it contains the name and version of the Fedify library, and the name and version of the JavaScript runtime, e.g.:

Fedify/1.3.0 (Deno/2.0.4)
Fedify/1.3.0 (Node.js/v22.10.0)
Fedify/1.3.0 (Bun/1.1.33)

You can customize the User-Agent header by providing options like software and url. For example, if you provide the following options:

{
  software: "MyApp/1.0.0",
  url: "https://myinstance.com/"
}

The User-Agent header will be like:

MyApp/1.0.0 (Fedify/1.3.0; Deno/2.0.4; +https://myinstance.com/)

Or, you can rather provide a custom User-Agent string directly instead of an object for options.
userAgent This API is available since Fedify 1.3.0. The options for making User-Agent header in the HTTP requests that Fedify makes. By default, it contains the name and version of the Fedify library, and the name and version of the JavaScript runtime, e.g.: Fedify/1.3.0 (Deno/2.0.4) Fedify/1.3.0 (Node.js/v22.10.0) Fedify/1.3.0 (Bun/1.1.33) You can customize the User-Agent header by providing options like software and url. For example, if you provide the following options: { software: "MyApp/1.0.0", url: "https://myinstance.com/" } The User-Agent header will be like: MyApp/1.0.0 (Fedify/1.3.0; Deno/2.0.4; +https://myinstance.com/) Or, you can rather provide a custom User-Agent string directly instead of an object for options.
Older →