Skip to content

HarshalWaghmare89/TradeFlow-Full-Stack-Trading-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TradeFlow Logo TradeFlow - Full Stack Trading Platform

TradeFlow is a modern full-stack trading platform that simulates a real-world stock trading experience. Users can execute trades, manage portfolios, and track orders, holdings, positions, bids, and funds, while enjoying a responsive user interface, secure backend architecture, and efficient trade execution.


πŸ“– Table of Contents


Overview

TradeFlow is a fully responsive, full-stack trading platform that delivers a realistic, real-time stock market simulation. It enables users to buy and sell assets, monitor investments, and track orders, holdings, positions, bids, and funds through an intuitive and interactive dashboard. Users can also enjoy advanced search and filtering, light and dark themes, and visual analytics with charts and heatmaps.

The platform incorporates secure authentication and authorization with a modular architecture, reflecting professional-grade FinTech design principles.

πŸ“ˆ Built with the MERN stack, TradeFlow demonstrates scalable architecture, efficient trade execution, and a seamless user experience.


Demo Video

πŸŽ₯ Watch the full demo video: Coming soon


Live Demo

🌐 Access TradeFlow live here: Visit TradeFlow


Features

  • πŸ“Š Portfolio Management

    • Track and manage holdings, positions, and portfolio values through a structured trading dashboard.
  • πŸ’Ή Trade Execution

    • Execute BUY and SELL trades that automatically update orders, holdings, and positions.
  • πŸ“ Orders Management

    • Create and monitor trading orders with details such as instrument, exchange, quantity, and price.
  • 🏦 Funds Management

    • Manage available trading funds, including equity and commodity balances.
  • 🎯 Bids System

    • Maintain auction-style bids from holdings with real-time profit/loss tracking.
  • πŸ” Interactive Search & Watchlist

    • Quickly search stocks and perform instant actions like Buy, Sell, or Delete directly from the watchlist.
  • πŸ” Secure Authentication

    • Authenticate users securely using JWT tokens and bcrypt for password hashing.
  • πŸ–₯ Responsive User Interface

    • Fully responsive and works seamlessly across all devices.
  • πŸŒ— Light & Dark Themes

    • Switch between light and dark modes for a comfortable trading experience.
  • πŸ“ˆ Visual Analytics

    • Analyze portfolio and market trends using charts and heatmaps.
  • ⚠️ Error Handling

    • Robust error handling ensures invalid requests and broken routes are handled gracefully.

Tech Stack

πŸ’» Frontend

  • React

    • Builds a dynamic and interactive frontend.
  • React Router

    • Handles client-side routing and smooth navigation between pages.
  • Axios

    • Performs API requests to fetch and manage trading data.
  • Bootstrap

    • Ensures a fully responsive and mobile-friendly UI.
  • Recharts

    • Renders charts and graphs for portfolio and market visualization.
  • React Helmet Async

    • Dynamically manages page titles and meta tags for SEO and usability.
  • Context API

    • Manages global state across the React application.
  • Vanilla CSS (with CSS Variables)

    • Scalable, maintainable, and reusable styles.

πŸ–₯ Backend

  • Node.js

    • Provides a scalable backend runtime environment.
  • Express.js

    • Handles routing, middleware, and RESTful API endpoints.
  • CORS (Cross-Origin Resource Sharing)

    • Allows secure resource sharing between frontend and backend.
  • Server-Side Validation (Joi)

    • Ensures data integrity and prevents invalid requests with schema validation.

πŸ—„ Database

  • MongoDB

    • Stores user portfolios, orders, and market data efficiently.
  • Mongoose

    • Object Data Modeling (ODM) for MongoDB with schema validation.

πŸ”’ Security

  • JWT Authentication

    • Secures user authentication and protects API routes.
  • bcrypt password hashing

    • Encrypts user passwords for secure storage.
  • Helmet security middleware

    • Adds HTTP headers for enhanced application security.

Project Architecture

The project adopts a feature-based modular architecture, ensuring scalability, maintainability, and production readiness.

