Skip to main content

Chemotion ELN Project Overview

Info

This page is still being edited and reviewed.

Both the native and Docker installation for development will result in cloning the source code (or a fork of it) of the Chemotion ELN project. The source code can be found on GitHub. The images in this chapter are from the Docker installation.

The project is built with the Ruby on Rails framework in version 5. It uses the Model-View-Controller (MVC) architectural pattern. However, this project differs from a typical Rails project:

  • It is using a JSON API.
  • Rails comes with built-in support for SQLite, but the project is using PostgreSQL. Redis might be used in the future as well.
  • The front-end is built using the React framework. The main page is a single-page application (SPA) along with a few other pages.

Directory structure#

app#

app is the main directory in a Rails application. It contains the MVC structure in the subdirectories models, views, and controllers. However, because the project doesn't adhere to the default Rails architecture, the controllers are mostly empty. Instead of controllers, a JSON API is used which lives in the api directory. Also, there are not many pages in the views directory.

Since we upgraded from Rails 4 to 5, assets are compiled with Webpacker in addition to (or in the future replacement of) the Rails Asset Pipeline. There are currently multiple directories containing assets (e.g., under app, public, vendor, tmp). The app/assets directory was the main directory for storing assets in the previous version with Rails 4. With the implementation of Webpacker the assets moved to app/packs. For example, the JavaScript files with all React components formerly lived in app/assets/javascripts and now moved to app/packs/src. app/packs/src contains a directory for each single-page application (SPA). For example, the user-facing SPA lives in is the app/packs/src/components. The stylesheets directory is still located under app/assets.

config#

Contains the configuration of the application. For example, database.yml contains the configuration of the database. The environments subdirectory contains the three environments provided by Rails by default (i.e., development, production, and test). The initializers subdirectory contains the configuration of extensions. For instance, in the devise subdirectory, we configure a package for authentication which takes care of the mail sender and passwords.

lib#

Modules related to the application are added to this directory, such as PubChem, DataCite, OpenBabel. It also has the storage directory where the files are uploaded.

node_modules#

Contains node modules which are installed with yarn.

public#

Contains static files, such as images of molecules. Iit is difficult to query them as they have hexadecimal identifiers. When creating, e.g., a new reaction, the application will create an image for it and store it in the images/reactions directory.

spec#

Contains unit test, acceptance test, and JavaScript test.

uploads#

Contains attachments uploaded by the user.

.rubocop.yml and .eslintrc#

It is advised to use RuboCop and ESLint for Ruby and JavaScript code respectively. The hidden files .eslintrc and .rubocop.yml contain the linter configurations. Look at the development chapter for more details.

Last updated on by Jan C. Brammer