Skip to content

statuscompliance/status-backend

Repository files navigation

A Business Process Compliance Management System

Coverage Status Duplicated Lines (%) Maintainability Rating Technical Debt Ask DeepWiki

Introduction

This repository is the backend of Status Compliance Project. Its primary function is to provide the business logic, data management, and APIs necessary for the system's various functionalities, such as compliance automation, controls catalog management, and design-time & run-time compliance checking, providing a straight-foward automation experience.

This backend integrates with other parts of the system, including web interfaces and specific services like the registry (bluejay-registry) and Node-RED workflows.

Status Compliance Infrastructure

Important Annotation: For more information about the proyect infrastructure, you can check the Infrastructure repository.

📚 Tech Stack

We are using the MERN stack exclusively for this backend, which is built using the following technologies:

  • MongoDB: NoSQL document database for flexible data storage.
  • Express: Minimalist and flexible Node.js web application framework.
  • React: Open Source Javascript library for flexible UI design.
  • Node.js: JavaScript runtime environment for server-side execution.

By follwoing this tech-stack, we deliver the following features:

  • API Management: Provides RESTful APIs for interaction with the user interface and other services.
  • Business Logic: Implements the rules and logic for compliance verification and management.
  • Database Integration: Facilitates reading and writing data to MySQL and MongoDB.
  • Redis Communication: Utilizes Redis for caching and real-time data management.
  • Registry Integration: Enables the management and access of compliance catalog computations. Using bluejay-registry.
  • Node-RED Integration Support: Offers the necessary endpoints for interaction with compliance workflows defined in Node-RED.
  • Potential Blockchain Integration: Lays the groundwork for immutable verification of compliance checks.

🔧Installing the Backend

Let's setup your enviroment, so you can easily install this repository locally on your machine:

Note

  • Be sure you have Node.js installed (v.22.12.0).
  • Be sure to have Docker installed on your machine.
  • Be sure to install the main Infrastructure of Status Compliance Proyect via Docker.

Clone the Repository:

git clone https://github.com/statuscompliance/status-backend.git

Install Node.js dependencies:

 npm install

Note: Highly recommended to have installed NVM (Node Version Manager)

🏃‍♂️Running the Backend

Important Annotation: Be sure you first run npm ci or npm install so you have correctly installed all the node modules used on the backend.

After finishing installing the backend and the infrastructure, you can finally run the backend:

Running the backend for development

npm run dev

Running the backend for production

npm start

Important Annotation: Be sure you stop the status-backend container on your docker-compose infrastructure.

Be sure to also configure your .env file with all the other containers ports, and other configuration, so you have succesfully connected the backend with the infrastructure

🧪 Testing the Backend

Important Annotation: Be sure you first run npm ci or npm install so you have correctly installed all the node modules used on the backend.

Developer alvarobernal2412 have implemented the Vitest framework for testing the backend.

After you succesfully installed the backend and the infrastructure, we'll give you a quick guide about how to run some tests:

  1. Open your backend folder on VS Code, and install the official Vitest extension.
  2. Pop up a terminal and let's start testing.

Testing with Vitest's web ui

Vitests has a great testing UI, wich you can easily deploy right on your web browser with:

Run tests with the UI

npm run test:ui

Testing With the Terminal

We currently have unitary and integration tests on this backend, and you can easily run them with:

Run all the unitary tests

npm run test:unit

Run all the integration tests

npm run test:integration

You can also test with:

Run all the tests

npm run test

Run only a test file

npm test 'filepath'

Running Tests with Coverage

We've also added istanbul to integrate code coverage.

Running coverage on all files.

npm run coverage

Running coverage on one single file.

npm run coverage 'filepath'

About

Backend of the project status

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 7