Skip to content

Architecture

Coat Rack consists of a few moving parts that work together to offer a good experience for users and app developers as well as ensure that data is synchronised efficiently.

To deliver an appropriate level of security and isolation between applications on the platform, Coat Rack is broken up into a few different pieces.

To avoid ambiguity, we’ll refer to the file structure of some packages within the repository to explain the interactions between its parts:

  • Directoryapps
    • Directoryserver
      • Backend functionality supporting the web and sandbox
    • Directoryweb
      • The main interface that users see
    • Directorysandbox
      • Part of UI that hosts catalog apps
  • Directorycatalog
    • Directorynotes/
    • Directorytasks/
    • 1st party apps that run on the platform
  • Directorypacakges
    • sdk
    • ui
    • icons
    • 1st party packages for app development

Data management

Before diving into a specific app, it’s useful to understand the core ideas about how data is managed.

The platform follows a local-first data approach. This means that data is persisted asynchronously between the client and the server. Users are able to work offline and synchronize data once they’re back online. The server is also able to receive updates from different users and will manage distributing those updates to other users once they re-synchronize.

Most data is stored as JSON files on the server, the entire database can therefore be backed up by simply copying the data folder.

Additionally, data is grouped into Spaces. Spaces can be thought of as a layer sitting on top of the data that enables efficient data organization from a user perspective while also enabling access control at a platform level. Each data entry can only belong to a single space but may be accessibly by multiple users.

The concept of Spaces has a strong influence on how data is managed as well as how apps should interact with it since it is possible for users to work with data from multiple spaces simultaneously. This is an important concept that influences how apps are designed for the platform.

Server

  • Directoryapps
    • Directoryserver/
    • Directoryweb/
    • Directorysandbox/
  • Directorycatalog/
  • Directorypackages/

The server has a few primary roles, namely:

  • User management
  • Data management
  • Application hosting

User management

The server provides mechanisms for authentication as well validates what spaces and data a user has access to.

Depending on some basic user permissions, it also allows the creation and management of users and spaces.

Data management

Since the platform enables offline reading and writing of data users may update multiple entries asynchronously. In this solution, the server is responsible for providing eventual consistency by consolidating updates from multiple users and distributing them to other users when they become online.

Application hosting

The server manages the installation and hosting of apps installed on the platform.

In order to provide isolation between applications, each app is hosted as a sub-process within the server and listens on its port. The server manages the lifecycle of each of these sub-processes.

Web

  • Directoryapps
    • Directoryserver/
    • Directoryweb/
    • Directorysandbox/
  • Directorycatalog/
  • Directorypackages/

This is the primary interface that users have when using Coat Rack. The main role of this app is to provide a UI for hosting apps via the sandbox. To facilitate this, it also provides the user interface for logging in and managing active spaces.

The web app hosts the sandbox within an iframe and communicates with it using messaging for data exchange as well as user context. This means that apps within the sandbox are never given direct access to any data. This design enables the web to ensure good isolation and integrity of different apps’ data.

Sandbox

  • Directoryapps
    • Directoryserver/
    • Directoryweb/
    • Directorysandbox/
  • Directorycatalog/
  • Directorypackages/

The sandbox is a container for catalog apps. These can be 1st or 3rd party and are provided by the server. This provides a basic shell for apps and renders them with a valid data context.

To simplify application development, the sandbox also manages the communication with web. This makes it possible for apps to work with data and spaces without having to manage the complex asynchronous communication between the sandbox and web.

Catalog and Applications

  • Directoryapps
    • Directoryserver/
    • Directoryweb/
    • Directorysandbox/
  • Directorycatalog/
    • Directorynotes/
    • Directorytasks/
    • 1st party apps that run on the platform
  • Directorypackages/
    • Directorysdk/
    • Directoryui/
    • Directoryicons/

The catalog provides a collection of 1st party apps that can be run on the platform. These apps serve a functional purpose for users as well as a reference implementation for developers making 3rd party apps.

Applications built for Coat Rack are React components that are compiled in a way that is compatible with the platform’s technical requirements. Due to the structure of the platform, application developers need only concern themselves with the experience they wish to provide to users and not with the inner details of the data management and local-first design, as these are taken care of by the platform.

Additionally, the various libraries within packages provide application developers with primitives for delivering good user experiences within the platform, namely:

  • ui for building user interfaces that align with the platform’s design system.
  • icons for ensuring consistent iconography between the platform and apps.
  • sdk for accessing platform functionality such as data management