| .gitignore | Initial commit | |
| LICENSE | Initial commit | |
| models.py | extract database models into separate file | |
| poetry.lock | update apkit to version 0.3.3 | |
| pyproject.toml | update apkit to version 0.3.3 | |
| README.md | Initial commit | |
| server.py | extract database models into separate file | |
fediverse-server
A persistent ActivityPub server that uses the apkit library.
The server has two sides:
- the one facing the Fediverse that speaks ActivityPub
- an internal API to send status messages and retrieve information
Connection to the internet
You need a TLS endpoint to make the server visible on the internet. I use the Caddy webserver on a VPS for that. Let's assume the server is available at https://fedi.example.com
Set an environment variable with that domain name:
export APKIT_DOMAIN=fedi.example.com
Local testing
For testing purpouses you can also use ngrok expose it on the internet:
ngrok http 8000
ngrok will show you an address like https://846e26f1e1ee.ngrok-free.app that can be used to access your server from the internet.
Set an environment variable with that domain name:
export APKIT_DOMAIN=846e26f1e1ee.ngrok-free.app
Run the server
If you have poetry on your system you can simple run
poetry install # needed only the first time
poetry run uvicorn --host=0.0.0.0 server:app
Without poetry
If you do not use poetry you can manually install the required libraries in a virtual environment:
python -m venv .venv
. .venv/bin/activate
pip install fastapi uvicorn sqlalchemy apkit[server]
uvicorn --host=0.0.0.0 server:app
Using the server
The server will display it's Fediverse user name (currently starting with demo).
You can interact with this account from the Fediverse.
Local API
- http://localhost:8000/api/followers list of all followers
- http://localhost:8000/api/notes list of all status messages you sent
- http://localhost:8000/api/comments list of all responses to you status messages
You can send a status message to all your followers by POSTing to http://localhost:8000/api/status like this:
curl -XPOST -d 'Hello, world!' http://localhost:8000/api/status
This message will be send to all accounts that follow your account.