Adding a more specific phrasing for yarn installation (#487)
[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
8     is seeding (through the WebSeed protocol) the video.
9   - **Following:** the action of a PeerTube instance which will follow another
10     instance (subscribe to its videos).
11
12 ## Base
13
14 ### Communications
15   * All the communication between the instances are signed with [Linked Data
16     Signatures](https://w3c-dvcg.github.io/ld-signatures/) with the private key
17     of the account that authored the action.
18   * We use the [ActivityPub](https://www.w3.org/TR/activitypub/) protocol (only
19     server-server for now). Object models could be found in
20     [shared/models/activitypub
21     directory](/shared/models/activitypub).
22   * All the requests are retried several times if they fail.
23
24 ### Instance
25   * An instance has a websocket tracker which is responsible for all the video
26     uploaded in it.
27   * An instance has an administrator that can follow other instances.
28   * An instance can be configured to follow back automatically.
29   * An instance can blacklist other instances (only used in "follow back"
30     mode).
31   * An instance cannot choose which other instances follow it, but it can
32     decide to **reject all** followers.
33   * After having uploaded a video, the instance seeds it (WebSeed protocol).
34   * If a user wants to watch a video, they ask its instance the magnet URI and
35     the frontend adds the torrent (with WebTorrent), creates the HTML5 video
36     player and streams the file into it.
37   * A user watching a video seeds it too (BitTorrent). Thus another user who is
38     watching the same video can get the data from the origin server and other
39     users watching it.