a headless ActivityPub server written with Python and fastAPI.
Find a file
spla 558a86564b Fix settings: add web_url, return '' instead of 'None', sanitize null saves
- GET /api/v1/admin/settings: add web_url, return '' for null/None values
- POST /api/v1/admin/settings: add web_url, save '' when value is None
- get_setting: return '' when stored value is the string 'None'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 13:44:39 +00:00
app Fix settings: add web_url, return '' instead of 'None', sanitize null saves 2026-05-21 13:44:39 +00:00
apps Added 2025-06-21 12:00:29 +02:00
dist feat: implement Mastodon-compatible account migration 2026-05-16 21:37:50 +02:00
static refactor: OAuth flow without session cookies 2026-03-28 19:34:07 +00:00
system *New feature*: admin web interface with dashboard, login/logout and weekly interactions stats 2026-02-24 15:27:41 +00:00
LICENSE En desenvolupament 2023-11-29 18:24:09 +01:00
migrate_images.py Added migrate_images.py utility to migrate account's avatars and headers from remote URL to local PATH. 2026-02-21 20:47:47 +01:00
README.md Updated 2026-03-02 00:36:00 +01:00
requirements.txt Sanitize federated and local HTML to prevent XSS 2026-05-07 21:38:45 +02:00

appy

appy

A lightweight server implementing the ActivityPub protocol in Python over fastAPI.

Key Features

  • Full support for the ActivityPub protocol (actors, activities, inbox, outbox, etc.).
  • Compatible with federated platforms like Akkoma, Mastodon, Loops, Misskey, Pleroma
  • Accesible via API only.
  • HTTP Signatures support for secure communication.

Web Interface

appy includes a built-in web interface accessible at your server's domain. No JavaScript required.

Public pages

  • Home page (/): Trending posts, hashtags and news in a three-column layout.
  • Hashtag page (/tags/{hashtag}): Posts using a specific hashtag.
  • Sign up (/auth/sign_up): Registration form (depends on server configuration).
  • Sign in (/sign_in): Login form for registered users.

User pages (requires login)

  • Profile settings (/settings/profile): Edit display name, bio, avatar and header image.

Administration (requires Owner or Admin role)

  • Dashboard (/admin): Server statistics and overview.
  • Users (/admin/users): List, search, create and manage users.
  • Domains (/admin/domains): List federated domains, block and unblock them.
  • Server settings (/admin/settings): Configure branding, registrations and server description.
    • Branding: server name, contact username, contact email, server description, server image.
    • Registrations: open, approval required or closed, minimum age.
    • About: extended description and terms of service.

Built With

Python FastAPI Pydantic Uvicorn asyncpg

Requirements

Dependencies

  • Python: version 3.10 or later.
  • Postgresql: running Postgresql server with a created role with LOGIN and CREATEDB privileges.
  • Redis: running Redis server with requirepass enabled.
  • ffmpeg: must be installed on the system and available in PATH
  • Libraries:
    • FastAPI
    • uvicorn
    • httpx
    • cryptography
    • asyncpg

Getting Started

Follow these steps to run the server locally:

  1. Clone the project repository to your local machine:
git clone https://codeberg.org/spla/appy.git
cd appy
  1. Create the Python Virtual Environment:
python3.x -m venv .

Don't forget the . at then end

  1. Activate it
    Enable Python Environment:
source bin/activate
  1. Install the required Python libraries:
pip install -r requirements.txt
  1. Copy dist/nginx.conf to /etc/nginx/sites-available/<your_appy_domain>.conf and edit it to change <example.net> to your domain.

  2. Enable it with:

ln -s /etc/nginx/sites-available/<your_appy_domain>.conf /etc/nginx/sites-enabled/<your_appy_domain>.conf
  1. Check if nginx like it:
nginx -t
  1. Add the nginx user to the appy user group so nginx can read media files: Replace <appy_user> with the system user running appy (e.g. appy):
sudo usermod -aG <appy user> www-data
  1. Restart nginx.

  2. Start the appy server with the following command:

python app/main.py

First time run will ask for needed parameters and will create your user profile. Later on, the server will be running locally at http://127.0.0.1:{configured_port}.

Updating

Update appy by issuing:

git pull origin main && git fetch --tags

Usage Example

Heres how to interact with the server. Use any of the following apps to sign in:

iOS: Icecubes, Ivory, Mastodon (official), Mona, Tusker
Android: Fedilab, Mastodon (official), Moshidon, Pachli, Tusky

Self destruct (clean defederation)

python app/selfdestruct.py

Run selfdestruct if you decide to stop your appy server the clean way. selfdestruct erase your server from the federation by sending Delete activities to all known remote servers.

Architecture

The server is built to follow the standard ActivityPub flow: 1. An actor sends an activity via the outbox. 2. The server signs the activity with HTTP Signatures and dispatches it to the inboxes of other actors. 3. Recipient actors process the activity in their inbox.

A simplified diagram of the flow:

[Client] --> [Outbox] --> [HTTP Signatures] --> [Remote Inbox]
↑ ↓
[ActivityPub Actor] <-- [Inbox] <-- [HTTP Signature check] <-- [Remote Outbox]

Contributing

We welcome contributions to the project! To get started:

  1. Fork this repository.
  2. Create a new branch for your feature or fix:
git checkout -b feature/new-feature
  1. Make your changes and commit them with a clear message:
git commit -m "Add new feature"
  1. Push your branch:
git push origin feature/new-feature
  1. Submit a pull request.

Please ensure that your code follows the PEP 8 style guide.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE. See the LICENSE file for more details.

Additional Resources

Here are some resources to help you understand ActivityPub and related technologies:
Official ActivityPub Documentation
Mastodon's really great API docs
FastAPI Documentation
Understanding ActivityPub

Support

If you encounter any issues, feel free to open an issue or contact the project maintainer.