Skip to content

VinayakGawade009/stock-trading-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stock Trading & Portfolio Management Platform

A full-stack stock trading and portfolio management platform inspired by Zerodha, built using the MERN stack.
The project includes a public landing website, secure authentication, and an interactive trading dashboard with portfolio analytics.

πŸ“‹ Table of Contents

✨ Features

Authentication

  • User signup & login using JWT
  • Password hashing with bcrypt
  • HTTP-only cookies
  • Protected routes for dashboard access

Landing Website

  • Zerodha-inspired UI
  • Responsive pages:
    • Home
    • Products
    • Pricing
    • About
    • Support
    • Signup / Login
  • Component-based React architecture

Trading Dashboard

  • Portfolio overview
  • Holdings, Orders, Positions
  • Buy / Sell simulation
  • Watchlist
  • Interactive charts using Chart.js
  • Context API for state management

Backend APIs

  • RESTful APIs using Express
  • MongoDB schemas for users and trading data
  • JWT authentication middleware
  • Modular MVC structure

πŸ“¦ Prerequisites

  • Node.js (v18+ recommended)
  • MongoDB (Local or Atlas)
  • npm

πŸ› οΈ Tech Stack

Frontend

  • React (Vite)
  • React Router DOM
  • Axios
  • Chart.js & react-chartjs-2
  • CSS

Dashboard

  • React (Vite)
  • Context API
  • Chart.js

Backend

  • Node.js
  • Express.js
  • MongoDB & Mongoose
  • JWT
  • bcrypt
  • dotenv

πŸ“ Project Structure

NewProject_1/
β”œβ”€β”€ backend/
β”‚ β”œβ”€β”€ controllers/
β”‚ β”œβ”€β”€ middlewares/
β”‚ β”œβ”€β”€ model/
β”‚ β”œβ”€β”€ routes/
β”‚ β”œβ”€β”€ schemas/
β”‚ β”œβ”€β”€ utils/
β”‚ └── index.js
β”‚
β”œβ”€β”€ frontend/
β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”œβ”€β”€ landing_page/
β”‚ β”‚ β”œβ”€β”€ test/
β”‚ β”‚ └── App.jsx
β”‚ └── vite.config.js
β”‚
β”œβ”€β”€ dashboard/
β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ └── data/
β”‚ └── vite.config.js
β”‚
└── README.md

πŸš€ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/your-username/Stock-Trading-Platform.git
cd Stock-Trading-Platform

2️⃣ Install Dependencies

  • Backend
cd backend
npm install
  • Frontend (Landing Website)
cd frontend
npm install
  • Dashboard
cd dashboard
npm install

3οΈβƒ£πŸ”§ Environment Variables

Create a .env file inside the backend directory:

PORT=3002
MONGO_URI=your_mongodb_connection_string
TOKEN_KEY=your_jwt_secret

Make sure MongoDB is running locally or use MongoDB Atlas.

▢️ Running the Application

Start Backend

cd backend
npm start
  • Start Frontend (Landing Website)
cd frontend
npm run dev
  • Start Dashboard
cd dashboard
npm run dev

πŸ”Œ API Routes

Auth

  • POST /auth/signup
  • POST /auth/login

Dashboard

  • GET /holdings
  • GET /orders
  • GET /positions

πŸ” Application Flow

  1. User lands on the Landing Website

  2. User signs up or logs in

  3. JWT token is issued and stored in cookies

  4. User is redirected to the Dashboard

  5. Protected routes verify authentication

  6. Dashboard fetches user-specific data

πŸ§ͺ Testing

  • Unit testing setup using Vitest

  • React Testing Library configured

  • Sample component tests included (Hero.test.jsx)

πŸ” Security Features

  • Password hashing with bcrypt

  • JWT-based authentication

  • HTTP-only cookies

  • Authentication middleware

  • Protected routes

  • Input validation on backend

🀝 Contributing

  • Contributions are welcome!
  1. Fork the repository

  2. Create a feature branch

git checkout -b feature/your-feature
  1. Commit changes
git commit -m "Add your feature"
  1. Push to branch
git push origin feature/your-feature
  1. Open a Pull Request

πŸ“ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ“ž Support

If you encounter any issues or have questions, please:

  • Open an issue on GitHub
  • Contact the project maintainer
  • Check the existing issues for solutions

πŸ™ Acknowledgements

  • Inspired by Zerodha
  • React & Express documentation
  • Chart.js
  • MongoDB
  • Open-source community

πŸ”— Demo

Deployment coming soon.


Happy Coding! πŸš€

⭐ If you find this project helpful, please consider giving it a star!

About

Full-stack stock trading and portfolio management platform with authentication, dashboards, and real-time analytics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors