A comprehensive full-stack application for practicing stock trading with virtual money. Build your portfolio, track live price movements, and master trading strategies without any real financial risk.
- Node.js (v16 or higher)
- MySQL (v8.0 or higher) - or a hosted database like Neon (PostgreSQL via Prisma)
- npm (comes with Node.js)
# Clone the repository
git clone <repository-url>
cd "STOCK PROJECT"- Navigate to the backend directory:
cd backend - Install dependencies:
npm install - Set up environment variables:
- Copy
.env.exampleto.env - Update
DATABASE_URLwith your database connection string - Set a secure
JWT_SECRET
- Copy
- Initialize the database:
npx prisma generate npx prisma migrate dev --name init
- Start the backend:
npm run dev
- Open a new terminal and navigate to the frontend:
cd frontend - Install dependencies:
npm install - Start the frontend:
npm run dev
To explore the application without creating a new account, use the following test user:
| Role | Password | |
|---|---|---|
| Test User | testuser@gmail.com |
test123 |
- Frontend: React (Vite), React Router, Axios, Plain CSS, Three.js (for backgrounds)
- Backend: Node.js, Express.js
- Database: Prisma ORM (supports MySQL/PostgreSQL)
- Auth: JWT (JSON Web Tokens) with bcryptjs hashing
- Real-time Simulation: Prices fluctuate every 3-5 seconds.
- Virtual Wallet: Start with ₹10,00,000 to practice trading.
- Portfolio Management: Real-time tracking of profit/loss.
- Account Reset: Ability to reset and start fresh if net worth falls below ₹50,000.
- Comprehensive History: Detailed transaction logs for all trades.
- Beautiful UI: Modern dark theme with glassmorphism and 3D background effects.
STOCK PROJECT/
├── backend/ # Express API, Prisma schema, and logic
├── frontend/ # React application and styles
├── prisma/ # Database migrations and schema
└── README.md # Project documentation (this file)
- MySQL Connection: Ensure MySQL service is running (
brew services start mysqlon macOS). - Port Conflict: If port 3000 (Backend) or 5173 (Frontend) are busy, use
lsof -ti:PORTandkill -9 <PID>to clear them. - Database Errors: If the schema changes, run
npx prisma generateandnpx prisma migrate dev.
- Frontend: Best deployed to Vercel.
- Backend: Recommended to use Render or Railway.
- Database: Use a managed service like Neon (PostgreSQL) or Railway MySQL.
Created with ❤️ for Advanced Agentic Coding by Ansh Baheti.