About the Project
Stock Pie is an asset trading simulator and digital wallet application built with .NET Web API and React 19 + TypeScript + Tailwind CSS v4. It supports a complete trading lifecycle — from wallet funding via dual payment gateways (Stripe and Razorpay), asset discovery with live CoinGecko data, watchlist management, interactive price charts, instant buy/sell execution, to withdrawal logging with bank details hashing. A custom client-side cache layer prevents CoinGecko rate limiting. Auth supports local login, Google OAuth, and OTP-based passwordless login. Deployed to production on Render + Vercel + Neon PostgreSQL with a custom domain.
The Problem
Individual investors and finance enthusiasts lack a unified platform to simulate asset trading, track portfolio performance, manage a digital wallet, and handle fund flows all in one place. Existing tools are either too complex, paid, or do not support the full cycle from depositing funds to executing trades and withdrawing profits.
The Solution
Built a full trading simulator with a digital wallet at its core. Users deposit funds via Stripe or Razorpay, discover and track crypto assets via CoinGecko, add assets to a watchlist, buy and sell with real-time price execution, and request withdrawals to verified bank accounts. The backend handles payment intent creation, signature verification, wallet crediting, portfolio upserts with average buy price calculation, and bank account hashing for security.
Outcome & Results
A fully deployed production application live at stockpie.sadiklaliwala.me. Covers the full trading lifecycle with dual payment gateway integration, live market data with a rate-limit cache layer, interactive Recharts price graphs, peer-to-peer wallet transfers, OTP passwordless login, Google OAuth, dark/light theme, and a complete withdrawal management flow.
Challenges Faced
CoinGecko rate limiting: The public CoinGecko API aggressively throttles requests with HTTP 429 errors. Solved by building a client-side fetchWithCache wrapper in coinService.ts that caches responses for 5 minutes, eliminating redundant calls and keeping the dashboard responsive. Dual payment gateway integration: Stripe and Razorpay have completely different flows — Stripe uses Payment Intents and Elements on the frontend while Razorpay uses a native SDK popup with server-side signature verification. Both flows had to be implemented cleanly without coupling their logic. Silent token refresh with request queueing: When a 401 is returned mid-session, in-flight requests must not fail — they need to be paused, the token refreshed, and then replayed. Solved with an Axios response interceptor that queues pending requests during refresh and replays them on success, or logs the user out on failure. Bank account security: Storing bank account numbers in plain text is a security risk. Solved by storing only a SHA256 hash for validation and the last 4 digits for display — the full number is never persisted. Portfolio upsert with average buy price: Buying the same asset multiple times must update quantity and recalculate the average buy price correctly. On complete liquidation via sell, the portfolio record must be deleted. Implemented as an upsert with weighted average price calculation in the trading service.
What I'd Do Differently
Real brokerage API integration (Alpaca or Interactive Brokers) to replace simulated execution with actual market orders. Price alerts — notify users via email or push notification when an asset crosses a set price threshold. Portfolio analytics — gain/loss charts over time, asset allocation pie chart, and performance vs market benchmarks. Recurring buy (DCA) — allow users to schedule automatic periodic purchases of a chosen asset. Admin dashboard — withdrawal processing UI, user management, wallet balance overview, and payment order audit log.