improve description of the HTTP video import feature
[oweals/peertube.git] / ARCHITECTURE.md
1 # Architecture
2
3 ## Vocabulary
4
5   - **Fediverse:** several servers following one another, several users
6     following each other. Designates federated communities in general.
7   - **Vidiverse:** same as Fediverse, but federating videos specifically.
8   - **Instance:** a server which runs PeerTube in the fediverse.
9   - **Origin instance:** the instance on which the video was uploaded and which
10     is seeding (through the WebSeed protocol) the video.
11   - **Cache instance:** an instance that decided to make available a WebSeed
12     of its own for a video originating from another instance. It sends a `ptCache`
13     activity to notify the origin instance, which will then update its list of
14     WebSeeds for the video.
15   - **Following:** the action of a PeerTube instance which will follow another
16     instance (subscribe to its videos).
17
18 ## Base
19
20 ### Communications
21   * All the communication between the instances are signed with [Linked Data
22     Signatures](https://w3c-dvcg.github.io/ld-signatures/) with the private key
23     of the account that authored the action.
24   * We use the [ActivityPub](https://www.w3.org/TR/activitypub/) protocol (only
25     server-server for now). Object models could be found in
26     [shared/models/activitypub
27     directory](/shared/models/activitypub).
28   * All the requests are retried several times if they fail.
29
30 ### Instance
31   * An instance has a websocket tracker which is responsible for all videos
32     uploaded by its users.
33   * An instance has an administrator that can follow other instances.
34   * An instance can be configured to follow back automatically.
35   * An instance can blacklist other instances (only used in "follow back"
36     mode).
37   * An instance cannot choose which other instances follow it, but it can
38     decide to **reject all** followers.
39   * After having uploaded a video, the instance seeds it (WebSeed protocol).
40   * If a user wants to watch a video, they ask its instance the magnet URI and
41     the frontend adds the torrent (with WebTorrent), creates the HTML5 video
42     player and streams the file into it.
43   * A user watching a video seeds it too (BitTorrent). Thus another user who is
44     watching the same video can get the data from the origin server and other
45     users watching it.