A comprehensive analytics platform for the Stellar blockchain with real-time data ingestion, GraphQL API, and React visualization dashboard.
- Real-time Data Ingestion: Continuously polls Stellar Horizon API for ledgers, transactions, and operations
- GraphQL API: High-performance API with complex aggregations and analytics queries
- React Dashboard: Modern, responsive analytics interface with real-time charts
- Soroban Support: Track smart contract deployments and interactions
- DEX Analytics: Monitor asset volumes, liquidity pools, and trading activity
- Account Profiling: Track account activity, balances, and portfolio performance
- Transaction Explorer: Detailed transaction analysis with XDR decoding
stellar-analytics-dashboard/
βββ packages/
β βββ shared/ # Shared types and utilities
β βββ indexer/ # Node.js data ingestion service
β βββ api/ # Express GraphQL server
β βββ frontend/ # React analytics dashboard
βββ docker-compose.yml # Production deployment
βββ docker-compose.dev.yml # Development setup
βββ README.md
- Indexer: Polls Horizon API, stores data in PostgreSQL, provides real-time updates
- API: GraphQL server with analytics queries, caching, and subscriptions
- Frontend: React dashboard with real-time charts and data visualization
- Database: PostgreSQL for analytics data, Redis for caching
- Node.js 18+
- Docker & Docker Compose
- pnpm (recommended) or npm
-
Clone the repository
git clone https://github.com/Kevin737866/stellar-analytics-dashboard.git cd stellar-analytics-dashboard -
Install dependencies
npm install -g pnpm pnpm install
-
Start development environment
# Start databases only docker-compose -f docker-compose.dev.yml up -d # Install dependencies and start services pnpm dev
-
Access the applications
- Frontend: http://localhost:3000
- GraphQL API: http://localhost:4000/graphql
- Indexer Health: http://localhost:3001/health
-
Build and deploy with Docker
docker-compose up -d
-
Access the applications
- Frontend: http://localhost:3000
- GraphQL API: http://localhost:4000/graphql
- Indexer: http://localhost:3001
The GraphQL API provides access to all Stellar analytics data. Key queries include:
# Get network statistics
query GetStats {
stats {
totalTransactions
totalAccounts
volume24h
successRate24h
latestLedger
}
}
# Get recent transactions
query GetTransactions($first: Int = 20) {
transactions(pagination: { first: $first }) {
edges {
node {
hash
successful
sourceAccount
feeCharged
createdAt
operationCount
}
}
}
}
# Get account details
query GetAccount($accountId: String!) {
account(accountId: $accountId) {
accountId
balance
sequenceNumber
numSubentries
thresholds
}
}subscription OnNewLedger {
ledgerAdded {
sequence
closedAt
operationCount
successfulTransactionCount
}
}- Dashboard: Overview of network metrics and activity
- Network: Detailed network performance analytics
- Accounts: Account explorer and profiling
- Transactions: Transaction search and analysis
- Assets: Asset analytics and DEX metrics
DATABASE_URL=postgresql://user:password@localhost:5432/stellar_analytics
REDIS_URL=redis://localhost:6379
STELLAR_NETWORK=public
STELLAR_HORIZON_URL=https://horizon.stellar.org
PORT=3001
NODE_ENV=development
LOG_LEVEL=infoDATABASE_URL=postgresql://user:password@localhost:5432/stellar_analytics
REDIS_URL=redis://localhost:6379
PORT=4000
NODE_ENV=development
CORS_ORIGIN=http://localhost:3000
LOG_LEVEL=infoVITE_API_URL=http://localhost:4000/graphql
VITE_WS_URL=ws://localhost:4000/graphqlThe application uses PostgreSQL with the following main tables:
ledgers: Stellar ledger datatransactions: Transaction records- `operations: Operation details
accounts: Account informationassets: Asset metadatanetwork_metrics: Aggregated network statisticsasset_metrics: Asset-specific analyticsaccount_metrics: Account activity metrics
# Root level
pnpm dev # Start all services in development
pnpm build # Build all packages
pnpm test # Run all tests
pnpm lint # Lint all packages
# Individual packages
pnpm --filter @stellar-analytics/indexer dev
pnpm --filter @stellar-analytics/api dev
pnpm --filter @stellar-analytics/frontend dev# Run migrations
pnpm --filter @stellar-analytics/indexer db:migrate
# Seed with initial data
pnpm --filter @stellar-analytics/indexer db:seed- Shared Types: Add new types to
packages/shared/src/types/ - Database Schema: Update
packages/indexer/src/database/schema.sql - API Resolvers: Add resolvers to
packages/api/src/resolvers/ - Frontend Components: Add components to
packages/frontend/src/components/
- Indexer:
GET /health - API:
GET /health - Database: PostgreSQL health check
- Redis:
PINGcommand
- Prometheus-compatible metrics at
/metrics - Application logs in structured JSON format
- Performance monitoring with Apollo Studio (optional)
- Input validation with Zod schemas
- SQL injection prevention with parameterized queries
- Rate limiting on API endpoints
- CORS configuration
- Environment variable management
- Non-root Docker containers
# Run all tests
pnpm test
# Run tests for specific package
pnpm --filter @stellar-analytics/api test
# Run with coverage
pnpm test --coverage- Production:
https://your-domain.com/graphql - Development:
http://localhost:4000/graphql
- Health Check:
GET /health - Metrics:
GET /metrics
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Use ESLint and Prettier formatting
- Write tests for new features
- Update documentation
- Use conventional commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Stellar Development Foundation for the amazing blockchain
- Stellar SDK for excellent developer tools
- Apollo GraphQL for powerful GraphQL tools
- React for the frontend framework
- Recharts for beautiful charts
- Create an issue on GitHub for bug reports
- Join our Discord community for discussions
- Check the documentation for common questions
Built with β€οΈ for the Stellar ecosystem