MagpieFi Challenge Solution (Nest.js)

A single CRON job (here) is responsible for updating the pairs from thegraph's endpoint. It will run every 30 minutes and will run the first time the server is started.

An HTTP endpoint (/pairs) that fetches all pairs stored in the database is used to validate that the cron is working.

Requirements

Installation

npm install

Usage

# spin up the necessary infrastructure
$ docker compose up -d

# create a development-only environment variables file
$ cp .env.template .env

# generate prisma client
$ npm run generate

# sync the database
$ npm run push

# run in development mode
$ npm run start:dev