Skip to content

UAdamu/astraport-dapp

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AstraPort DApp

Stellar Portfolio Visualization & AI-Driven Insights Platform

AstraPort DApp is the frontend interface for users. It connects to Stellar wallets, visualizes portfolios, and displays AI-driven insights powered by advanced analytics.

Next.js React TypeScript Tailwind CSS


πŸ“‚ Repository Structure

astraport-dapp/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ layout.tsx           # Root layout
β”‚   β”œβ”€β”€ page.tsx             # Home page
β”‚   β”œβ”€β”€ globals.css          # Global Tailwind styles
β”‚   └── not-found.tsx        # 404 page
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   β”œβ”€β”€ wallet/         # Wallet connection (WalletConnect)
β”‚   β”‚   β”œβ”€β”€ dashboard/      # Portfolio overview & charts
β”‚   β”‚   β”œβ”€β”€ risk/           # Risk visualization
β”‚   β”‚   └── insights/       # AI insights display
β”‚   β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useStellarWallet.ts
β”‚   β”‚   β”œβ”€β”€ usePortfolio.ts
β”‚   β”‚   └── useDashboardData.ts
β”‚   β”œβ”€β”€ services/           # API services & integrations
β”‚   β”‚   β”œβ”€β”€ stellar.ts      # Stellar SDK wrapper
β”‚   β”‚   └── portfolio.ts    # Portfolio API client
β”‚   β”œβ”€β”€ store/              # Zustand state management
β”‚   β”œβ”€β”€ types/              # TypeScript type definitions
β”‚   └── utils/              # Utility functions
β”œβ”€β”€ tests/                   # Jest tests
β”œβ”€β”€ examples/                # Code examples & mock data
β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ SETUP.md           # Setup & installation guide
β”‚   └── API.md             # API integration guide
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ package.json            # Dependencies
β”œβ”€β”€ tsconfig.json           # TypeScript config
β”œβ”€β”€ next.config.js          # Next.js config
β”œβ”€β”€ tailwind.config.ts      # Tailwind CSS config
└── jest.config.js          # Jest testing config

πŸ”‘ Core Modules

Wallet πŸ’°

  • Stellar wallet connection (Freighter integration)
  • Account management
  • Network selection (Testnet/Public)

Dashboard πŸ“Š

  • Portfolio overview with key metrics
  • Interactive charts with Chart.js
  • Asset breakdown
  • Performance tracking

Risk ⚠️

  • Overall risk score calculation
  • Volatility analysis
  • Concentration risk metrics
  • Counterparty risk assessment

AI Insights πŸ’‘

  • Portfolio recommendations
  • Risk alerts
  • Optimization suggestions
  • Market insights

πŸš€ Tech Stack

Category Technology
Framework Next.js 14 (App Router)
Language TypeScript 5
UI Library React 18
Styling Tailwind CSS 3
State Management Zustand
Blockchain Stellar SDK 11
Charting Chart.js 4 + D3.js 7
Testing Jest + React Testing Library
Code Quality ESLint, Prettier

⚑ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • A Stellar wallet (e.g., Freighter)

Installation

# Clone repository
git clone https://github.com/Astraportt/astraport-dapp.git
cd astraport-dapp

# Install dependencies
npm install

# Set up environment
cp .env.example .env.local

# Start development server
npm run dev

Open http://localhost:3000 in your browser.

Environment Variables

NEXT_PUBLIC_STELLAR_NETWORK=testnet      # testnet or public
NEXT_PUBLIC_ASTRAPORT_API_URL=https://api.astraport.dev
NEXT_PUBLIC_WALLET_TIMEOUT=300000
API_KEY=your_api_key_here

πŸ“– Documentation


πŸ§ͺ Testing

# Run tests
npm test

# Watch mode
npm run test:watch

# Coverage
npm test -- --coverage

πŸ—οΈ Building

# Development
npm run dev

# Production build
npm run build
npm start

# Type checking
npm run type-check

# Linting
npm run lint

πŸ“‘ API Integration

The DApp communicates with AstraPort Core services:

GET /portfolio/{publicKey}    # Portfolio data
GET /risk/{publicKey}          # Risk metrics
GET /insights/{publicKey}      # AI recommendations

See API Documentation for full details.


🎨 Components

WalletConnect

Handles Stellar wallet connection and account management.

import { WalletConnect } from '@/components/wallet';

export default function App() {
  return <WalletConnect />;
}

PortfolioChart

Interactive portfolio performance visualization.

import { PortfolioChart } from '@/components/dashboard';

export default function Dashboard() {
  return <PortfolioChart />;
}

RiskScoreDisplay

Real-time risk assessment metrics.

import { RiskScoreDisplay } from '@/components/risk';

export default function RiskPanel() {
  return <RiskScoreDisplay />;
}

InsightsList

AI-powered portfolio recommendations.

import { InsightsList } from '@/components/insights';

export default function Insights() {
  return <InsightsList />;
}

πŸͺ Custom Hooks

useStellarWallet

const { connected, account, connectWallet, disconnectWallet } = useStellarWallet();

useDashboardData

const { portfolio, riskScore, insights, loading, errors } = useDashboardData();

usePortfolioData

const { portfolio, loading, error, fetchPortfolio } = usePortfolioData(publicKey);

πŸ“Š Example Data

See examples/ for mock data and integration examples:

  • mockData.ts - Sample portfolio, risk scores, and insights
  • usageDashboard.ts - Dashboard usage examples
  • walletIntegration.ts - Wallet connection examples

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'feat: add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.


πŸ“‹ Development Checklist

  • βœ… TypeScript strict mode
  • βœ… Component testing setup
  • βœ… API service layer
  • βœ… State management (Zustand)
  • βœ… Error handling
  • βœ… Loading states
  • βœ… Responsive design (Tailwind CSS)
  • βœ… Environment configuration
  • βœ… Documentation
  • βœ… Examples & mock data

πŸ—ΊοΈ Roadmap

Phase 1 (Current)

  • βœ… Project scaffold
  • βœ… Component structure
  • βœ… API integration layer
  • βœ… Testing setup

Phase 2

  • Real wallet integration (Freighter)
  • Historical data tracking
  • Advanced charting (D3.js)
  • Transaction history

Phase 3

  • Portfolio rebalancing tools
  • Custom alerts
  • Multi-wallet support
  • Export functionality

Phase 4

  • Mobile application
  • DeFi protocol integration
  • Predictive analytics
  • Community features

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™‹ Support


πŸ”— Useful Links


Built with ❀️ for the Stellar community

About

AstraPort DApp is the **frontend interface** for users. It connects to Stellar wallets, visualizes portfolios, and displays AI-driven insights.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.1%
  • Shell 3.5%
  • JavaScript 3.4%
  • CSS 1.0%