Skip to content

openpra-org/openpra-monorepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenPRA monorepo

DOI

Welcome to the OpenPRA monorepo, the unified codebase for the v2 OpenPRA App, which includes the web client, backend REST APIs, distributed microservices, wrappers for underlying C/C++ quantification engines, shared JSON schema definitions, and utility packages for automated PRA model generation.

Internal Packages

Included within this monorepo are the following packages:

  • engine-scram-node: Node.js wrappers for the SCRAM C/C++ engine.
  • frontend-web-editor: A React v18 and TypeScript-based frontend UI.
  • mef-schema: OpenPRA MEF JSON Schema definitions, generated using the shared-types package.
  • microservice-job-broker: RabbitMQ based distributed queues for scaling quantification requests.
  • model-generator: A tool for creating synthetic PRA models.
  • shared-types: Shared TypeScript type definitions, serving as the single source of truth for all data types.
  • web-backend: A NestJS REST-API backend service written in TypeScript.

We're managing this monorepo using the Nx build system, which enables flexible package bundling. For instance, the mef-schema package centralizes the OpenPRA-MEF (Model Exchange Format) JSON definitions, generated from the TypeScript definitions specified in the shared-types package.

Quick Start Guide

Follow these steps to set up and run the project.

Prerequisites

Make sure you have the following tools installed on your system:

  • Node.js v20.17.0 (managed via nvm)
  • pnpm (Package Manager)
  • MongoDB

Installation

1. Install nvm (Node Version Manager)

macOS and Linux

Run the following command in your terminal:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

After installation, restart your terminal or run source ~/.bashrc (or source ~/.zshrc for Zsh).

Windows

Download and run the nvm Windows installer.

2. Install node

Once installed, nvm can be used to download and use the node version of choice. Install it using nvm with the following commands:

nvm install 20.17.0
nvm use 20.17.0

3. Install pnpm (Package Manager)

macOS and Linux

Run:

curl -fsSL https://get.pnpm.io/install.sh | sh -

Ensure pnpm is added to your PATH. You may need to restart your terminal or run source ~/.bashrc.

Windows

Run:

npm install -g pnpm

4. Install MongoDB

Follow the official MongoDB installation guide for your operating system:

Setup

Once prerequisites are installed, initialize the project with these commands:

pnpm setup
pnpm install
pnpm install --global nx@19.6.2

Running the Project

Start All Services Concurrently

To serve all packages at once, run:

nx run-many -t serve --all

Start Individual Services

To serve a specific package, run:

  • Web Editor:

    nx serve frontend-web-editor
  • Web Backend:

    nx serve web-backend

Testing and Linting

Run Tests

Execute Jest unit tests:

nx run-many -t test

Run Linting

Check code quality with ESLint:

nx run-many -t lint

Additional Documentation

Additional documentation can be found in the Extended README section.


Citation

@software{openpra_initiative_2024_10891408,
  author       = {OpenPRA Initiative},
  title        = {openpra-org/openpra-monorepo},
  month        = mar,
  year         = 2024,
  publisher    = {Zenodo},
  version      = {v0.1.1},
  doi          = {10.5281/zenodo.10891408},
  url          = {https://doi.org/10.5281/zenodo.10891408}
}

License

MIT