How srajankharvi/trade-analysis works
Trade Analysis is a trading journal with account access, trade entry and review, performance analytics, and a market chart with backtesting actions. The frontend routes authenticated users to these workflows; the Express backend mounts authentication, trade, and analytics APIs backed by MongoDB models. The chart also fetches market data directly from Binance. Analytics calculation is present as a separate FastAPI service. Several page, controller, and analytics-route implementations were not sampled, so their internal wiring is left unspecified.
Main entry points: Layout.tsx App navigation · App.tsx Route shell · index.ts API server · TradingChart.tsx Market chart
Components 24
Trading interface
- Route shell
frontend/src/App.tsx - Session context
frontend/src/context/AuthContext.tsx - App navigation
frontend/src/components/Layout.tsx - Sign in
frontend/src/pages/Login.tsx - Registration
frontend/src/pages/Register.tsx - Dashboard
frontend/src/pages/Dashboard.tsx - Trade journal
frontend/src/pages/Trades.tsx - Trade entry
frontend/src/pages/AddTrade.tsx - Analytics view
frontend/src/pages/Analytics.tsx - Market chart
frontend/src/pages/TradingChart.tsx
Application API
- API server
backend/src/index.ts - Auth routes
backend/src/routes/auth.ts - Auth handlers
backend/src/controllers/auth.ts - Auth middleware
backend/src/middleware/auth.ts - Trade routes
backend/src/routes/trade.ts - Trade handlers
backend/src/controllers/trade.ts - Analytics route
backend/src/routes/analytics.ts
Persistence
- User records
backend/src/models/User.ts - Trade records
backend/src/models/Trade.ts
Analytics service
- Analytics calculation
analytics/main.py
Other components
- Trader
- MongoDB
- Binance market API
- Browser storage
Connections 23
- Trader → Route shell: uses
- Route shell → Session context: provides session
- Route shell → Sign in: routes
- Route shell → Registration: routes
- Route shell → App navigation: protects routes
- App navigation → Dashboard: routes
- App navigation → Trade journal: routes
- App navigation → Trade entry: routes
- App navigation → Analytics view: routes
- App navigation → Market chart: routes
- Session context → Browser storage: reads/writes
- API server → Auth routes: mounts
- API server → Trade routes: mounts
- API server → Analytics route: mounts
- Auth routes → Auth handlers: dispatches
- Auth handlers → User records: reads/writes
- Trade routes → Auth middleware: guards
- Trade routes → Trade handlers: dispatches
- Auth middleware → User records: loads user
- Trade handlers → Trade records: reads/writes
- API server → MongoDB: connects
- Market chart → API server: requests trades
- Market chart → Binance market API: fetches market data