bonfire-app/architecture.html
2024-04-16 21:21:08 +00:00

267 lines
28 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.31.2">
<meta name="project" content="bonfire_umbrella v0.9.10-cooperation-beta.62">
<title>Bonfire Architecture — bonfire_umbrella v0.9.10-cooperation-beta.62</title>
<link rel="stylesheet" href="dist/html-elixir-JKHCEBPC.css" />
<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-A7S2WMC7.js"></script>
<script src="dist/sidebar_items-0AD831F9.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-JRPQ5PR6.js"></script>
</head>
<body data-type="extras" class="page-extra">
<script>
try {
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
if (settings.theme === 'dark' ||
((settings.theme === 'system' || settings.theme == null) &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.body.classList.add('dark')
}
} catch (error) { }
</script>
<div class="main">
<button id="sidebar-menu" class="sidebar-button sidebar-toggle" aria-label="toggle sidebar" aria-controls="sidebar">
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
</button>
<div class="background-layer"></div>
<nav id="sidebar" class="sidebar">
<div class="sidebar-header">
<div class="sidebar-projectInfo">
<a href="https://bonfirenetworks.org" class="sidebar-projectImage">
<img src="assets/logo.png" alt="bonfire_umbrella" />
</a>
<div>
<a href="https://bonfirenetworks.org" class="sidebar-projectName" translate="no">
bonfire_umbrella
</a>
<div class="sidebar-projectVersion" translate="no">
v0.9.10-cooperation-beta.62
</div>
</div>
</div>
<ul id="sidebar-listNav" class="sidebar-listNav" role="tablist">
<li>
<button id="extras-list-tab-button" role="tab" data-type="extras" aria-controls="extras-tab-panel" aria-selected="true" tabindex="0">
Pages
</button>
</li>
<li>
<button id="modules-list-tab-button" role="tab" data-type="modules" aria-controls="modules-tab-panel" aria-selected="false" tabindex="-1">
Modules
</button>
</li>
</ul>
</div>
<div id="extras-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="extras-list-tab-button">
<ul id="extras-full-list" class="full-list"></ul>
</div>
<div id="modules-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>
<ul id="modules-full-list" class="full-list"></ul>
</div>
</nav>
<main class="content">
<output role="status" id="toast"></output>
<div class="content-outer">
<div id="content" class="content-inner">
<div class="top-search">
<div class="search-settings">
<form class="search-bar" action="search.html">
<label class="search-label">
<span class="sr-only">Search documentation of bonfire_umbrella</span>
<input name="q" type="text" class="search-input" placeholder="Press / to search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
</label>
<button type="submit" class="search-button" aria-label="Submit Search">
<i class="ri-search-2-line ri-lg" aria-hidden="true" title="Submit search"></i>
</button>
<button type="button" tabindex="-1" class="search-close-button" aria-hidden="true">
<i class="ri-close-line ri-lg" title="Cancel search"></i>
</button>
</form>
<div class="autocomplete">
</div>
<button class="icon-settings display-settings">
<i class="ri-settings-3-line"></i>
<span class="sr-only">Settings</span>
</button>
</div>
</div>
<h1>
<a href="https://github.com/bonfire-networks/bonfire-app/blob/main/docs/ARCHITECTURE.md#L1" title="View Source" class="icon-action" rel="help">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
<span>Bonfire Architecture</span>
</h1>
<h2 id="hacking" class="section-heading">
<a href="#hacking" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Hacking</span>
</h2>
<p>Bonfire is an unusual piece of software, developed in an unusual way. It originally started as a project to create a generic federation library/framework, while building an app for educators to share and collaborate on learning resources with their peers, and has been forked and evolved a lot since then. </p><p>Hacking on it is actually pretty fun. The codebase has a unique feeling to work with and we've relentlessly refactored to manage the ever-growing complexity that a distributed social networking toolkit implies. That said, it is not easy to understand without context, which is what this document is here to provide.</p><h2 id="design-decisions" class="section-heading">
<a href="#design-decisions" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Design Decisions</span>
</h2>
<p>Feature goals:</p><ul><li>Flexibility for developers and users.</li><li>Extreme configurability and extensibility.</li><li>Integrated federation with the existing fediverse.</li></ul><p>Operational goals:</p><ul><li>Easy to set up and run.</li><li>Light on resources for small deployments.</li><li>Scalable for large deployments.</li></ul><h2 id="stack" class="section-heading">
<a href="#stack" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Stack</span>
</h2>
<p>Our main implementation language is <a href="https://www.elixir-lang.org/">Elixir</a>, which is designed for building reliable systems. We have almost <a href="bonfire-flavoured-elixir.html">our own dialect</a>.</p><p>We use the <a href="https://www.phoenixframework.org/">Phoenix</a> web framework with <a href="https://hexdocs.pm/phoenix_live_view/">LiveView</a> and <a href="https://surface-ui.org/documentation">Surface</a> for UI components and views.</p><p>Surface is a different syntax for LiveView that is designed to be more convenient and understandable to frontend developers, with extra compile time checks. Surface views and components are compiled into LiveView code (so once you hit runtime, Surface in effect doesn't exist any more).</p><p>Some extensions use the <a href="https://absinthe-graphql.org/">Absinthe</a> GraphQL library to expose an API.</p><h2 id="the-bonfire-environment" class="section-heading">
<a href="#the-bonfire-environment" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">The Bonfire Environment</span>
</h2>
<p>We like to think of bonfire as a comfortable way of developing software - there are a lot of conveniences built in once you know how they all work. The gotcha is that while you don't know them, it can be a bit overwhelming. Don't worry, we've got your back.</p><h2 id="code-structure" class="section-heading">
<a href="#code-structure" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Code Structure</span>
</h2>
<p>The code is broadly composed namespaces such as these, many of which are packaged as &quot;extensions&quot; which live in separate git repositories, which are included in the app by way of mix dependencies:</p><ul><li><code class="inline">Bonfire.*</code> - Core application logic (very little code).</li><li><code class="inline">Bonfire.*.*</code> - Bonfire extensions (eg <a href="https://hexdocs.pm/bonfire_posts/0.1.0/Bonfire.Posts.html"><code class="inline">Bonfire.Posts</code></a>) containing mostly context modules, APIs, and routes</li><li><code class="inline">Bonfire.Data.*</code> - Extensions containing database schemas and migrations </li><li><code class="inline">Bonfire.UI.*</code> - UI component extensions</li><li><code class="inline">Bonfire.*.*.LiveHandler</code> - Backend logic to handle events in the frontend</li><li><code class="inline">Bonfire.Editor.*</code> (pluggable text editors, eg. CKEditor for WYSIWYG markdown input)</li><li><code class="inline">Bonfire.GraphQL.*</code> - Optional GraphQL API</li><li><code class="inline">Bonfire.Federate.*</code> - Optional Federation hooks</li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.html"><code class="inline">ActivityPub</code></a> - ActivityPub S2S models, logic and various helper modules </li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Web.html"><code class="inline">ActivityPub.Web</code></a> - ActivityPub S2S REST endpoints, activity ingestion and push federation facilities </li><li><code class="inline">ValueFlows.*</code> - economic extensions implementing the <a href="https://www.valueflo.ws">ValueFlows vocabulary</a></li></ul><p>Contexts are were we put any core logic. A context often is circumscribed to providing logic for a particular object type (e. g. <a href="https://hexdocs.pm/bonfire_posts/0.1.0/Bonfire.Posts.html"><code class="inline">Bonfire.Posts</code></a> implements <a href="https://hexdocs.pm/bonfire_data_social/0.1.0/Bonfire.Data.Social.Post.html"><code class="inline">Bonfire.Data.Social.Post</code></a>). </p><p>All Bonfire objects use an ULID as their primary key. We use the <a href="https://hexdocs.pm/needle/0.7.2/Needle.html"><code class="inline">Needle</code></a> library (with extra logic in <a href="https://hexdocs.pm/bonfire_common/0.1.0/Bonfire.Common.Needles.html"><code class="inline">Bonfire.Common.Needles</code></a>) to reference any object by its primary key without knowing what type it is beforehand. This is very useful as it allows for example following or liking many different types of objects (as opposed to say only a user or a post) and this approach allows us to store the context of the like/follow by only storing its primary key (see <a href="https://hexdocs.pm/bonfire_data_social/0.1.0/Bonfire.Data.Social.Follow.html"><code class="inline">Bonfire.Data.Social.Follow</code></a>) for an example.</p><p>Context modules usually have <code class="inline">one/2</code>, <code class="inline">many/2</code>, and <code class="inline">many_paginated/1</code> functions for fetching objects, which in turn call a <code class="inline">query/2</code> function. These take a keyword list as filters (and an optional <code class="inline">opts</code> argument) allowing objects to be fetched by arbitrary criteria.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Users</span><span class="o">.</span><span class="n">one</span><span class="p" data-group-id="8739743847-1">(</span><span class="ss">username</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;bob&quot;</span><span class="p" data-group-id="8739743847-1">)</span><span class="w"> </span><span class="c1"># Fetching by username</span><span class="w">
</span><span class="nc">Posts</span><span class="o">.</span><span class="n">many_paginated</span><span class="p" data-group-id="8739743847-2">(</span><span class="ss">by</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;01E9TQP93S8XFSV2ZATX1FQ528&quot;</span><span class="p" data-group-id="8739743847-2">)</span><span class="w"> </span><span class="c1"># List a page of posts by its author</span><span class="w">
</span><span class="nc">EconomicResources</span><span class="o">.</span><span class="n">many</span><span class="p" data-group-id="8739743847-3">(</span><span class="ss">deleted</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p" data-group-id="8739743847-3">)</span><span class="w"> </span><span class="c1"># List any deleted resources</span></code></pre><p>Context modules also have functions for creating, updating and deleting objects, as well as hooks for federating or indexing in the search engine.</p><p>Here is an incomplete sample of some of current extensions and modules:</p><ul><li><a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.Accounts.html"><code class="inline">Bonfire.Me.Accounts</code></a> (for managing and querying local user accounts)</li><li><a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.Users.html"><code class="inline">Bonfire.Me.Users</code></a> (for managing and querying both local and remote user identities and profiles)</li><li><a href="https://hexdocs.pm/bonfire_boundaries/0.1.0/Bonfire.Boundaries.html"><code class="inline">Bonfire.Boundaries</code></a> (for managing and querying circles, ACLs, permissions...)</li><li><a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.FeedActivities.html"><code class="inline">Bonfire.Social.FeedActivities</code></a>, <a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.Feeds.html"><code class="inline">Bonfire.Social.Feeds</code></a> and <a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.Activities.html"><code class="inline">Bonfire.Social.Activities</code></a> (for managing and querying activities and feeds)</li><li><a href="https://hexdocs.pm/bonfire_posts/0.1.0/Bonfire.Posts.html"><code class="inline">Bonfire.Posts</code></a> and <a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.PostContents.html"><code class="inline">Bonfire.Social.PostContents</code></a> (for managing and querying posts)</li><li><a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.Threads.html"><code class="inline">Bonfire.Social.Threads</code></a> (for managing and querying threads and comments)</li><li><a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.Flags.html"><code class="inline">Bonfire.Social.Flags</code></a> (for managing and querying flags)</li><li><a href="https://hexdocs.pm/bonfire_social_graph/0.1.0/Bonfire.Social.Graph.Follows.html"><code class="inline">Bonfire.Social.Graph.Follows</code></a> (for managing and querying follows)</li><li><a href="https://hexdocs.pm/bonfire_classify/0.1.0/Bonfire.Classify.html"><code class="inline">Bonfire.Classify</code></a> (for managing and querying categories, topics, and the like)</li><li><a href="https://hexdocs.pm/bonfire_tag/0.1.0/Bonfire.Tag.html"><code class="inline">Bonfire.Tag</code></a> (for managing and querying tags and mentions)</li><li><a href="https://hexdocs.pm/bonfire_geolocate/0.1.0/Bonfire.Geolocate.html"><code class="inline">Bonfire.Geolocate</code></a> (for managing and querying locations and geographical coordinates)</li><li><a href="https://hexdocs.pm/bonfire_quantify/0.1.0/Bonfire.Quantify.html"><code class="inline">Bonfire.Quantify</code></a> (for managing and querying units and measures)</li></ul><h4>Additional extensions, libraries, and modules</h4><ul><li><a href="https://hexdocs.pm/bonfire_common/0.1.0/Bonfire.Common.html"><code class="inline">Bonfire.Common</code></a> and <a href="https://hexdocs.pm/bonfire_common/0.1.0/Bonfire.Common.Utils.html"><code class="inline">Bonfire.Common.Utils</code></a> (stuff that gets used everywhere)</li><li><code class="inline">Bonfire.Application</code> (OTP application)</li><li><a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.Characters.html"><code class="inline">Bonfire.Me.Characters</code></a> (a shared abstraction over users, organisations, categories, and other objects that need to have feeds and behave as an actor in ActivityPub land)</li><li><a href="https://hexdocs.pm/bonfire_federate_activitypub/0.1.0/Bonfire.Federate.ActivityPub.html"><code class="inline">Bonfire.Federate.ActivityPub</code></a> and <a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.html"><code class="inline">ActivityPub</code></a> (ActivityPub integration)</li><li><a href="https://hexdocs.pm/bonfire_search/0.1.0/Bonfire.Search.html"><code class="inline">Bonfire.Search</code></a> (local search indexing and search API, powered by Meili)</li><li><a href="https://hexdocs.pm/bonfire_mailer/0.1.0/Bonfire.Mailer.html"><code class="inline">Bonfire.Mailer</code></a>, <a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.Mails.html"><code class="inline">Bonfire.Me.Mails</code></a>, and <code class="inline">Bamboo</code> (for rendering and sending emails)</li><li><a href="https://hexdocs.pm/bonfire_files/0.1.0/Bonfire.Files.html"><code class="inline">Bonfire.Files</code></a>, <a href="https://hexdocs.pm/waffle/1.1.8/Waffle.html"><code class="inline">Waffle</code></a>, <code class="inline">TreeMagic</code> and <a href="https://hexdocs.pm/twinkle_star/0.1.0/TwinkleStar.html"><code class="inline">TwinkleStar</code></a> (for managing uploaded content)</li><li><code class="inline">Bonfire.GraphQL</code> (GraphQL API abstractions)</li><li><code class="inline">Queery</code> and <code class="inline">Bonfire.Repo.Query</code> (Helpers for making queries on the database)</li><li><code class="inline">Bonfire.Repo</code> (Ecto repository)</li><li><a href="https://hexdocs.pm/exto/0.3.0/Exto.html"><code class="inline">Exto</code></a> (to extend DB schemas in config, especially useful for adding associations)</li><li><a href="https://hexdocs.pm/absinthe_client/2.0.0/AbsintheClient.html"><code class="inline">AbsintheClient</code></a> (for querying the API from within the server)</li></ul><h3 id="general-structure" class="section-heading">
<a href="#general-structure" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">General structure</span>
</h3>
<ul><li>Bonfire app<ul><li>A <a href="extension-grumble.html#flavours">flavour</a> running <code class="inline">Bonfire.Application</code> as supervisor<ul><li>Configs assembled from extensions at <code class="inline">flavour/$FLAVOUR/config</code></li><li>Phoenix at <a href="https://hexdocs.pm/bonfire/0.1.0-beta.4/Bonfire.Web.Endpoint.html"><code class="inline">Bonfire.Web.Endpoint</code></a><ul><li>Routes assembled from extensions at <a href="https://hexdocs.pm/bonfire/0.1.0-beta.4/Bonfire.Web.Router.html"><code class="inline">Bonfire.Web.Router</code></a> </li></ul></li><li>GraphQL schema assembled from extensions at <code class="inline">Bonfire.GraphQL.Schema</code></li><li>Database migrations assembled from extensions at <code class="inline">flavour/$FLAVOUR/repo/migrations</code></li><li>Data seeds assembled from extensions at <code class="inline">flavour/$FLAVOUR/repo/seeds</code></li><li>Extensions and libraries as listed in <code class="inline">flavour/$FLAVOUR/config/deps.*</code><ul><li>Extensions defining schemas and migrations (usually <code class="inline">Bonfire.Data.*</code>)<ul><li>Schemas</li><li>Migrations defined as functions in the schema modules in <code class="inline">lib/</code></li><li>Migration templates calling those functions in <code class="inline">priv/repo/migrations</code> which are then copied into an app flavour's migrations</li></ul></li><li>Extensions implementing features or groups of features (eg. <a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.html"><code class="inline">Bonfire.Me</code></a>)<ul><li>Config template which is then copied into an app flavour's config (eg <code class="inline">config/bonfire_me.exs</code>)</li><li>Contexts (eg <a href="https://hexdocs.pm/bonfire_me/0.1.0/Bonfire.Me.Users.html"><code class="inline">Bonfire.Me.Users</code></a>)<ul><li>Sometimes LiveHandlers for handling frontend events in the backend (eg <a href="https://hexdocs.pm/bonfire_ui_me/0.1.0/Bonfire.Me.Users.LiveHandler.html"><code class="inline">Bonfire.Me.Users.LiveHandler</code></a>)</li></ul></li><li>Routes (eg <a href="https://hexdocs.pm/bonfire_ui_me/0.1.0/Bonfire.UI.Me.Routes.html"><code class="inline">Bonfire.UI.Me.Routes</code></a>)<ul><li>Controllers and/or Views (eg <code class="inline">Bonfire.UI.Me.CreateUserController</code> and <code class="inline">Bonfire.UI.Me.CreateUserLive</code>)</li></ul></li><li>API (eg <code class="inline">Bonfire.Me.API.GraphQL</code>), refer to <a href="graphql.html">GraphQL API documentation</a><ul><li>Schemas</li><li>Resolvers</li></ul></li><li>Sometimes Plugs (eg <code class="inline">Bonfire.Web.Plugs.UserRequired</code> and <code class="inline">Bonfire.Web.LivePlugs.UserRequired</code>)</li></ul></li><li>Other extensions or libraries (eg <a href="https://hexdocs.pm/needle/0.7.2/Needle.html"><code class="inline">Needle</code></a> or <a href="https://hexdocs.pm/bonfire_common/0.1.0/Bonfire.Common.html"><code class="inline">Bonfire.Common</code></a> which are used by most other extensions)</li></ul></li></ul></li></ul></li></ul><h2 id="naming" class="section-heading">
<a href="#naming" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Naming</span>
</h2>
<p>It is said that naming is one of the four hard problems of computer science (along with cache management and off-by-one errors). We don't claim our scheme is the best, but we do strive for consistency.</p><h3 id="naming-guidelines" class="section-heading">
<a href="#naming-guidelines" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Naming guidelines</span>
</h3>
<ul><li>Module names mostly begin with <code class="inline">Bonfire.</code> unless they belong to a more generic library (eg <a href="https://hexdocs.pm/needle/0.7.2/Needle.html"><code class="inline">Needle</code></a> or <a href="https://hexdocs.pm/bonfire_valueflows/0.1.0/ValueFlows.html"><code class="inline">ValueFlows</code></a>)</li><li>Everything within an extension begins with the context name and a <code class="inline">.</code> (eg <code class="inline">Bonfire.Social.Migrations</code>)</li><li>Database schemas should be named in the singular (eg <a href="https://hexdocs.pm/bonfire_data_social/0.1.0/Bonfire.Data.Social.Post.html"><code class="inline">Bonfire.Data.Social.Post</code></a>)</li><li>Context modules are named in plural where possible (eg <a href="https://hexdocs.pm/bonfire_posts/0.1.0/Bonfire.Posts.html"><code class="inline">Bonfire.Posts</code></a>)</li><li>Other modules within a context begins with the context name and a <code class="inline">.</code> (eg <a href="https://hexdocs.pm/bonfire_ui_posts/0.1.0/Bonfire.Posts.LiveHandler.html"><code class="inline">Bonfire.Posts.LiveHandler</code></a>)</li><li>Modules use UpperCamelCase while functions use snake_case</li><li>Acronyms in module names should be all uppercase (eg <a href="https://hexdocs.pm/bonfire_social/0.1.0/Bonfire.Social.APActivities.html"><code class="inline">Bonfire.Social.APActivities</code></a>)</li></ul><h2 id="federation-libraries" class="section-heading">
<a href="#federation-libraries" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Federation libraries</span>
</h2>
<h3 id="activitypub" class="section-heading">
<a href="#activitypub" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text"><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.html"><code class="inline">ActivityPub</code></a></span>
</h3>
<p>This namespace handles the ActivityPub logic and stores AP activities. It is largely adapted Pleroma code with some modifications, for example merging of the activity and object tables and new actor object abstraction.</p><ul><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.html"><code class="inline">ActivityPub</code></a> contains the main API and is documented there. </li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.Adapter.html"><code class="inline">ActivityPub.Federator.Adapter</code></a> defines callback functions for the AP library.</li></ul><p>It also contains some functionality that isn't part of the AP spec but is required for federation:</p><ul><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Safety.Keys.html"><code class="inline">ActivityPub.Safety.Keys</code></a> - Generating and handling RSA keys and signatures </li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.WebFinger.html"><code class="inline">ActivityPub.Federator.WebFinger</code></a> - Implementation of the WebFinger protocol</li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.HTTP.html"><code class="inline">ActivityPub.Federator.HTTP</code></a> - Module for making HTTP requests (wrapper around tesla)</li><li><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Instances.html"><code class="inline">ActivityPub.Instances</code></a> - Module for storing reachability information about remote instances</li></ul><p>Also refer to <a href="mrf.html">MRF documentation</a> to learn how to rewrite or discard messages.</p><h3 id="activitypub-web" class="section-heading">
<a href="#activitypub-web" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text"><a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Web.html"><code class="inline">ActivityPub.Web</code></a></span>
</h3>
<p>This namespace contains the ActivityPub Server-to-Server REST API, the activity ingestion pipeline (<a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.Transformer.html"><code class="inline">ActivityPub.Federator.Transformer</code></a>) and the push federation facilities (<a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.html"><code class="inline">ActivityPub.Federator</code></a>, <a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.APPublisher.html"><code class="inline">ActivityPub.Federator.APPublisher</code></a> and others). The outgoing federation module is designed in a modular way allowing federating through different protocols in the future. </p><h3 id="activitypub-integration-with-bonfire-s-application-logic" class="section-heading">
<a href="#activitypub-integration-with-bonfire-s-application-logic" class="hover-link">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">ActivityPub integration with Bonfire's application logic</span>
</h3>
<p>The callback functions defined in <a href="https://hexdocs.pm/activity_pub/0.1.0/ActivityPub.Federator.Adapter.html"><code class="inline">ActivityPub.Federator.Adapter</code></a> are implemented in <a href="https://hexdocs.pm/bonfire_federate_activitypub/0.1.0/Bonfire.Federate.ActivityPub.Adapter.html"><code class="inline">Bonfire.Federate.ActivityPub.Adapter</code></a>. </p><p>When implementing federation for a new object type it needs to be implemented for both directions:
for outgoing federation using the hooks in <a href="https://hexdocs.pm/bonfire_federate_activitypub/0.1.0/Bonfire.Federate.ActivityPub.Outgoing.html"><code class="inline">Bonfire.Federate.ActivityPub.Outgoing</code></a> and for incoming federation using the hooks in <a href="https://hexdocs.pm/bonfire_federate_activitypub/0.1.0/Bonfire.Federate.ActivityPub.Incoming.html"><code class="inline">Bonfire.Federate.ActivityPub.Incoming</code></a>.</p>
<div class="bottom-actions">
<div class="bottom-actions-item">
<a href="deploy.html" class="bottom-actions-button" rel="prev">
<span class="subheader">
← Previous Page
</span>
<span class="title">
Deployment guide
</span>
</a>
</div>
<div class="bottom-actions-item">
<a href="bonfire-flavoured-elixir.html" class="bottom-actions-button" rel="next">
<span class="subheader">
Next Page →
</span>
<span class="title">
Bonfire-flavoured Elixir
</span>
</a>
</div>
</div>
<footer class="footer">
<p>
<span class="line">
<button class="a-main footer-button display-quick-switch" title="Search HexDocs packages">
Search HexDocs
</button>
<a href="bonfire_umbrella.epub" title="ePub version">
Download ePub version
</a>
</span>
</p>
<p class="built-using">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.31.2) for the
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
</p>
</footer>
</div>
</div>
</main>
</div>
</body>
</html>