Server code for the Habitat network.
The software architecture roughly follows the Clean Architecture.
- Entities: The
entities
package contains common structs for basic concepts - Use Cases: Appication logic is included in the various packages
- Interface Adapters: Major interfaces include that between the backnets and
fs
, as and betweenfs
and the app layer.
state
: Each community has critical state that it needs to keep track of, including membership, backnet addresses, and running applications. This state is so important that all peers need to reliably agree on it. To do this, thestate
module communicates with peers in the various communities hosted on the node to reach consensus, using the Paxos algorithm.orchestrator
: This process manages all other processes on the node, dynamically starting and stopping backnets, apps, etc as they are created and destroyed. Theorchestrator
module acts as a state machine on the critical state declared by thestate
module.fs
: The filesystem module interfaces between applications requesting files, and the backnets hosting them. It manages permissions, file encryption, and handling the contingency of an unavailable backnet, according to local-first principles.client
This module allows for the owners of the host machine to configure the node. Users are logged into the node through this module.backnets
: Backnets, such as IPFS and DAT host peer-2-peer filesystems, which are accessed by thefs
module through a backnet interface to provide data to apps.apps
: Apps serve data to clients (on browsers for example), through standard methods like REST, GraphQL, etc. Web frontends for these apps are served via the gateways provided by backnets. That code then makes calls to an address for the app. Apps can be load balanced between nodes in a community.