TradeFlow/
└── backend/
    β”œβ”€β”€ controllers/
    β”‚   β”œβ”€β”€ auth.controller.js
    β”‚   β”œβ”€β”€ orders.controller.js
    β”‚   β”œβ”€β”€ holdings.controller.js
    β”‚   β”œβ”€β”€ positions.controller.js
    β”‚   β”œβ”€β”€ bids.controller.js
    β”‚   β”œβ”€β”€ funds.controller.js
    β”‚   └── trade.controller.js
    β”‚
    β”œβ”€β”€ init/
    β”‚   β”œβ”€β”€ data.js
    β”‚   └── index.js
    β”‚
    β”œβ”€β”€ middleware/
    β”‚   β”œβ”€β”€ authenticate.js
    β”‚   └── validate.js
    β”‚
    β”œβ”€β”€ models/
    β”‚   β”œβ”€β”€ user.model.js
    β”‚   β”œβ”€β”€ order.model.js
    β”‚   β”œβ”€β”€ holding.model.js
    β”‚   β”œβ”€β”€ position.model.js
    β”‚   β”œβ”€β”€ bid.model.js
    β”‚   └── fund.model.js
    β”‚
    β”œβ”€β”€ routes/
    β”‚   β”œβ”€β”€ auth.routes.js
    β”‚   β”œβ”€β”€ orders.routes.js
    β”‚   β”œβ”€β”€ holdings.routes.js
    β”‚   β”œβ”€β”€ positions.routes.js
    β”‚   β”œβ”€β”€ bids.routes.js
    β”‚   β”œβ”€β”€ funds.routes.js
    β”‚   └── trade.routes.js
    β”‚
    β”œβ”€β”€ utils/
    β”‚   └── generateToken.js
    β”‚
    β”œβ”€β”€ validators/
    β”‚   β”œβ”€β”€ user.validation.js
    β”‚   β”œβ”€β”€ order.validation.js
    β”‚   β”œβ”€β”€ holding.validation.js
    β”‚   β”œβ”€β”€ position.validation.js
    β”‚   β”œβ”€β”€ bids.validation.js
    β”‚   β”œβ”€β”€ fund.validation.js
    β”‚   └── trade.validation.js
    β”‚
    β”œβ”€β”€ .env
    β”œβ”€β”€ app.js
    β”œβ”€β”€ index.js
    └── package.json

