π§ Status: Active Development
Quantify is a full-stack simulated trading platform built using the MERN stack, designed to replicate core functionalities of real-world trading systems. It focuses on high-performance backend system design, secure transaction handling, and seamless data interaction.
- JWT (JOSE): Secure user authentication and session management.
- Middleware Protection: Custom authentication middleware to guard private routes.
- HTTP Security: Integrated
Helmet.jsfor setting secure headers. - Rate Limiting: (In Progress) Redis-backed rate limiting to prevent API abuse.
- Dynamic Watchlists: User-specific stock tracking with real-time price data simulation.
- Stock Analytics: Interactive charts for detailed price analysis and trend monitoring.
- Live Tracking: Dynamic portfolio valuation based on current market prices.
- Holdings Management: Automated calculation of Profit/Loss (P&L) and total asset value.
- Simulated Orders: Seamless Buy/Sell execution logic.
- Atomic Updates: Ensures database consistency across portfolio and transaction logs.
- Validation: Server-side checks for sufficient balance and stock quantity.
- Frontend: React.js, React-Bootstrap, Axios, React Router
- Backend: Node.js, Express.js
- Database: MongoDB (Mongoose)
- Caching/Security: Redis (In Progress), JWT, Helmet.js, CORS
- Package Manager:
pnpm
graph TD
subgraph Client_Side [Frontend - React.js]
A[User Interface] --> B[State Management]
B --> C[Axios / API Calls]
end
subgraph Security_Layer [Middleware]
C --> D{JWT Authenticator}
end
subgraph Server_Side [Backend - Node.js/Express]
D -- Authorized --> E[Controllers]
E --> F[User Controller]
E --> G[Portfolio Controller]
E --> H[Watchlist Controller]
E --> I[Transaction Controller]
end
subgraph Database_Layer [Data - MongoDB]
F <--> J[(Users Collection)]
G <--> K[(Portfolios Collection)]
H <--> L[(WatchLists Collection)]
I <--> M[(Transactions Collection)]
end
%% Styling
style Client_Side fill:#e1f5fe,stroke:#01579b
style Server_Side fill:#fff3e0,stroke:#e65100
style Database_Layer fill:#e8f5e9,stroke:#1b5e20
style Security_Layer fill:#fce4ec,stroke:#880e4f
sequenceDiagram
participant User as User (React)
participant API as API Gateway (Express)
participant Auth as JWT Middleware
participant DB as MongoDB
User->>API: GET /watchlist
API->>Auth: Verify Token
Auth-->>API: Token Valid
API->>DB: WatchList.find()
DB-->>API: Data
API-->>User: JSON Response
Quantify/
β
βββ backend/
β βββ models/
β βββ routes/
β βββ controllers/
β βββ middleware/
β βββ config/
β βββ server.js
β
βββ frontend/
β βββ src/
β β βββ components/
β β βββ pages/
β β βββ services/
β β βββ App.jsx
β β βββ main.jsx
β βββ index.html
β
βββ .env
βββ pnpm-workspace.yaml
βββ package.json
βββ README.md
Backend-Folder Structure
backend/
β
βββ src/
β βββ config/
β β βββ db.js # MongoDB connection
β β
β βββ models/
β β βββ User.model.js
β β
β βββ controllers/
β β βββ auth.controller.js
β β
β βββ routes/
β β βββ auth.routes.js
β β
β βββ middlewares/
β β βββ auth.middleware.js
β β
β βββ app.js
β βββ server.js
β
βββ .env
βββ package.json
βββ README.md
---
This project serves as a deep dive into backend system design and security. I document my architectural decisions, failures, and technical breakthroughs in a multi-part blog series:
- Part 1: Architectural Foundations β Initial system scoping, setting up the MERN workspace, and defining data schemas.
- Part 2: Designing Robust Authentication β Implementing asymmetric JWT structures, writing clean custom middleware, and hardening HTTP headers.
- Part 3: Refining the Repository Structure β Refactoring a chaotic monolithic directory into a modular MVC architecture for scalable feature deployment.
- Challenge: Early development led to a cluttered root directory where frontend and backend configurations leaked into one another, making deployments error-prone.
- Solution: Migrated to a strict monorepo layout using
pnpm-workspace. Separated domain logic into dedicatedbackend/src/subfolders matching standard MVC patterns.
- Challenge: Securing simulated portfolio and transaction data without introducing heavy database queries on every authenticated request.
- Solution: Built a reusable, custom Express middleware leveraging the
JOSEecosystem for lightweight JWT validation, verifying incoming tokens deterministically before exposing controllers.
Initial frontend boilerplate was generated using AI tools (Google Antigravity) (SignUp,login and Services Pages Only) and then customized and extended manually.
- Node.js (v18+ recommended)
- PNPM
- MongoDB (local or Atlas)
npm install -g pnpmgit clone https://github.com/jayalloyd/quantify.git
cd Quantifypnpm installcd backend
pnpm run devcd frontend
pnpm run devFrontend will run on:
http://localhost:5173
Backend will run on:
http://localhost:5000
Create a .env file inside backend/:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
- WebSocket-based live price updates
- Payment gateway integration
- Role-based admin dashboard
- Advanced charting (TradingView)
- Watchlists & alerts
This project is for educational purposes only and is a demo project and is not affiliated with any trading platform.
Quantify
Jaya Rani.Y.S
Linkedin:jayarani y s Github: jayalloyd