This document provides instructions for setting up and running the NestJS backend for the CDMS project.
This backend service provides REST APIs that interact with a Hyperledger Fabric blockchain for on-chain data and MinIO for off-chain encrypted file storage. The system is designed to connect law enforcement (Org1) and non - police (Org2) organizations.
Detailed Setup Guide: Refer to the complete step-by-step instructions in the PDF available here: [https://drive.google.com/file/d/1IL2ofHtzavJ69p9TSUYH7BD4KFO_O0vc/view?usp=drive_link]
Demo Video: Watch the setup and execution demo here: [https://drive.google.com/file/d/1B99f9jyfzrwNJm850XG8fRZxdl7kESn_/view?usp=sharing]
Note: All project code is located in the
v2branch.
Before starting the backend, verify that the following external services are running and accessible:
- Hyperledger Fabric: The blockchain network must be running.
- Vault: The Vault server must be running and setup for transit (e.g.,
http://localhost:8200). - MinIO: The MinIO server must be running and setup for storing (e.g.,
http://localhost:9001).
Important: The chaincode (e.g., cdms.go) is not part of this backend. It must be deployed and instantiated on your Hyperledger Fabric network before starting the backend.
Create a .env file in the root of the backend project with the following content:
# --- MinIO Configuration ---
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_ACCESS_KEY=<admin>
MINIO_SECRET_KEY=<password>
MINIO_USE_SSL=false
MINIO_BUCKET_NAME=<cdms-records>
# --- Vault Configuration ---
VAULT_ADDR=http://localhost:8200
VAULT_TOKEN=<token>
# --- Application Configuration ---
PORT=3000The backend requires connection profiles and admin certificates to communicate with the Fabric network.
- Create a folder in the backend root named:
fabric-config - Copy and rename the required files from your
fabric-samplestest network directory into thisfabric-configfolder.
| Source Path (from fabric-samples) | Destination (in fabric-config) | Rename To |
|---|---|---|
test-network/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk |
fabric-config/ |
key.pem |
test-network/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected] |
fabric-config/ |
[email protected] |
test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt |
fabric-config/ |
tls-root-cert.pem |
test-network/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore/priv_sk |
fabric-config/ |
key-org2.pem |
test-network/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected] |
fabric-config/ |
[email protected] |
test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt |
fabric-config/ |
tls-root-cert-org2.pem |
Install the required Node.js packages.
npm installStart the NestJS server in development mode.
npm run start:devThe backend will be running at: