The Mock Data Holder (NodeJS) is a reference implementation of a CDR Data Holder solution, designed to support the Consumer Data Right (CDR) implementation journey. It aims to assist CDR participants in developing their own Data Holder (DH) systems that comply with Consumer Data Standards. The system consist of a number of docker containers, some of which are maintained by the ACCC, others are maintained by the Data Standards Body.
The Data Standards Body provides relevant docker images in the DockerHub. You can skip the local setup and run the images to get a Mock CDR Environment running on your computer, including a Mock Data Holder (NodeJS), an auth server, a Mock Data Recipient and a Mock Register. For more information, refer to the Quick Start with Docker Compose section below.
You can also set up a local instance of the Mock Data Holder (NodeJS) for customised and extended use cases. For more information, refer to the Local Setup and Customisation section below.
You can easily interact with and explore CDR APIs using the Mock ADR, or using our comprehensive Postman collection.
This solution:
- is maintained regularly to ensure compatibility with the latest Consumer Data Standards.
- assists Data Holders with regulatory adherence through accurate request and response simulations.
- provides Docker Support to simplify deployment and testing across various environments, with ready-to-use Docker images available on DockerHub, eliminating the need for local builds.
- strictly follows the CDS Guidelines for handling the request and response HTTP headers accurately.
- utilises the NPM package to include the CDS-specific Type Definitions, maintained by the DSB.
- utilises the Holder SDK NPM package, maintained by the DSB.
- utilises test data generated by DSB’s Test Data CLI Tool for populating the database to mimic various real-world scenarios for thorough testing.
-
Download the Docker Compose file from this link.
-
Download the Docker environment file from this link into the same folder.
-
Open a terminal and navigate to the directory where the Docker Compose file is located.
-
Navigate to the root directory of the repository and the run the following command to start the services defined in the Docker Compose file:
docker-compose -f docker-compose.yaml up -d
This command will automatically pull the necessary Docker images and create the containers required for the Mock Data Holder, setting up everything you need to get started without manually handling the code repository.
-
Open your web browser and navigate to the desired API endpoints using https://localhost:8082 as the base URL for the Mock Data Holder (NodeJS) application. For example, you can obtain a list of energy plans from https://localhost:8082/cds-au/v1/energy/plans.
-
To obtain a new access token required to call the resource APIs, navigate to https://localhost:9001 to initiate the PAR login sequence. This access token can then be used for API access, for instance, with the DSB Postman collection.
This is an alternative and simplified run mode. In this mode the mock-data-holder simply serves the API. No valid token is required, the assumed user is set in the environment file, and all accounts for that user are assumed to have been given consent.
If an access token is found the request header and a scopes
property (space delimted string) is found, then these scopes will be used. If no token is found, then all scopes are assumed to be valid.
To run in this mode
-
Download the Docker Compose file (noauth) from this link.
-
Download the Docker environment (noauth) file from this link into the same folder.
docker-compose -f docker-compose.noauth.yaml up -d
Note the additional setting NO_AUTH_SERVER="true"
in the .env.noauth file
-
Docker
- Docker installed (verified with v 24.0.2)
- Docker Compose installed (verified with v2.19.1)
-
Trusted Certificates
All certificates used with this ecosystem have been generated with the CA which can be found in
security\\cdr-auth-server\\nginx\\ssl
.The CA certificate in this folder needs to be trusted by your browser, ie be a "Trusted CA". Dependent on which OS, what security settings, and other parameters this may differ for each user.
-
Host file entries
A number of entries are required in the
host
file. These entries typically are in C:\Windows\System32\drivers\etc\hosts on Windows platforms, /etc/hosts on UNIX/Linux and /private/etc/hosts on MacOS (although this may be different).- 127.0.0.1 mock-data-holder
- 127.0.0.1 mock-data-recipient
- 127.0.0.1 mock-data-holder-energy
- 127.0.0.1 mock-register
- 127.0.0.1 mtls-gateway
- 127.0.0.1 tls-gateway
- 127.0.0.1 authserver-ui
- 127.0.0.1 cdr-auth-server
-
NodeJS (verified with v18.19.0)
-
Create a fork of this repository. To do this, click the "Fork" button on the top right corner of this page.
-
After forking the repository, clone it to your local machine. You can do this by running the following command in your terminal or command prompt:
git clone <https://github.com/your-username/project-name.git>
Replace
your-username
with your GitHub username andproject-name
with the name of your repository. -
Once the repository is cloned, navigate to the project directory by running:
cd project-name
Replace
project-name
with the name of the repository.
- Customise the data holder project as needed for your specific use case.
- Navigate to the project directory and execute the following command:
npm run build
Note: A custom build can be run from any debug environment and will interact with the other containers (eg databases).
-
Navigate to the root directory of the repository and the run the following command to start the services defined in the Docker Compose file:
docker-compose up
This command will automatically pull the necessary Docker images and create the containers required for the Mock Data Holder, setting up everything you need to get started without manually handling the code repository.
-
Now stop the Mock data holder container by running the following command:
docker stop mock-data-holder
-
Start the development server by running the following command in the project directory:
npm start
-
Open your web browser and navigate to http://localhost:9001 to access the Mock Data Recipient application. This application can be used to generate an access token required to access the API.
We welcome contributions from the community! If you'd like to contribute to this project, please follow these simple steps:
-
Create a new branch for your work from the
master
branch:git checkout -b feature/your-feature-name
-
Begin making your changes or contributions.
-
Follow the instructions in the project repository to run and test your changes locally.
-
Commit your changes with clear and concise commit messages.
-
Push your changes to your forked repository.
-
Open a pull request (PR) using the
master
branch in the original repository as the destination branch. Include a detailed description of your changes and the problem you are addressing. -
Engage in the discussion on your PR and make any necessary adjustments based on feedback from maintainers and other contributors.
-
Once your PR is approved and all tests pass, it will be merged into the project.
- Please ensure your contributions align with our project's objectives and guidelines.
Our Postman collection includes pre-configured environments and requests that mirror typical interactions with our Mock Data Holder's APIs, and allows us to test functionality, response formats, and error handling seamlessly.
Encountered an issue? We're here to help. Please visit our issue reporting guidelines for submitting an issue.
Join our newsletter to receive the latest updates, release notes, and alerts. Subscribe here.
The artefact is released under the MIT License, which allows the community to use and modify it freely.
The artefacts in this repository are offered without warranty or liability, in accordance with the MIT licence.
The Data Standards Body (DSB) develops these artefacts in the course of its work, in order to perform quality assurance on the Australian Consumer Data Right Standards (Data Standards).
The DSB makes this repository, and its artefacts, public on a non-commercial basis in the interest of supporting the participants in the CDR ecosystem.
The resources of the DSB are primarily directed towards assisting the Data Standards Chair for developing the Data Standards.
Consequently, the development work provided on the artefacts in this repository is on a best-effort basis, and the DSB acknowledges the use of these tools alone is not sufficient for, nor should they be relied upon with respect to accreditation, conformance, or compliance purposes.