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.
Included within this monorepo are the following packages:
engine-scram-node
: Node.js wrappers for theSCRAM
C/C++ engine.frontend-web-editor
: A React v18 and TypeScript-based frontend UI.mef-schema
: OpenPRA MEF JSON Schema definitions, generated using theshared-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.
Follow these steps to set up and run the project.
Make sure you have the following tools installed on your system:
- Node.js v20.17.0 (managed via nvm)
- pnpm (Package Manager)
- MongoDB
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).
Download and run the nvm Windows installer.
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
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
.
Run:
npm install -g pnpm
Follow the official MongoDB installation guide for your operating system:
- macOS: Install MongoDB on macOS
- Windows: Install MongoDB on Windows
- Linux: Install MongoDB on Linux
Once prerequisites are installed, initialize the project with these commands:
pnpm setup
pnpm install
pnpm install --global nx@19.6.2
To serve all packages at once, run:
nx run-many -t serve --all
To serve a specific package, run:
-
Web Editor:
nx serve frontend-web-editor
-
Web Backend:
nx serve web-backend
Execute Jest unit tests:
nx run-many -t test
Check code quality with ESLint:
nx run-many -t lint
Additional documentation can be found in the Extended README section.
@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}
}
MIT