Set port if not specified in webfinger
[oweals/peertube.git] / ARCHITECTURE.md
1 # Architecture
2
3 ## Vocabulary
4
5   - **Fediverse:** several servers following each others
6   - **Instance:** a server which runs PeerTube in the fediverse
7   - **Origin instance:** the instance on which the video was uploaded and which is seeding (WebSeed protocol) the video
8   - **Following:** the action of a PeerTube instance which will follow another instance (subscribe to its videos)
9
10 ## Base
11
12 ### Communications
13   * All the communications between the instances are signed with [Linked Data Signatures](https://w3c-dvcg.github.io/ld-signatures/) with the private key of the account that made the action
14   * We use the [ActivityPub](https://www.w3.org/TR/activitypub/) protocol (only server-server for now). Object models could be found in [shared/models/activitypub directory](https://github.com/Chocobozzz/PeerTube/tree/develop/shared/models/activitypub).
15   * All the requests are retried several times if they fail
16   * The maximum of points would be defined
17
18 ### Instance
19   * An instance has a websocket tracker which is responsible for all the video uploaded in it
20   * An instance has an administrator that can follow other instances
21   * An instance can be configured to follow back automatically
22   * An instance can blacklist other instances (only used in "follow back" mode)
23   * An instance cannot choose which other instance follow it, but it can decide to **reject all** followers
24   * After having uploaded a video, the instance seeds it (WebSeed protocol)
25   * If a user wants to watch a video, he asks its instance the magnet URI and the frontend adds the torrent (with WebTorrent), creates the HTML5 video player and streams the file into it
26   * A user watching a video seeds it too (BitTorrent) so another user who is watching the same video can get the data from the origin server and the user 1 (etc)