BadgeFed (aka ActivityPub Badges) is a minimalistic, federated badge system inspired by Credly, built with .NET and leveraging the ActivityPub protocol and the OpenBadges spec. It enables issuing, managing, and verifying digital badges across federated servers.
- Blog: badgefed.vocalcat.com
- Issue and manage digital badges and grants
- ActivityPub protocol support for federation (see implementation details)
- Built with .NET 9
- OAuth login (Mastodon, LinkedIn)
- Email notifications
- Easily extensible and self-hostable
- 100% Open Source under the LGPL license.
A list of public BadgeFed servers is maintained in SERVERS.md
, generated from servers.json
using the gen.sh
script. To contribute a server, create a pull request in this repo by adding it to servers.json
.
To run BadgeFed in a Docker container, follow these steps:
-
Build the Docker Image:
docker build -t badgefed .
-
Run the Container:
docker run -d -p 5000:80 --name badgefed -e SQLITE_DB_FILENAME="badgefed.db" badgefed
-
Environment Variables:
- Pass environment variables using the
-e
flag. - Example:
docker run -d -p 5000:80 --name badgefed \ -e SQLITE_DB_FILENAME="badgefed.db" \ -e ASPNETCORE_ENVIRONMENT="Development" \ badgefed
- Pass environment variables using the
-
Volume Mounts:
- Mount volumes for persistent data storage.
- Example:
docker run -d -p 5000:80 --name badgefed \ -v $(pwd)/data:/app/data \ badgefed
A fully docker example would be:
docker run -d \
-p 5000:80 \
--name badgefed \
-e SQLITE_DB_FILENAME="badgefed.db" \
-e ASPNETCORE_ENVIRONMENT="Production" \
-e "MastodonConfig__ClientId=your-client-id" \
-e "MastodonConfig__ClientSecret=your-client-secret" \
-e "MastodonConfig__Server=hachyderm.io" \
-e "AdminAuthentication__AdminUsers__0__Id=mymastodonusername" \
-e "AdminAuthentication__AdminUsers__0__Type=Mastodon" \
-v $(pwd)/data:/app/data \
badgefed
For more details, refer to the Microsoft Configuration Documentation about how to pass environment variables in a dotnet docker image.
See the USAGE.md file for a detailed usage guide, including badge management, grant workflow, recipient profiles, and more.
BadgeFed uses a layered configuration system in .NET, allowing settings to be defined in appsettings.json
, appsettings.Development.json
, environment variables, and other sources. Below is a detailed guide to the available settings and how to use them.
- Purpose: Configures the logging levels for the application.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }
- Usage: Adjust the log levels to control the verbosity of logs. Common levels include
Information
,Warning
, andError
.
- Purpose: Specifies the allowed hosts for the application.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"AllowedHosts": "*"
- Usage: Use
*
to allow all hosts or specify a list of allowed domains.
- Purpose: Defines the domains used for badge issuance and verification.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"BadgesDomains": [ "badgefed.example.com" ]
- Usage: Update this setting with the domain(s) where your application is hosted.
- Purpose: Configures admin users and their authentication types.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"AdminAuthentication": { "AdminUsers": [ { "Id": "[email protected]", "Type": "LinkedIn" }, { "Id": "mastodon_user", "Type": "Mastodon" } ] }
- Usage: Add admin users with their IDs and authentication types (
LinkedIn
orMastodon
). LinkedIn uses email as IDs, and Mastodon uses usernames. If only Mastodon users are specified or only LinkedIn users are specified, only the corresponding login button will appear. For example, if no Mastodon users are specified, the Mastodon login button will not appear.
- Purpose: Configures Mastodon OAuth for authentication.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"MastodonConfig": { "ClientId": "your-client-id", "ClientSecret": "your-client-secret", "Server": "hachyderm.io" }
- Usage: Replace
ClientId
,ClientSecret
, andServer
with your Mastodon app credentials. For more details, visit the Mastodon Developer Documentation.
- Purpose: Configures LinkedIn OAuth for authentication.
- Location:
Program.cs
(viaLinkedInConfig
class) - Example:
"LinkedInConfig": { "ClientId": "your-client-id", "ClientSecret": "your-client-secret" }
- Usage: Add Linked credentials in the configuration file or environment variables. You need to create a LinkedIn app with OpenId auth scope. For more details, visit the LinkedIn Developer Documentation.
- Purpose: Configures SMTP settings for sending emails.
- Location:
appsettings.json
andappsettings.Development.json
- Example:
"EmailSettings": { "SmtpServer": "smtp.example.com", "Port": 587, "SenderEmail": "[email protected]", "SenderName": "BadgeFed", "Username": "smtp-username", "Password": "smtp-password" }
- Usage: Update the SMTP server, port, sender email, and credentials for email functionality.
For a technical overview of how BadgeFed implements ActivityPub and OpenBadge 2.0, see DETAILS.md.
Contributions are welcome! To add a new server, update servers.json
and run gen.sh
.
For code contributions, please open an issue or submit a pull request.
This project is licensed under the LGPL License. See the LICENSE file for details.