|
1 |
| -# React + Vite |
| 1 | +# Stock Portfolio Tracker |
2 | 2 |
|
3 |
| -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
| 3 | +A modern web application for tracking your stock portfolio and watchlist. Built with React, Node.js, and PostgreSQL. |
4 | 4 |
|
5 |
| -Currently, two official plugins are available: |
| 5 | +## 🌐 Live Demo |
6 | 6 |
|
7 |
| -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 |
| -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
| 7 | +- Frontend: [https://portfolio-tracker-hackstyx.vercel.app](https://portfolio-tracker-hackstyx.vercel.app) |
| 8 | +- Backend API: [https://portfolio-tracker-backend-y7ne.onrender.com/api](https://portfolio-tracker-backend-y7ne.onrender.com/api) |
| 9 | + |
| 10 | +## ✨ Features |
| 11 | + |
| 12 | +- 📊 Real-time stock portfolio tracking |
| 13 | +- 👀 Watchlist management |
| 14 | +- 📈 Stock price history visualization |
| 15 | +- 🌓 Dark/Light theme support |
| 16 | +- 📱 Responsive design |
| 17 | +- 🔄 Automatic price updates |
| 18 | + |
| 19 | +## 🚀 Running Locally |
| 20 | + |
| 21 | +### Prerequisites |
| 22 | + |
| 23 | +- Node.js (v14 or higher) |
| 24 | +- npm or yarn |
| 25 | +- PostgreSQL database |
| 26 | + |
| 27 | +### Frontend Setup |
| 28 | + |
| 29 | +1. Clone the repository: |
| 30 | +```bash |
| 31 | +git clone https://github.com/HackStyx/portfolio-tracker.git |
| 32 | +cd portfolio-tracker |
| 33 | +``` |
| 34 | + |
| 35 | +2. Install dependencies: |
| 36 | +```bash |
| 37 | +npm install |
| 38 | +# or |
| 39 | +yarn install |
| 40 | +``` |
| 41 | + |
| 42 | +3. Create a `.env` file in the root directory: |
| 43 | +```env |
| 44 | +VITE_API_BASE_URL=http://localhost:5000/api |
| 45 | +``` |
| 46 | + |
| 47 | +4. Start the development server: |
| 48 | +```bash |
| 49 | +npm run dev |
| 50 | +# or |
| 51 | +yarn dev |
| 52 | +``` |
| 53 | + |
| 54 | +The frontend will be available at `http://localhost:5173` |
| 55 | + |
| 56 | +### Backend Setup |
| 57 | + |
| 58 | +1. Navigate to the backend directory: |
| 59 | +```bash |
| 60 | +cd backend |
| 61 | +``` |
| 62 | + |
| 63 | +2. Install dependencies: |
| 64 | +```bash |
| 65 | +npm install |
| 66 | +# or |
| 67 | +yarn install |
| 68 | +``` |
| 69 | + |
| 70 | +3. Create a `.env` file in the backend directory: |
| 71 | +```env |
| 72 | +DATABASE_URL=your_postgresql_connection_string |
| 73 | +PORT=5000 |
| 74 | +NODE_ENV=development |
| 75 | +``` |
| 76 | + |
| 77 | +4. Run database migrations: |
| 78 | +```bash |
| 79 | +npm run migrate |
| 80 | +# or |
| 81 | +yarn migrate |
| 82 | +``` |
| 83 | + |
| 84 | +5. Start the backend server: |
| 85 | +```bash |
| 86 | +npm start |
| 87 | +# or |
| 88 | +yarn start |
| 89 | +``` |
| 90 | + |
| 91 | +The API will be available at `http://localhost:5000/api` |
| 92 | + |
| 93 | +## 🔧 Environment Variables |
| 94 | + |
| 95 | +### Frontend (.env) |
| 96 | +- `VITE_API_BASE_URL`: Backend API URL |
| 97 | + |
| 98 | +### Backend (.env) |
| 99 | +- `DATABASE_URL`: PostgreSQL connection string |
| 100 | +- `PORT`: Server port (default: 5000) |
| 101 | +- `NODE_ENV`: Environment (development/production) |
| 102 | + |
| 103 | +## 📝 API Documentation |
| 104 | + |
| 105 | +### Endpoints |
| 106 | + |
| 107 | +#### Stocks |
| 108 | +- `GET /api/stocks` - Get all stocks in portfolio |
| 109 | +- `POST /api/stocks` - Add a new stock |
| 110 | +- `PUT /api/stocks/:id` - Update a stock |
| 111 | +- `DELETE /api/stocks/:id` - Delete a stock |
| 112 | +- `GET /api/stocks/:ticker/historical` - Get historical data |
| 113 | + |
| 114 | +#### Watchlist |
| 115 | +- `GET /api/watchlist` - Get watchlist |
| 116 | +- `POST /api/watchlist` - Add to watchlist |
| 117 | +- `PUT /api/watchlist/:id` - Update watchlist item |
| 118 | +- `DELETE /api/watchlist/:id` - Remove from watchlist |
| 119 | +- `POST /api/watchlist/sync-portfolio` - Sync with portfolio |
| 120 | + |
| 121 | +## ⚠️ Assumptions & Limitations |
| 122 | + |
| 123 | +1. **Stock Data** |
| 124 | + - Uses simulated stock data for demonstration |
| 125 | + - Real-time price updates are simulated |
| 126 | + - Historical data is generated for demonstration |
| 127 | + |
| 128 | +2. **Authentication** |
| 129 | + - Currently uses a simple reset-based logout |
| 130 | + - No user authentication system |
| 131 | + - Single user environment |
| 132 | + |
| 133 | +3. **Performance** |
| 134 | + - Limited to managing reasonable portfolio sizes |
| 135 | + - Price updates every minute |
| 136 | + - Historical data limited to recent periods |
| 137 | + |
| 138 | +4. **Browser Support** |
| 139 | + - Requires modern browsers |
| 140 | + - Best experienced on Chrome, Firefox, Safari |
| 141 | + - Requires JavaScript enabled |
| 142 | + |
| 143 | +## 🛠️ Tech Stack |
| 144 | + |
| 145 | +- **Frontend** |
| 146 | + - React |
| 147 | + - Vite |
| 148 | + - TailwindCSS |
| 149 | + - Framer Motion |
| 150 | + - Tremor |
| 151 | + - Axios |
| 152 | + |
| 153 | +- **Backend** |
| 154 | + - Node.js |
| 155 | + - Express |
| 156 | + - PostgreSQL |
| 157 | + - Knex.js |
| 158 | + - Node-Postgres |
| 159 | + |
| 160 | +## 📱 Responsive Design |
| 161 | + |
| 162 | +- Fully responsive layout |
| 163 | +- Mobile-first approach |
| 164 | +- Adaptive UI components |
| 165 | +- Touch-friendly interactions |
| 166 | + |
| 167 | +## 🤝 Contributing |
| 168 | + |
| 169 | +1. Fork the repository |
| 170 | +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) |
| 171 | +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) |
| 172 | +4. Push to the branch (`git push origin feature/AmazingFeature`) |
| 173 | +5. Open a Pull Request |
| 174 | + |
| 175 | +## 📄 License |
| 176 | + |
| 177 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments