Skip to content

HackStyx/portfolio-tracker

Repository files navigation

Stock Portfolio Tracker 📈

Vercel Render React Vite MySQL TailwindCSS Node.js

A modern, responsive stock portfolio tracker built with React and Node.js

Live DemoAPI DocumentationReport Bug

Note: Due to the free tier limitations of Render, the initial load of the demo might take 30-60 seconds. If no data appears, please refresh the page. If issues persist, click the logout button to reset the application state. The backend spins down after 15 minutes of inactivity and needs time to restart.

Portfolio Dashboard

✨ Features

  • 📊 Portfolio Management - Track your stocks with real-time updates
  • 👀 Watchlist - Monitor potential investments
  • 🌓 Dark/Light Mode - Easy on the eyes, day and night
  • 📱 Fully Responsive - Perfect on desktop and mobile
  • 🔄 Live Updates - Stock prices update automatically
  • 📈 Price History - Visualize stock performance

🚀 Quick Start

Prerequisites

  • Node.js 14+
  • npm or yarn
  • MySQL

Frontend Setup

  1. Clone and install:
git clone https://github.com/HackStyx/portfolio-tracker.git
cd portfolio-tracker
npm install
  1. Create .env:
VITE_API_BASE_URL=http://localhost:5000/api
  1. Start development server:
npm run dev

Backend Setup

  1. Setup backend:
cd backend
npm install
  1. Configure .env:
DATABASE_URL=mysql://user:password@localhost:3306/portfolio_tracker
PORT=5000
NODE_ENV=development
  1. Run migrations and start:
npm run migrate
npm start

🔌 API Endpoints

Base URL

https://portfolio-tracker-backend-y7ne.onrender.com/api

Portfolio

GET     /api/stocks           # Get portfolio stocks
POST    /api/stocks           # Add stock
PUT     /api/stocks/:id       # Update stock
DELETE  /api/stocks/:id       # Remove stock

Watchlist

GET     /api/watchlist           # Get watchlist
POST    /api/watchlist           # Add to watchlist
PUT     /api/watchlist/:id       # Update watchlist item
DELETE  /api/watchlist/:id       # Remove from watchlist

⚡️ Tech Stack

🎨 Frontend

  • Framework: React - A JavaScript library for building user interfaces
  • Build Tool: Vite - Next generation frontend tooling
  • Styling:
  • State Management: React Context API
  • HTTP Client: Axios - Promise based HTTP client

🛠 Backend

  • Runtime: Node.js - JavaScript runtime
  • Framework: Express - Web framework for Node.js
  • Database: MySQL - Open-source relational database
  • ORM: Sequelize - Modern TypeScript and Node.js ORM
  • API Documentation: OpenAPI/Swagger

🚀 DevOps & Infrastructure

  • Frontend Hosting: Vercel
    • Zero-config deployments
    • Automatic HTTPS
    • Edge Network for optimal performance
  • Backend Hosting: Render
    • Containerized deployment
    • Automatic scaling
    • Built-in monitoring
  • Database Hosting: Railway
    • Managed MySQL database
    • Automated backups
    • High availability

📦 Additional Tools

  • Version Control: Git & GitHub
  • Code Quality: ESLint & Prettier
  • API Testing: Postman
  • Environment Variables: dotenv
  • Security: CORS, Helmet
  • Real-time Data: WebSocket (planned)

⚠️ Limitations

  • Uses simulated stock data
  • Single-user environment
  • Price updates every minute
  • Best viewed in modern browsers
  • Backend spins down after 15 minutes of inactivity and needs time to restart

📄 License

MIT © HackStyx