# cBioPortal Backend Code Organization

# Maven Project

The backend code is structured as a Maven project. Included in the repository are pom.xml files which define the code components and modules which make up the backend. The pom.xml files also list dependencies on external open source libraries, and dependencies between cBioPortal Maven modules. They also give instructions for how to build and package code components into a deployable format.

# Frontend data exchange

The frontend is a React javascript application located in a separate GitHub repository repo, which communicates with the backend via a REST API. We also use JSP to embed configuration data in the initial HTML page in order to allow us to optimize loading times.

# Current Maven Modules

TODO: This is out of date. See https://github.com/cBioPortal/cbioportal/issues/11403.

# The core module

The core module contains the oldest code in the code base. Much of the backend web data services logic has been re-implemented and expanded in other backend maven modules, such as model, persistence-mybatis, service, and web. We plan to discontinue the legacy webservice.do data servlet and fully transition to the new data services API in the near future. The core module will then be purged of much of the legacy code. Any surviving functionality (such as the handling of global configuration properties) may be relocated into new modules. It is therefore important that no new code features be introduced which are dependent on the core module functionality.

# The central stack modules : web, service, persistence

Three maven modules make up the central stack of the new web API implementation.

  • web : define Web API request handlers, map endpoints, select services
  • service : call persistence module or utils, apply business logic
  • persistence : retrieve data from database. Two submodules:

# Other modules

  • model : data model POJO classes (used throughout the stack)
  • security : user authentication methods and authorization, request filters
  • business : a legacy refactor of webservice.do, has active dataSource definition
  • portal : web application packaging and launch
  • scripts : data import tool packaging (from core module scripts package)
  • db_scripts : installation and migration scripts for the database

# External code modules

cbioportal-frontend is packaged in the web application as a default frontend implementation, but the source of the frontend code can also be directed to an external source host and be deployed independently of the backend web application. See details

session-service is imported into the web module in order to set up a proxy service which receives and forwards requests for saved cBioPortal sessions to a separate system providing this storage (using a document based database) The code is needed for handling modeled types such as VirtualStudy and Session

# cBioPortal Module Dependencies

Module Dependencies
Module Dependencies

A module is directly dependent on all modules which touch it from below (touching only at a corner does not count). Dependencies are transitive : web is dependent on service, service is dependent on persistence-mybatis, therefore web is also dependent on persistence-mybatis. During packaging, all dependencies are made available to the dependent package for use. Avoid creating new dependencies between modules. cyclical dependencies will cause errors during build

Module Dependencies
portal core, cbioportal-frontend
scripts core
core web
web business, service, session-service
security-spring service
service persistence-mybatis
persistence-mybatis persistence-api, db-scripts
persistence-api model
business model
db-scripts
model