REST API facade template for microservices that interacts with the MultiversX blockchain.
- Run
npm install
in the project directory - Optionally make edits to
config/config.yaml
and/or.env
files
- Redis Server is required to be installed docs.
- MySQL Server is required to be installed docs.
- MongoDB Server is required to be installed docs.
You can run docker-compose up
(or docker-compose up -d
as detached) in a separate terminal to use a local Docker container for all these dependencies.
After running the sample, you can stop the Docker container with docker-compose down
Endpoints that can be used by anyone (public endpoints).
Endpoints that are not exposed on the internet For example: We do not want to expose our metrics and cache interactions to anyone (/metrics /cache)
This is used to keep the application cache in sync with new updates.
This is used for scanning the transactions from MultiversX Blockchain.
This is used for concurrently processing heavy jobs.
You can find a predefined Grafana dashboard with basic metrics at http://localhost:3010
Use admin
for user and password fields. Then navigate to Dashboards
-> Template Service
This is a MultiversX project built on Nest.js framework.
In order to simplify the scripts, the templates will use the following environment variables:
NODE_ENV
Description: Defines the environment in which the application runs. This influences various configuration settings.
Possible Values: mainnet
, testnet
, devnet
, infra
Usage: Determines the environment-specific configurations and behaviors of the application.
NODE_APP
Description: Specifies which part of the application to start.
Possible Values: api
, cache-warmer
, transactions-processor
, queue-worker
Usage: Selects the specific application module to run.
NODE_DEBUG
Description: Enables or disables development debug mode.
Possible Values: true
, false
Usage: When set to true, the application starts in debug mode, useful for development.
NODE_WATCH
Description: Enables or disables development watch mode.
Possible Values: true
, false
Usage: When set to true, the application starts in watch mode, which automatically reloads the app on code changes.
Runs the app in the production mode. Make requests to http://localhost:3001.
Redis Server is required to be installed.
# development watch mode on devnet
$ NODE_ENV=devnet NODE_APP=api NODE_WATCH=true npm run start
or
$ NODE_ENV=devnet NODE_WATCH=true npm run start:api
# development debug mode on devnet
$ NODE_ENV=devnet NODE_APP=api NODE_DEBUG=true npm run start
or
$ NODE_ENV=devnet NODE_DEBUG=true npm run start:api
# development mode
$ NODE_ENV=devnet NODE_APP=api npm run start
or
$ NODE_ENV=devnet npm run start:api
# production mode
$ NODE_ENV=mainnet NODE_APP=api npm run start
or
$ NODE_ENV=mainnet npm run start:api
# development watch mode on devnet
$ NODE_ENV=devnet NODE_APP=transactions-processor NODE_WATCH=true npm run start
or
$ NODE_ENV=devnet NODE_WATCH=true npm run start:transactions-processor
# development debug mode on devnet
$ NODE_ENV=devnet NODE_APP=transactions-processor NODE_DEBUG=true npm run start
or
$ NODE_ENV=devnet NODE_DEBUG=true npm run start:transactions-processor
# development mode on devnet
$ NODE_ENV=devnet NODE_APP=transactions-processor npm run start
or
$ NODE_ENV=devnet npm run start:transactions-processor
# production mode
$ NODE_ENV=mainnet npm run start:transactions-processor
# development watch mode on devnet
$ NODE_ENV=devnet NODE_APP=queue-worker NODE_WATCH=true npm run start
or
$ NODE_ENV=devnet NODE_WATCH=true npm run start:queue-worker
# development debug mode on devnet
$ NODE_ENV=devnet NODE_APP=queue-worker NODE_DEBUG=true npm run start
or
$ NODE_ENV=devnet NODE_DEBUG=true npm run start:queue-worker
# development mode on devnet
$ NODE_ENV=devnet NODE_APP=queue-worker npm run start
or
$ NODE_ENV=devnet npm run start:queue-worker
# production mode
$ NODE_ENV=mainnet npm run start:queue-worker
Requests can be made to http://localhost:3001 for the api. The app will reload when you'll make edits (if opened in watch mode). You will also see any lint errors in the console.
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov