Skip to content

Latest commit

 

History

History
1320 lines (1078 loc) · 60.6 KB

File metadata and controls

1320 lines (1078 loc) · 60.6 KB

0. Architecture Overview

Next: 1. Getting Started

Table of Contents

Polylith

This project adopts a Polylith design, which allows both a mono-repo experience across mulitple projects.

For a quick video overview, check out: Polylith in a Nutshell

What is a Polylith?

The Polylith project organization method attempts to marry the best parts of operating within a single Monorepo (single source of truth, DRY code, less repos to manage), with the benefits of having single repos for each project (customization).

The Polylith design is made up of three parts: Components, Bases, and Projects.

Components

Thisis the most basic unit for Polylith. Ideally, Components require few, if any, dependencies. Each component always has an <component>.interface namepace, which includes the public functions that are meant to be exported fromthe component. Components (ideally) are written in the Clojure Common (*.cljc) formt so as to be used in both CLJ and CLJS environments.

Bases

Base are groups of components and other dependencies that constitute a midde-tier of the Polylith. Bases can be project-specific, but ideally are geneal enough to be used across multiple projects. Bases typically onlyhave a main.clj[sc] file.

Projects

Projects are made up of multiple bases and components. Many projects can exist within a Polylith, which enables a great deal of customization while also sharing components and bases across projects.

Clojure/Script

Clojure is a Lisp language invented by Rich Hickey in the late 2000’s that runs on the Java Virtual Machine. This language is quite extensible, and stable thanks to the Clojure Team’s relentless pursuit of backwards compatibility (Clojure continues to be supported on Java 8.)

ClojureScript takes the benefits of Clojure and applies them to the Browser. This allows our team to use one language for both Front-end and Back-end programming, reducing cognitive overhead and allowing us to use identical code in both domains.

Components Library

The projects take advantage of the Behave Components shared UI components library, written in ClojureScript.

Reagent & Re-Frame

The projects use both Reagent and Re-Frame to manage application state and application logic. Re-Frame was adopted to reduce tight coupling between views/components and the data/actions that are used within them.

Datalog & Datoms

The projects store data in Datoms and performs queries using the Datalog syntax. The back-end access Datoms using Datomic, and the front-end accesses Datoms through DataScript. Re-Posh is also used to enable subscriptions on DataScript entities, reducing view logic.

WebAssembly

Behave7’s underlying science exists in the Behave Library, which is written in C++. To enable the application to run on any device, the team uses Emscripten to convert the C++ code into WebAssembly (WASM), an assembly code that runs inside modern web browsers. This reduces the potential for malicious code to run on the user’s system, while also granting us compabitility with any device that can run a modern web browser.

For more information on how we go from C++ to WASM, check out the Building WebAssembly guide.

Schema

The following diagrams were produced using GraphViz.

Variable Management System (VMS)

This schema is used for the Behave VMS. It largely impacts the rendering UI of the Behave VMS and the Application.

./images/vms-schema.png

Worksheet

This schema is used to store instances of worksheet information in the Behave application.

./images/worksheet-schema.png

VMS + Worksheet

This Documents the schema for both the behave and behave_cms project.

./images/schema.png

Application Schema

./images/schema.png