Skip to content

About

Open-source analytics dashboard for Stellar DeFi protocols

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stellar DeFi Analytics πŸ“Š

CI License: MIT Next.js TypeScript PRs Welcome GitHub issues GitHub stars

An open-source analytics dashboard for Stellar DeFi protocols. Track liquidity pools, DEX volumes, lending protocols, and more with real-time data visualization.

Documentation site: Stellar DeFi Analytics field guide

Prototype status: account-balance reads can use Horizon, but TVL and asset prices currently use placeholders, portfolio results use sample trades, and the price stream is not live. A hosted interactive demo is not currently available; run the app locally using the instructions below. Do not rely on current output for investment, tax, or accounting decisions.

Version: 0.1.0 | Changelog | API Docs

🎯 Overview

Stellar DeFi Analytics provides comprehensive insights into the Stellar DeFi ecosystem:

  • Real-time Metrics: Live data from Stellar DeFi protocols
  • Liquidity Tracking: Monitor liquidity pools and LP positions
  • DEX Analytics: Trade volumes, prices, and market depth
  • Protocol Metrics: TVL, user counts, transaction volumes
  • Historical Data: Charts and trends over time
  • Portfolio Tracking: Track your DeFi positions across protocols

πŸš€ Features

  • πŸ“ˆ Interactive Charts - Powered by Recharts with responsive design
  • πŸ”„ Real-time Updates - Live data with automatic refresh
  • 🎨 Modern UI - Built with Next.js 14 and Tailwind CSS
  • πŸ“± Responsive - Works seamlessly on desktop and mobile
  • 🌐 Multi-Protocol Support - Aggregates data from multiple Stellar DeFi protocols
  • πŸ’Ύ Data Export - Export analytics data to CSV/JSON
  • πŸ” Search & Filter - Find specific pools, tokens, or protocols quickly
  • 🎯 Custom Dashboards - Create personalized views

πŸ“¦ Installation

# Clone the repository
git clone https://github.com/HyperDevTools/stellar-defi-analytics.git
cd stellar-defi-analytics

# Install dependencies
npm install
# or
yarn install
# or
pnpm install

# Run development server
npm run dev

Open http://localhost:3000 to view the dashboard.

πŸ”§ Configuration

Create a .env.local file in the root directory:

# Stellar Network
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org

# Optional: RPC endpoints for faster data access
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org

# Analytics Configuration
NEXT_PUBLIC_REFRESH_INTERVAL=30000
NEXT_PUBLIC_HISTORICAL_DAYS=30

πŸ“š Usage

Dashboard Overview

The main dashboard provides:

  • Total Value Locked (TVL) across all protocols
  • 24h trading volumes
  • Top performing tokens
  • Recent transactions
  • Protocol breakdowns

Liquidity Pools

View and analyze liquidity pools:

import { useLiquidityPools } from '@/hooks/useLiquidityPools';

export default function PoolsPage() {
  const { pools, isLoading } = useLiquidityPools();

  return (
    <div>
      {pools.map(pool => (
        <PoolCard key={pool.id} pool={pool} />
      ))}
    </div>
  );
}

DEX Analytics

Track DEX trading activity:

import { useDexVolume } from '@/hooks/useDexVolume';

export default function DexPage() {
  const { volume, history } = useDexVolume('24h');

  return (
    <VolumeChart data={history} totalVolume={volume} />
  );
}

Portfolio Tracking

Monitor your DeFi positions:

import { usePortfolio } from '@/hooks/usePortfolio';

export default function Portfolio() {
  const { positions, totalValue } = usePortfolio(walletAddress);

  return (
    <PortfolioSummary positions={positions} total={totalValue} />
  );
}

πŸ—οΈ Architecture

stellar-defi-analytics/
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ layout.tsx         # Root layout
β”‚   β”œβ”€β”€ page.tsx           # Home page
β”‚   β”œβ”€β”€ pools/             # Liquidity pools pages
β”‚   β”œβ”€β”€ dex/               # DEX analytics pages
β”‚   └── portfolio/         # Portfolio tracking pages
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ charts/           # Chart components
β”‚   β”œβ”€β”€ cards/            # Card components
β”‚   └── layout/           # Layout components
β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ useLiquidityPools.ts
β”‚   β”œβ”€β”€ useDexVolume.ts
β”‚   └── usePortfolio.ts
β”œβ”€β”€ lib/                  # Utility libraries
β”‚   β”œβ”€β”€ stellar.ts       # Stellar SDK utilities
β”‚   β”œβ”€β”€ api.ts           # API client
β”‚   └── formatters.ts    # Data formatters
β”œβ”€β”€ services/             # Data services
β”‚   β”œβ”€β”€ horizon.ts       # Horizon API service
β”‚   β”œβ”€β”€ soroban.ts       # Soroban RPC service
β”‚   └── protocols/       # Protocol-specific services
└── types/               # TypeScript types
    β”œβ”€β”€ pool.ts
    β”œβ”€β”€ token.ts
    └── transaction.ts

πŸ§ͺ Testing

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type checking
npm run type-check

πŸ—οΈ Build & Deploy

Development Build

npm run dev

The app will be available at http://localhost:3000

Production Build

# Build for production
npm run build

# Start production server
npm start

CI/CD

This project uses GitHub Actions for continuous integration:

  • Automated Testing: Runs on every push and pull request
  • Multi-Version Testing: Tests against Node.js 18.x and 20.x
  • Type Checking: Ensures TypeScript correctness
  • Linting: Enforces code quality standards
  • Security Scanning: Checks for vulnerabilities with npm audit
  • Build Verification: Ensures the app builds successfully

View the CI configuration for details.

🎨 Customization

Adding New Protocols

  1. Create a new service in services/protocols/:
// services/protocols/myprotocol.ts
export class MyProtocolService {
  async getTVL(): Promise<number> {
    // Fetch TVL data
  }

  async getPools(): Promise<Pool[]> {
    // Fetch pools
  }
}
  1. Register the protocol in lib/protocols.ts:
import { MyProtocolService } from '@/services/protocols/myprotocol';

export const protocols = {
  myprotocol: new MyProtocolService(),
  // ... other protocols
};

Custom Charts

Create custom charts using Recharts:

import { LineChart, Line, XAxis, YAxis } from 'recharts';

export function CustomChart({ data }) {
  return (
    <LineChart data={data}>
      <XAxis dataKey="time" />
      <YAxis />
      <Line type="monotone" dataKey="value" stroke="#8884d8" />
    </LineChart>
  );
}

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Write/update tests
  5. Run linter and tests
  6. Submit a pull request

πŸ“‹ Roadmap

  • Lending protocol analytics
  • Yield farming metrics
  • Token price alerts
  • Advanced charting (candlesticks, depth charts)
  • Historical data export
  • Mobile app
  • Multi-chain support
  • Social features (shared dashboards)
  • API for third-party integrations

πŸ” Security

  • All data is read-only from public blockchain sources
  • No private keys are stored or transmitted
  • Wallet connections use standard Stellar wallet adapters
  • Security audits welcome - please report issues responsibly

πŸ“„ License

MIT License - see LICENSE for details

πŸ”— Links

πŸ’¬ Support

  • Open an issue for bug reports or feature requests
  • Join our community discussions
  • Contribute to the codebase
  • Star the repo if you find it useful!

πŸ™ Acknowledgments

Built with:


Made with ❀️ by HyperDevTools

About

Open-source analytics dashboard for Stellar DeFi protocols

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages