Skip to content

CarmineOptions/derisk-research

Repository files navigation

DeRisk Starknet

This project consist of a monorepo with components required for the implementation of DeRisk on Starknet. There are several components in this repository, each with its own purpose and functionality. The main components are:

Quick Start Guide

Prerequisites

  • Docker installed on your machine (v19.03+ recommended).
  • Docker Compose installed (v2.0+ recommended).

Data Handler

The data handler component processes and manages data for the DeRisk platform.

Local Development

  1. To set up this project run next command for local development in derisk-research directory:

  2. Environment Configuration:

cp apps/data_handler/.env.example apps/data_handler/.env.dev
  1. Start the Services:
docker-compose -f devops/dev/docker-compose.data-handler.yaml up --build
  1. Stop the Services:
docker-compose -f devops/dev/docker-compose.data-handler.yaml down
  1. To run test cases for this project run next command in derisk-research directory:
make test_data_handler

For detailed documentation, see the Data Handler

Legacy app

The legacy app provides essential functionality for data visualization and analysis through a Streamlit interface.

Local Development

  1. To set up this project run next command for local development in derisk-research directory:
make setup
  1. To run streamlit app run next command in derisk-research directory:
make app
  1. Start Jupyter notebook (optional):
make notebook

For detailed documentation, see legacy_app

Web app (Notification app)

To set up this project run next command for local development in derisk-research directory:

  1. Environment Configuration:
cp apps/web_app/.env.example apps/web_app/.env.dev
  1. Start the Services:
docker-compose -f devops/dev/docker-compose.notification-app.yaml up --build
  1. Stop the Services:
docker-compose -f devops/dev/docker-compose.notification-app.yaml down

Dashboard App

Interactive dashboard application for visualizing and analyzing DeRisk data.

Key Features

  • Interactive data visualization
  • Protocol statistics monitoring
  • Loan portfolio analysis
  • Real-time data updates For detailed documentation, see the Dashboard App

Running Locally

Backend API (FastAPI)

cd apps/dashboard_app
poetry install
cp .env.dev .env  # if you have .env.dev with DB settings
poetry run uvicorn app.main:app --reload --port 8000

The API will be available at http://localhost:8000/api. The notification subscription endpoint is:

POST /api/liquidation-watcher
Content-Type: application/json

{
  "wallet_id": "0x123...",
  "health_ratio_level": 0.5,
  "protocol_id": "Hashstack"
}

Frontend App (React + Vite)

cd apps/frontend_dashboard
npm install
npm run dev

Navigate to http://localhost:5173 to access the subscription form.

CORS & Proxy

The backend is configured with CORS to allow requests from http://localhost:5173, and the Vite dev server proxies /api to the backend.

Shared package (Common code shared between the components)

  1. How to run test cases for shared package, run next command in root folder:
make test_shared

Running the dashboard frontend with Docker

  1. Naviagte to frontend_dashboard directory:

    cd apps/frontend_dashboard
  2. Build the Docker Image:

    docker build -t frontend_dashboard .

    or on linux

    sudo docker build -t frontend_dashboard .
  3. Run the Docker Container::

    docker run -p 5173:5173 frontend_dashboard

    or on linux

    sudo docker run -p 5173:5173 frontend_dashboard
  4. Access the Application: Open your browser and navigate to http://localhost:5173.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 127