Skip to content

fedify-dev/threadiverse

Repository files navigation

Federated threadiverse example using Fedify and Next.js

Warning

This program is for educational purposes only. Do not use it for any other purpose; it has not been tested for security or scale.

This is a small threadiverse-style community platform written against Fedify (the ActivityPub server framework) and Next.js (the web framework). It pairs with the Building a threadiverse community platform tutorial on fedify.dev—the commits in this repository correspond one-to-one with the tutorial's sections so you can git checkout any commit and see the state of the project at that step.

Features:

  • Users can sign up and log in with a username + password.
  • Local users are federated as Person actors with per-user key pairs.
  • Local users can create communities, federated as Group actors with per-community key pairs, an inbox/outbox, and a followers collection.
  • Users can follow and unfollow any threadiverse-compatible community (local or remote) using Follow/Undo(Follow)/Accept(Follow).
  • Users can post text threads (Create(Page)) and replies (Create(Note)). Communities re-distribute everything they receive to their followers as Announce.
  • Users can up-vote (Like) and down-vote (Dislike) threads and replies; the community re-announces those too.
  • The home page is a subscribed feed of threads from every community the viewer follows.

As with any small educational example, many features of real threadiverse servers (Lemmy, Mbin, NodeBB) are left out intentionally:

  • No thread or reply editing or deletion (Update(Page)/Delete(Page)/Update(Note)/Delete(Note)/Tombstone).
  • No link threads, just text threads.
  • No moderation (mod roles, removals, bans, reports).
  • No ranking algorithms (hot/active/scaled), just reverse chronological.
  • No private communities, no media uploads, no DMs.
  • No Lemmy-specific extensions (attributedTo, moderators, featured, postingRestrictedToMods). Lemmy can dereference the community actor and follow it, but it won't treat it as a full Lemmy community.

Dependencies

This project is written in TypeScript and runs on Node.js. You need Node.js 22.0.0 or later. Besides Fedify and Next.js, the runtime dependencies are:

See package.json for the full list.

How to run

Install dependencies:

npm install

Create the SQLite database:

npm run db:push

Start the Next.js development server:

npm run dev

Visit http://localhost:3000/ in your browser.

To federate with the rest of the fediverse, expose the server to the public internet. The quickest way is a tunnel:

npx @fedify/cli tunnel 3000

See the tunneling-services section of Fedify's manual for alternatives.

License

This program is licensed under the MIT License. See the LICENSE file for details.