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.
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.
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.gitInstall Node.js dependencies:
npm installNote: Highly recommended to have installed NVM (Node Version Manager)
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 devRunning the backend for production
npm startImportant 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
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:
- Open your backend folder on VS Code, and install the official Vitest extension.
- Pop up a terminal and let's start testing.
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:uiWe currently have unitary and integration tests on this backend, and you can easily run them with:
Run all the unitary tests
npm run test:unitRun all the integration tests
npm run test:integrationYou can also test with:
Run all the tests
npm run testRun only a test file
npm test 'filepath'We've also added istanbul to integrate code coverage.
Running coverage on all files.
npm run coverageRunning coverage on one single file.
npm run coverage 'filepath'