└── frontend/
    β”œβ”€β”€ public/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ api.js
    β”‚   β”œβ”€β”€ main.jsx
    β”‚
    β”‚   β”œβ”€β”€ app/
    β”‚   β”‚   β”œβ”€β”€ App.jsx
    β”‚   β”‚   └── router.jsx
    β”‚
    β”‚   β”œβ”€β”€ assets/
    β”‚   β”‚   └── styles/
    β”‚   β”‚       β”œβ”€β”€ globals.css
    β”‚   β”‚       β”œβ”€β”€ reset.css
    β”‚   β”‚       └── variables.css
    β”‚
    β”‚   β”œβ”€β”€ modules/
    β”‚   β”‚   β”œβ”€β”€ auth/
    β”‚   β”‚   β”‚   └── pages/
    β”‚   β”‚   β”‚       └── signup/
    β”‚   β”‚   β”‚           β”œβ”€β”€ SignupPage.jsx
    β”‚   β”‚   β”‚           └── components/
    β”‚   β”‚   β”‚               β”œβ”€β”€ AccountOpeningStepsSection.css
    β”‚   β”‚   β”‚               β”œβ”€β”€ AccountOpeningStepsSection.jsx
    β”‚   β”‚   β”‚               β”œβ”€β”€ AccountTypesSection.css
    β”‚   β”‚   β”‚               β”œβ”€β”€ AccountTypesSection.jsx
    β”‚   β”‚   β”‚               β”œβ”€β”€ BenefitsSection.css
    β”‚   β”‚   β”‚               β”œβ”€β”€ BenefitsSection.jsx
    β”‚   β”‚   β”‚               β”œβ”€β”€ FaqSection.css
    β”‚   β”‚   β”‚               β”œβ”€β”€ FaqSection.jsx
    β”‚   β”‚   β”‚               β”œβ”€β”€ HeroSection.css
    β”‚   β”‚   β”‚               β”œβ”€β”€ HeroSection.jsx
    β”‚   β”‚   β”‚               β”œβ”€β”€ InvestmentOptionsSection.css
    β”‚   β”‚   β”‚               └── InvestmentOptionsSection.jsx
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ dashboard/
    β”‚   β”‚   β”‚   β”œβ”€β”€ data.js
    β”‚   β”‚   β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ actionWindow/
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BuyActionWindow.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BuyActionWindow.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ FundsActionWindow.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ FundsActionWindow.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   └── GeneralContext.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ header/
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Header.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Menu.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Menu.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProfileDropdown.css
    β”‚   β”‚   β”‚   β”‚   β”‚   └── ProfileDropdown.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ notFoundPage/
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ NotFoundPageDashboard.css
    β”‚   β”‚   β”‚   β”‚   β”‚   └── NotFoundPageDashboard.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ sidebar/
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SidebarPage.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SidebarPage.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ WatchList.css
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ WatchList.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ WatchListItems.css
    β”‚   β”‚   β”‚   β”‚   β”‚   └── WatchListItems.jsx
    β”‚   β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”‚   └── widgets/
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ CustomContent.jsx
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ CustomTooltip.jsx
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ NiftyChart.jsx
    β”‚   β”‚   β”‚   β”‚       └── TreemapCard.jsx
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   └── pages/
    β”‚   β”‚   β”‚       β”œβ”€β”€ bids/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ BidsPage.jsx
    β”‚   β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚   β”‚       β”‚       β”œβ”€β”€ Bids.css
    β”‚   β”‚   β”‚       β”‚       └── Bids.jsx
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ dashboardHome/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ DashboardHomePage.jsx
    β”‚   β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚   β”‚       β”‚       β”œβ”€β”€ Summary.css
    β”‚   β”‚   β”‚       β”‚       └── Summary.jsx
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ funds/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ FundsPage.jsx
    β”‚   β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚   β”‚       β”‚       β”œβ”€β”€ Funds.css
    β”‚   β”‚   β”‚       β”‚       └── Funds.jsx
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ holdings/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ HoldingsPage.jsx
    β”‚   β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚   β”‚       β”‚       β”œβ”€β”€ Holdings.css
    β”‚   β”‚   β”‚       β”‚       └── Holdings.jsx
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ orders/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ OrdersPage.jsx
    β”‚   β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚   β”‚       β”‚       β”œβ”€β”€ Orders.css
    β”‚   β”‚   β”‚       β”‚       └── Orders.jsx
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       └── positions/
    β”‚   β”‚   β”‚           β”œβ”€β”€ PositionsPage.jsx
    β”‚   β”‚   β”‚           └── components/
    β”‚   β”‚   β”‚               β”œβ”€β”€ Positions.css
    β”‚   β”‚   β”‚               └── Positions.jsx
    β”‚   β”‚   β”‚
    β”‚   β”‚   └── landingPages/
    β”‚   β”‚       β”œβ”€β”€ about/
    β”‚   β”‚       β”‚   β”œβ”€β”€ AboutPage.jsx
    β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ TeamSection.css
    β”‚   β”‚       β”‚       └── TeamSection.jsx
    β”‚   β”‚       β”‚
    β”‚   β”‚       β”œβ”€β”€ home/
    β”‚   β”‚       β”‚   β”œβ”€β”€ HomePage.jsx
    β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚       β”‚       β”œβ”€β”€ AwardsSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ AwardsSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ EducationSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ EducationSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ PricingSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ PricingSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ StatsSection.css
    β”‚   β”‚       β”‚       └── StatsSection.jsx
    β”‚   β”‚       β”‚
    β”‚   β”‚       β”œβ”€β”€ pricing/
    β”‚   β”‚       β”‚   β”œβ”€β”€ PricingPage.jsx
    β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚       β”‚       β”œβ”€β”€ BrokerageSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ BrokerageSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.css
    β”‚   β”‚       β”‚       └── HeroSection.jsx
    β”‚   β”‚       β”‚
    β”‚   β”‚       β”œβ”€β”€ product/
    β”‚   β”‚       β”‚   β”œβ”€β”€ ProductPage.jsx
    β”‚   β”‚       β”‚   └── components/
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ HeroSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ LeftSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ LeftSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ RightSection.css
    β”‚   β”‚       β”‚       β”œβ”€β”€ RightSection.jsx
    β”‚   β”‚       β”‚       β”œβ”€β”€ UniverseSection.css
    β”‚   β”‚       β”‚       └── UniverseSection.jsx
    β”‚   β”‚       β”‚
    β”‚   β”‚       └── support/
    β”‚   β”‚           β”œβ”€β”€ SupportPage.jsx
    β”‚   β”‚           └── components/
    β”‚   β”‚               β”œβ”€β”€ CreateTicketSection.css
    β”‚   β”‚               β”œβ”€β”€ CreateTicketSection.jsx
    β”‚   β”‚               β”œβ”€β”€ HeroSection.css
    β”‚   β”‚               └── HeroSection.jsx
    β”‚   β”‚
    β”‚   β”‚
    β”‚   └── shared/
    β”‚      β”œβ”€β”€ components/
    β”‚      β”‚   β”œβ”€β”€ footer/
    β”‚      β”‚   β”‚   β”œβ”€β”€ Footer.css
    β”‚      β”‚   β”‚   └── Footer.jsx
    β”‚      β”‚   β”‚
    β”‚      β”‚   β”œβ”€β”€ header/
    β”‚      β”‚   β”‚   β”œβ”€β”€ Header.css
    β”‚      β”‚   β”‚   └── Header.jsx
    β”‚      β”‚   β”‚
    β”‚      β”‚   β”œβ”€β”€ notFoundPage/
    β”‚      β”‚   β”‚   β”œβ”€β”€ NotFoundPage.css
    β”‚      β”‚   β”‚   └── NotFoundPage.jsx
    β”‚      β”‚   β”‚
    β”‚      β”‚   β”œβ”€β”€ openAccount/
    β”‚      β”‚   β”‚   β”œβ”€β”€ OpenAccount.css
    β”‚      β”‚   β”‚   └── OpenAccount.jsx
    β”‚      β”‚   β”‚
    β”‚      β”‚   β”œβ”€β”€ protectedRoute/
    β”‚      β”‚   β”‚   └── ProtectedRoute.jsx
    β”‚      β”‚   β”‚
    β”‚      β”‚   └── themeToggle/
    β”‚      β”‚       β”œβ”€β”€ ThemeToggle.css
    β”‚      β”‚       └── ThemeToggle.jsx
    β”‚      β”‚
    β”‚      β”œβ”€β”€ context/
    β”‚      β”‚   β”œβ”€β”€ ThemeContext.jsx
    β”‚      β”‚   └── ThemeProvider.jsx
    β”‚      β”‚
    β”‚      β”œβ”€β”€ hooks/
    β”‚      β”‚   └── useTheme.js
    β”‚      β”‚
    β”‚      β”œβ”€β”€ layouts/
    β”‚      β”‚   β”œβ”€β”€ DashboardLayout.css
    β”‚      β”‚   β”œβ”€β”€ DashboardLayout.jsx
    β”‚      β”‚   └── MainLayout.jsx
    β”‚      β”‚
    β”‚      └── meta/
    β”‚          β”œβ”€β”€ MetaWrapper.jsx
    β”‚          β”œβ”€β”€ PageMeta.jsx
    β”‚          └── pageTitles.js
    β”‚
    β”œβ”€β”€ index.html
    └── package.json

