Minimal implementation of ActivityPub with Cloudflare Workers and D1.
- Having only one actor
- The actor is discovered via webfinger (so you can find the account from other instances)
- Notifying followers of new posts (so new posts show up in their timeline)
- Web interface to post messages
- Node.js
- Cloudflare Account
yarn install
cp wrangler.sample.toml wrangler.toml
Fill the values:
preferredUsername
- Your account name. eg.yusukebe
name
- Your long name. eg.Yusuke Wada
BASIC_USERNAME
- Basic auth username for login to Web UIBASIC_PASSWORD
- Basic auth password
Pick up the value of PRIVATE_KEY
from the files generated by ssh-keygen
:
ssh-keygen -b 4096 -m PKCS8 -t rsa -N '' -f id_rsa
You can also use the value as "Secret variables" in Cloudflare Workers.
wrangler d1 create minidon
database_id
will be shown on your console. Copy it and paste into the value of database_id
and preview_database_id
in wrangler.toml.
Create tables:
wrangler d1 execute minidon --file minidon.sql
yarn dev
yarn deploy
@{name}@{minion.username.workers.dev}
will be your account id.
Paste it on such a Mastodon URL input, the account will be shown.
To post the message, access https://minion.username.workers.dev/ui
.
Yusuke Wada
MIT
And using a lot of code in Matchbox and inspired by Express ActivityPub Server.
Matchbox https://gitlab.com/acefed/matchbox Copyright (c) 2022 Acefed MIT License
Express ActivityPub Server https://github.com/dariusk/express-activitypub Copyright (c) 2018 Darius Kazemi. Licensed under the MIT license.