A real-time portfolio management dashboard built with Next.js, TypeScript, and Tailwind CSS that fetches live stock data from Yahoo Finance and Google Finance APIs.
- Real-time Stock Data: Fetches current market prices from Yahoo Finance
- Financial Metrics: Retrieves P/E ratios and earnings data from Google Finance
- Dynamic Updates: Auto-refreshes data every 15 seconds
- Sector Grouping: Organizes stocks by sector with summary statistics
- Interactive UI: Modern, responsive design with dark/light theme support
- Error Handling: Graceful handling of API failures and rate limits
- Performance Optimized: Caching and memoization for better performance
- Frontend: Next.js 15.4.2, React 19.1.0, TypeScript
- Styling: Tailwind CSS 4, Radix UI components
- Data Fetching: TanStack Query (React Query)
- APIs: Yahoo Finance (unofficial), Google Finance (web scraping)
- Build Tool: Turbopack
- Node.js 18+
- Yarn package manager
- Clone the repository:
git clone https://github.com/Akianonymus/portfolio-dashboard
cd portfolio-dashboard- Install dependencies:
yarn install- Start the development server:
yarn dev- Open http://localhost:3000 in your browser
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ └── portfolio/
│ │ ├── static/ # Static portfolio data endpoint
│ │ └── dynamic/ # Dynamic data with live prices
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main dashboard page
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ ├── PortfolioTable.tsx # Main portfolio table
│ ├── SectorGrouping.tsx # Sector-wise grouping
│ └── PortfolioSummaryCard.tsx # Portfolio summary
├── data/ # Static data
│ └── portfolioData.ts # Portfolio holdings data
├── hooks/ # Custom React hooks
│ ├── useDynamicData.ts # Dynamic data fetching
│ └── useStaticPortfolio.ts # Static data fetching
├── lib/ # Utility libraries
│ └── services/ # API services
│ ├── api.ts # API client
│ ├── finance.ts # Finance service orchestrator
│ ├── yahooFinance.ts # Yahoo Finance integration
│ └── googleFinance.ts # Google Finance scraping
└── types/ # TypeScript type definitions
└── portfolio.ts # Portfolio-related types
GET /api/portfolio/static- Returns static portfolio data without external API callsGET /api/portfolio/dynamic?stocks=stock1,stock2- Returns portfolio data with live prices and financial metrics
No environment variables are required for basic functionality. The application uses public APIs and web scraping.
To modify the portfolio data, edit src/data/portfolioData.ts:
export const portfolioData: PortfolioHoldingData[] = [
{
id: "1",
name: "Stock Name",
sector: "Sector Name",
purchasePrice: 100.0,
quantity: 10,
},
// Add more stocks...
];yarn dev- Start development server with Turbopackyarn build- Build for productionyarn start- Start production serveryarn lint- Run ESLint
- Push your code to GitHub
- Connect your repository to Vercel
- Deploy automatically
The application can be deployed to any platform that supports Next.js:
yarn build
yarn startFor detailed technical information including:
- System architecture and data flow
- API specifications and implementation details
- Technical challenges and solutions
- Performance optimizations and security considerations
- API Rate Limits: If you encounter rate limit errors, the app will retry automatically
- Data Not Loading: Check browser console for error messages
- Build Errors: Ensure all dependencies are installed with
yarn install
Enable debug logging by checking browser console for detailed error messages and API response logs.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational purposes. Please respect the terms of service for Yahoo Finance and Google Finance when using this application.