API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/signup Register a new user
POST /api/auth/login User login

Trading

Method Endpoint Description
POST /api/trade/execute Execute a trade

Orders

Method Endpoint Description
GET /api/orders Get all orders
POST /api/orders Create a new order

Holdings

Method Endpoint Description
GET /api/holdings Get all holdings
POST /api/holdings Add a new holding

Positions

Method Endpoint Description
GET /api/positions Get all positions
POST /api/positions Add a new position

Bids

Method Endpoint Description
GET /api/bids Get all bids
POST /api/bids Create a new bid
DELETE /api/bids/:id Delete a bid by ID

Funds

Method Endpoint Description
GET /api/funds Get all funds
POST /api/funds Add a new fund

All API routes were tested using Thunder Client.


Usage

  • Users can buy and sell assets and manage orders, holdings, positions, bids, and funds in real time.
  • Users can track investment performance with interactive dashboards, charts, and heatmaps.
  • Users can search and filter assets to quickly find stocks or funds of interest.
  • Users can switch between light and dark themes for a personalized experience.
  • Secure authentication and authorization protect user accounts and transactions.
  • Admins can manage users and monitor transactions to ensure platform integrity.
  • Proper error handling displays informative messages, including a β€œPage Not Found” for invalid URLs.
  • Fully responsive UI ensures a smooth experience across all devices.

Demo User

Use the demo account below to explore the dashboard, orders, holdings, bids, and trading features without signing up:

Credential Value
Email tradeflowadmin@gmail.com
Password admin@123

Local Setup for Developers

To set up TradeFlow locally, follow these steps:

  1. Fork the repository on GitHub and clone it

    git clone <your-forked-repo-url>
  2. Install backend dependencies

    cd backend
    npm install
  3. Install frontend dependencies

    cd frontend
    npm install
  4. Set up environment variables

Create a .env file inside the backend folder and add:

 MONGO_URI=your-mongodb-connection-string
 JWT_SECRET=your-jwt-secret

JWT_SECRET can be any random string used to sign authentication tokens.

Create a .env file inside the frontend folder and add:

 VITE_API_URL=http://localhost:8080

This connects the frontend to your local backend server.

  1. Start the development servers

Backend:

 cd backend
 npm run dev

Frontend:

  cd frontend
  npm run dev

Both servers run in development mode. The frontend port may vary depending on your system.

  1. Visit the application

Open the URL displayed in the terminal (usually http://localhost:5173) in your browser to use the frontend.


Testing

TradeFlow includes unit tests for critical UI components using Vitest and React Testing Library.

Currently, the Signup Page functionality is tested to ensure:

  • The signup form renders correctly
  • All input fields appear
  • Users can type into fields
  • The signup button exists
  • API calls are triggered correctly
  • Error messages appear when signup fails

Run Tests

  cd frontend
  npm run test

Test Results

The tests for the Signup Page ran successfully, confirming the expected behavior of the form components, API integration, and error handling.

Signup Page Test Results


All tests passed successfully, ensuring that the Signup Page is reliable and functions as intended.


Developer

Developed by LinkedIn GitHub
Harshal Waghmare LinkedIn GitHub

About

TradeFlow is a fully responsive full-stack trading platform that simulates a real-world stock trading experience. It allows users to execute trades, manage portfolios, and track orders, holdings, positions, bids, and funds through an interactive dashboard with secure authentication, portfolio analytics, charts, and a user-friendly interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors