Skip to content

woof-software/comet-rewards-V2

Repository files navigation

code style: prettier

compound-rewards-v2

This application generates merkle tree for Comet incentivization campaigns from present participants and their accrued rewards values. And provides verification info about tree entries

Technologies

Backend

Other

  • jest - automated testing of API
  • OpenAPI 3.0 - API documentation format
  • swagger - to generate HTML documentation
  • Intellij - as development tool
  • pre-commit - to enforce formatter and other policies before commit
  • prettier - to format the code
  • eslint - Find and fix problems in your JavaScript code
  • config - Handle application configs for specific environment

Prerequisites

Install tools for pre-commit validation

Linux

sudo apt-get install -y python3 python3-pip

MacOs

brew install python3
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
brew install curl

No space after hash on atx style header

Install npm

Linux

It's required to install node 20 on ubuntu 22.04

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

Or:

sudo apt install nodejs npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
nvm use 20

MacOs

brew install npm

Install yarn

Linux

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

Or:

sudo npm install -g yarn

MacOs

brew install yarn

Install docker

Linux

sudo apt-get update
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install -y docker-ce

MacOs

Download desktop app docker

This application will install docker compose plugin

Linux

sudo apt-get install docker-compose-plugin

Allow regular user to run docker without sudo

sudo usermod -aG docker ${USER}
sudo usermod -aG www-data ${USER}
sudo chown ${USER} /var/run/docker.sock

You need to reboot or relogin after that

Once rebooted verify that you can run docker commands without sudo.

docker run hello-world

Running API locally

  1. Install all packages
yarn
  1. Start docker containers with databases, RabbitMQ.
yarn docker-dev
  1. Navigate to api package directory, copy and configure env file
cd packages/api;
cp ./.env.xmpl ./.env
  1. Migrate database
yarn migrate
  1. Start application
yarn start

Running API on server

  • Configure PostgreSQL and RabbitMQ services using Dockerfile from corresponding package inside ./packages or configure them manually
  • Don't use anything outside ./packages - it's for local setup
  • Build and run API service from ./packages/api

Helpful scripts

Root package

  • lint - run prettier fix and eslint check
  • docker-dev - build and run local docker containers
  • docker-dev-down - shut down local docker container

API package

  • migrate - run database migrations
  • migrate-dev - run migrations using dev server env
  • migrate-prod - run migrations using prod server env
  • migrate:make - create new knex migration
  • migrate:down - rollback last migration
  • migrate:down-all - rollback all migrations
  • migrate:up-specific - apply specific migration
  • migrate:down-specific - apply specific migration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages