Make sure that you have installed:
Docker
docker --version
Docker compose
docker compose version
Make
make --version
Install pnpm
:
npm add -g pnpm
Install dependencies:
pnpm install
To setup your local development environment, run:
make setup
This will create the necessary images/containers, as well as the necessary indexes/mappings for Elasticsearch.
To view the sample ES documents, from the two indexes, run:
curl -XGET localhost:9200/listings/_search | jq
curl -XGET localhost:9200/alerts/_search | jq
To start indexing NFTStorefrontV2
events from the Flow blockchain, we have to run the indexer:
make index-events
You can view how many documents have been indexed to the listings
index, by running:
curl -XGET localhost:9200/listings/_count | jq
make start-api
There are 3 available endpoints:
- View alerts for an address,
- Create a new alert for an address,
- Remove an alert for an address
curl -XGET 'localhost:3001/alerts/0x9a0766d93b6608b7' -H "Content-Type: application/json" | jq
curl -XPOST localhost:3001/alerts/ -H "Content-Type: application/json" -d @packages/elastic/alerts-document-2.json
curl -XDELETE 'localhost:3001/alerts/132/0xee82856bf20e2c07' -H "Content-Type: application/json"
make start-client
Will run the React dev server
There are more Make
recipes, than listed above, to assist with local development:
- Delete the
listings
index and its documents
make delete-es-index
- Setup the
listings
index and its mapping
setup-es-index
- Stop the running
Elasticsearch
andKibana
containers
make stop-containers
- Start the
Elasticsearch
andKibana
containers
start-containers