Skip to content

CarmineOptions/derisk-research

Repository files navigation

DeRisk Starknet

Projects overview

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:

Shared

shared Both projects data_handler, dashboard_app work with the same shared database, which is contained in the shared folder. It also contains all shared modules.

Data Handler

data_handler Data processing and analysis component: Collects data from DeFi, analyzes it, and saves it to the db. It contains Celery tasks to schedule data collection runs. Once the data is collected, it triggers an endpoint on the dashboard_app

Dashboard App

dashboard_app Works as a server for the frontend_dashboard. Generates an analytics dashboard using Streamlit. Contains an API to handle the Telegram webhook and send bot messages. Key Features:

  • Interactive data visualization
  • Protocol statistics monitoring
  • Loan portfolio analysis
  • Real-time data updates

Dashboard Frontend

frontend_dashboard React client app. Uses API if the dashboard_app

Outdated and about to be removed

  • web_app - Main web application interface
  • legacy_app - Legacy application functionality

Quick Start Guide

Prerequisites

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

Data Handler 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.dev apps/data_handler/.env
  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

Dashboard App local development

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

  2. Environment Configuration:

cp apps/dashboard_app/.env.dev apps/dashboard_app/.env
  1. Start the Services:
docker-compose -f devops/dev/docker-compose.dashboard-app.yaml up --build
  1. Stop the Services:
docker-compose -f devops/dev/docker-compose.dashboard-app.yaml down

Backend API (FastAPI)

cd apps/dashboard_app
poetry install
cp .env.dev .env  
poetry run uvicorn app.main:app --reload --port 8000

Explore the API will be available at http://localhost:8000/docs.

Frontend App (React + Vite)

Make sure dashboard_app is running!

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