Track your investments, analyze performance, and make data-driven decisions with our powerful financial dashboard.
StockVision is a modern, interactive dashboard for investors and traders. It provides a comprehensive view of your portfolio, real-time market data, and insightful analytics to help you make smarter financial decisions.
- Portfolio Overview: Visualize your holdings and performance at a glance.
- Multi-Portfolio Management: Create, manage, and compare multiple portfolios.
- Portfolio Comparison: Interactive charts to compare performance across portfolios.
- Historical Analysis: Track portfolio performance over different time periods.
- Market Data Center: Access up-to-date market data and trends.
- Performance Analytics: Analyze your portfolio's growth and risk.
- Recent Activity: Track your latest transactions and changes.
- Customizable Dashboard: Modular components for a personalized experience.
- Framework: Next.js 15 (Monorepo)
- Language: TypeScript
- State Management: React Context API
- UI: Radix UI, Shadcn UI
- Styling: Tailwind CSS
- Deployment: Vercel
- Framework: FastAPI (Python)
- Features: REST API, CORS, Pydantic validation, auto docs, market/stock endpoints
- Dev Tools: Uvicorn, Black, isort, flake8, pytest
For a detailed explanation of the backend structure, API endpoints, and integration, see Backend.md.
StockVision/
├── frontend/ # Next.js Frontend Application
│ ├── app/ # Next.js App Router
│ ├── public/ # Static assets
│ ├── package.json # Frontend dependencies
│ └── ... # Frontend config files
├── backend/ # FastAPI Backend Application
│ ├── app/ # FastAPI application code
│ │ ├── models.py # Pydantic models
│ │ └── routers/ # API route handlers
│ ├── main.py # FastAPI entry point
│ ├── requirements.txt # Python dependencies
│ └── ... # Backend config files
├── package.json # Root monorepo configuration
├── Backend.md # **Backend details and API documentation**
└── README.md # This file
- Node.js 18+ and npm 9+
- Python 3.8+ and pip
- PostgreSQL 14+ (running locally with a database created, e.g.
stockvision
) - Git
-
Clone the repository
git clone https://github.com/MIHIR2006/StockVision.git cd StockVision
-
Install all dependencies
npm install # (installs both frontend and backend dependencies)
-
Set up backend environment variables (PostgreSQL required)
cd backend cp env.example .env # Edit .env and set DATABASE_URL, for example: # DATABASE_URL=postgresql://user:password@localhost:5432/stockvision cd ..
-
Start PostgreSQL locally (recommended: Docker)
# Start a local PostgreSQL 16 container on port 5432 docker run --name stockvision-postgres \ -e POSTGRES_USER=svuser -e POSTGRES_PASSWORD=svpass -e POSTGRES_DB=stockvision \ -p 5432:5432 -d postgres:16 # Set the same DATABASE_URL in your shell (PowerShell example) # $env:DATABASE_URL="postgresql://svuser:svpass@localhost:5432/stockvision"
Useful Docker commands:
- Start:
docker start stockvision-postgres
- Stop:
docker stop stockvision-postgres
- Logs:
docker logs -f stockvision-postgres
- Start:
-
Setup database client (Prisma) for frontend
cd frontend npm install # Ensure DATABASE_URL is available in environment (same as backend) # On Windows PowerShell: # $env:DATABASE_URL="postgresql://user:password@localhost:5432/stockvision" # On Unix shells: # export DATABASE_URL="postgresql://user:password@localhost:5432/stockvision" npm run db:generate npm run db:dev cd ..
-
Run the development servers
# Start both frontend and backend together npm run dev # Or run individually: npm run dev:frontend # Frontend only (http://localhost:3000) npm run dev:backend # Backend only (http://127.0.0.1:8000)
- Frontend: Open http://localhost:3000
- Backend: Open http://localhost:8000/docs for API docs
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- API ReDoc: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
npm run dev # Start both frontend and backend
npm run dev:frontend # Start frontend only
npm run dev:backend # Start backend only
npm run build # Build both applications
npm run build:frontend # Build frontend only
npm run build:backend # Build backend only
npm run start # Start both in production mode
npm run lint # Lint all workspaces
npm run install:all # Install all dependencies
cd frontend
npm run dev # Start Next.js dev server
npm run build # Build for production
npm run start # Start production server
npm run lint # Lint TypeScript/ESLint
cd backend
npm run dev # Start FastAPI dev server
npm run start # Start production server
npm run test # Run tests
npm run lint # Format and lint code
See Backend.md for full details, but here are the essentials:
GET /api/stocks
- All stocksGET /api/stocks/{symbol}
- Specific stockPOST /api/stocks/search
- Search stocksGET /api/stocks/{symbol}/price
- Stock price only
GET /api/portfolios
- Get all portfoliosGET /api/portfolios/{id}
- Get specific portfolioPOST /api/portfolios
- Create new portfolioPUT /api/portfolios/{id}
- Update portfolioDELETE /api/portfolios/{id}
- Delete portfolioGET /api/portfolios/{id}/history
- Portfolio historical dataPOST /api/portfolios/compare
- Compare multiple portfoliosGET /api/portfolios/analytics/summary
- Combined portfolio analytics
GET /api/market/summary
- Market summaryGET /api/market/trends
- Market trendsGET /api/market/sectors
- Sector performanceGET /api/market/indicators
- Market indicatorsGET /api/market/volume
- Volume data
GET /
- RootGET /health
- Health checkGET /docs
- Swagger UIGET /redoc
- ReDoc
API_HOST=0.0.0.0
API_PORT=8000
DEBUG=True
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001
# Required PostgreSQL connection string
# Example: postgresql://user:password@localhost:5432/stockvision
DATABASE_URL=postgresql://user:password@localhost:5432/stockvision
The frontend uses Prisma + PostgreSQL. Ensure DATABASE_URL
is set in your shell (or create frontend/.env.local
) before running:
cd frontend
npm run db:generate
npm run db:dev
Use Prisma Studio to inspect tables and data in your PostgreSQL database.
PowerShell (Windows):
cd frontend
$env:DATABASE_URL="postgresql://svuser:svpass@localhost:5432/stockvision"
npm run db:studio
Unix shells (macOS/Linux/WSL):
cd frontend
export DATABASE_URL="postgresql://svuser:svpass@localhost:5432/stockvision"
npm run db:studio
This opens a local UI at http://localhost:5555 showing your Prisma models and rows.
Optional: connect with psql (Docker example):
docker exec -it stockvision-postgres psql -U svuser -d stockvision
# PostgreSQL database URL used by Prisma
DATABASE_URL="postgresql://user:password@localhost:5432/stockvision?schema=public"
# Optional: Backend API URL if the frontend calls the backend
# NEXT_PUBLIC_API_URL="http://localhost:8000"
- Multi-portfolio management and comparison
- Real-time stock data integration
- User authentication and portfolio persistence
- Advanced charting features
- Portfolio optimization suggestions
- Risk analysis and alerts
- Mobile app development
- Machine learning predictions
- Social trading features
This project uses Turborepo for monorepo management and build optimization.
- Dev:
npm run dev
(runs both frontend and backend) - Build:
npm run build
- Start:
npm run start
- Frontend: Deploy the
frontend
directory to Vercel (set root tofrontend
in Vercel dashboard). - Backend: Deploy the
backend
directory to a Python-friendly host (Render, Railway, Fly.io, etc). - API URL: Set
NEXT_PUBLIC_API_URL
in Vercel to your backend’s public URL.
See Backend.md for backend deployment and API details.
Set these environment variables in the Vercel project (Frontend):
NEXTAUTH_URL
= your production URL (e.g.https://your-app.vercel.app
)NEXTAUTH_SECRET
= a strong random string (e.g. output ofopenssl rand -base64 32
)DATABASE_URL
= your production PostgreSQL connection string- Optional OAuth providers:
GITHUB_ID
,GITHUB_SECRET
GOOGLE_CLIENT_ID
,GOOGLE_CLIENT_SECRET
Provider callback URLs to configure in the provider dashboards:
- GitHub:
https://your-app.vercel.app/api/auth/callback/github
- Google:
https://your-app.vercel.app/api/auth/callback/google
Notes:
- App Router auth endpoint is at
app/api/auth/[...nextauth]/route.ts
and is production-safe. - Keep
debug
off in production (it's automatically off whenNODE_ENV=production
).
This monorepo uses Turborepo for fast, cacheable builds and development.
We love our contributors! Here's how you can contribute:
- Open an issue if you believe you've encountered a bug.
- Follow the local development guide to get your local dev environment set up.
- Make a pull request to add new features/make quality-of-life improvements/fix bugs.