generated from multiversx/mx-template-service
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8782be1
commit 8d3a67e
Showing
2 changed files
with
25 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
NETWORK='mainnet' | ||
|
||
PUBLIC_API_PORT=3000 | ||
PUBLIC_API_PREFIX='dex-screener-adapter' | ||
|
||
PRIVATE_API_PORT=4000 | ||
OFFLINE_JOBS_PORT=4001 | ||
|
||
API_URL='https://api.multiversx.com' | ||
REDIS_URL='127.0.0.1' | ||
ELASTIC_URL='https://index.multiversx.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,46 @@ | ||
REST API facade template for microservices that interacts with the MultiversX blockchain. | ||
# MultiversX DEX Screener Adapter Service | ||
|
||
## Quick start | ||
|
||
1. Run `npm install` in the project directory | ||
2. Optionally make edits to `config.yaml` or create `config.custom.yaml` for each microservice | ||
2. Create `.env.mainnet` or `.env.custom` based on the `.env.example` file | ||
|
||
## Dependencies | ||
|
||
1. Redis Server is required to be installed [docs](https://redis.io/). | ||
2. MySQL Server is required to be installed [docs](https://dev.mysql.com/doc/refman/8.0/en/installing.html). | ||
3. MongoDB Server is required to be installed [docs](https://docs.mongodb.com/). | ||
- Redis Server is required to be installed [docs](https://redis.io/). | ||
|
||
You can run `docker-compose up` 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` | ||
|
||
## Available Features | ||
|
||
These features can be enabled/disabled in config file | ||
|
||
### `Public API` | ||
|
||
Endpoints that can be used by anyone (public endpoints). | ||
|
||
### `Private API` | ||
|
||
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) | ||
|
||
### `Cache Warmer` | ||
|
||
This is used to keep the application cache in sync with new updates. | ||
|
||
### `Transaction Processor` | ||
|
||
This is used for scanning the transactions from MultiversX Blockchain. | ||
|
||
### `Queue Worker` | ||
|
||
This is used for concurrently processing heavy jobs. | ||
|
||
## Available Scripts | ||
|
||
This is a MultiversX project built on Nest.js framework. | ||
|
||
### `npm run start:mainnet` | ||
### `npm run start:api:mainnet` | ||
|
||
| ||
Runs the app in the production mode. | ||
Make requests to [http://localhost:3001](http://localhost:3001). | ||
Make requests to [http://localhost:3000/dex-screener-adapter](http://localhost:3000/dex-screener-adapter). | ||
|
||
Redis Server is required to be installed. | ||
|
||
## Running the api | ||
|
||
```bash | ||
# development watch mode on devnet | ||
$ npm run start:devnet:watch | ||
|
||
# development debug mode on devnet | ||
$ npm run start:devnet:debug | ||
|
||
# development mode on devnet | ||
$ npm run start:devnet | ||
|
||
# production mode | ||
$ npm run start:mainnet | ||
``` | ||
|
||
## Running the transactions-processor | ||
|
||
```bash | ||
# development watch mode on devnet | ||
$ npm run start:transactions-processor:devnet:watch | ||
# development debug mode on mainnet | ||
$ npm run start:api:mainnet | ||
|
||
# development debug mode on devnet | ||
$ npm run start:transactions-processor:devnet:debug | ||
|
||
# development mode on devnet | ||
$ npm run start:transactions-processor:devnet | ||
|
||
# production mode | ||
$ npm run start:transactions-processor:mainnet | ||
# development debug mode on a custom network | ||
$ npm run start:api:custom | ||
``` | ||
|
||
## Running the queue-worker | ||
## Running the offline-jobs | ||
|
||
```bash | ||
# development watch mode on devnet | ||
$ npm run start:queue-worker:devnet:watch | ||
|
||
# development debug mode on devnet | ||
$ npm run start:queue-worker:devnet:debug | ||
|
||
# development mode on devnet | ||
$ npm run start:queue-worker:devnet | ||
|
||
# production mode | ||
$ npm run start:queue-worker:mainnet | ||
``` | ||
|
||
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. | ||
|
||
### `npm run test` | ||
|
||
```bash | ||
# unit tests | ||
$ npm run test | ||
|
||
# e2e tests | ||
$ npm run test:e2e | ||
# development debug mode on mainnet | ||
$ start:offline-jobs:mainnet | ||
|
||
# test coverage | ||
$ npm run test:cov | ||
# development debug mode on a custom network | ||
$ start:offline-jobs:custom | ||
``` |