A personal portfolio dashboard that connects to Robinhood, enriches holdings with real-time market data, and surfaces AI-generated insights powered by Google Gemini.
| Feature | Description |
|---|---|
| 📊 Live Portfolio | Pulls stocks & crypto directly from your Robinhood account |
| 📈 Sparklines | 7-day price trend charts for every holding |
| 🤖 AI Insights | Per-asset Gemini analysis with trend summaries and forecasts |
| 📰 News Feed | Latest headlines per ticker via Finnhub |
| 🥧 Sector Allocation | Breakdown of portfolio weight by sector |
| 🔒 Server-side API calls | All secrets stay server-side — nothing is exposed to the browser |
| ⚡ Smart Caching | Portfolio data is cached in MySQL, keeping the UI snappy |
┌──────────────────────────────────────────────────────┐
│ Next.js Frontend │
│ (React 19 · Tailwind CSS · Recharts · Lucide) │
│ │
│ /dashboard ──► API Routes (/api/*) │
└───────────────────────┬──────────────────────────────┘
│ HTTP
┌───────────────────────▼──────────────────────────────┐
│ FastAPI Backend (Python) │
│ │
│ Robinhood (robin-stocks) ──► MySQL (portfolio) │
│ Yahoo Finance (yfinance) ──► Gemini API │
│ Finnhub API ──► /sparklines │
└──────────────────────────────────────────────────────┘
- Node.js 18+
- Python 3.10+
- MySQL 8+
git clone https://github.com/Christopher-Anandaraj/invAI.git
cd invAI
# Frontend
npm install
# Backend
pip install -r requirements.txtcp .env.example .envOpen .env and fill in your credentials:
# Robinhood
ROBINHOOD_USERNAME=your_email@example.com
ROBINHOOD_PASSWORD=your_password
# Google Gemini
GEMINI_API_KEY=your_gemini_api_key
# Finnhub
FINNHUB_API_KEY=your_finnhub_api_key
# MySQL
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_db_password
DB_NAME=invai
# Next.js (production only)
BACKEND_URL=https://your-backend-domain.com
⚠️ Never commit.envto source control. It is already in.gitignore.
mysql -u root -p < mysql_schema.sqlSee setup_database.md for detailed instructions.
# Terminal 1 — Next.js frontend
npm run dev
# Terminal 2 — FastAPI backend
python run_backend.py- Frontend → http://localhost:3000
- Backend API → http://localhost:8000
invAI/
├── src/
│ ├── app/
│ │ ├── api/ # Next.js server-side API routes
│ │ │ ├── portfolio/ # Portfolio data proxy
│ │ │ ├── asset-insights/ # Gemini AI insights
│ │ │ └── login/ # Robinhood auth (+ 2FA)
│ │ ├── dashboard/ # Main dashboard page
│ │ └── page.tsx # Landing / bot-check page
│ ├── components/
│ │ ├── PortfolioDashboard.tsx # Main dashboard component
│ │ └── StockDetailPage.tsx # Individual asset view
│ └── lib/
│ ├── portfolio_api.py # FastAPI app (core backend)
│ ├── robinhood_auth.py # Login & 2FA flow
│ ├── robinhood_portfolio.py # Portfolio helpers
│ └── sql.py # MySQL CRUD helpers
├── backend/
│ └── routes/sparklines.py
├── .env.example # Template — copy to .env
├── mysql_schema.sql # Database schema
├── run_backend.py # Backend entry point
└── requirements.txt
| Service | Purpose | Get one |
|---|---|---|
| Google Gemini | AI trend insights | aistudio.google.com |
| Finnhub | Stock news feed | finnhub.io |
| Robinhood | Portfolio data (your own account) | — |
All sensitive credentials are loaded exclusively from environment variables.
No keys are bundled into client-side JavaScript.
See SECURITY.md for the full policy.
Frontend
- Next.js 15 (App Router + Turbopack)
- React 19
- Tailwind CSS 4
- Recharts · Lucide React
Backend
AI / Data