Kosmos architecture

Introduction

This repository contains the Kosmos application framework.

Kosmos can be described as an executable data model driven framework that is designed to be included as a shared library within a project, along with the project's corresponding data and access control models, defined using yaml and adhering to the json-schema format for validation purposes.

graph LR
    d(App 1) --> B
    e(App 2) --> c
    f(App 3) --> c
    g(App 4) --> c
    B(backend1) ---  A[Kosmos]
    c(backend2) ---  A[Kosmos]

The data model is defined using a vertex-edge model, where each vertex and edge used in the model are represented as individual YAML files. In addition, a single graph.yml file is used to define how the vertices and edges are connected to represent the application model.

erDiagram
          User ||--o| MediaFile : hasProfile
          User ||--o{ Page : authorOf
          Page ||--|{ MediaFile : hasMedia
          User ||--o{ Group : memberOf

The access control models policies and permissions are defined on a role by role basis, and can target specific vertices and edges. These policies are also defined in YAML and adhere to a json-schema.

When the Kosmos application is executed, it uses the defined data model and access control model to wire together a running application that has a GraphQL frontend and uses a graph database as its primary storage backend.

graph LR
    project(project) --> schemas(schemas)
    project(project) --> policies(policies)
    project(project) --> roles(roles)
    schemas --> g(graph.yml)
    schemas --> vertices(vertices)
    schemas --> edges(edges)
    edges --> authorOf.yml
    edges --> hasMedia.yml
    edges --> hasProfile.yml
    edges --> memberOf.yml
    vertices --> User.yml
    vertices --> MediaFile.yml
    vertices --> Page.yml
    policies --> orgAccess.yml
    roles --> roles.yml

The functionality of Kosmos can be extended using traits, which are used to provide the ability to add additional functionality to a project's schema vertices and edges. It is possible to add multiple Traits to each vertex or edge and each one can be individually configured.

Architecture diagrams