How keval101/trade-tracker works
1. Repository shape
- This is a single-page Angular 16 application with a mostly client-side architecture.
- The app is organized around business features in src/app/components, plus a small set of cross-cutting services, guards, and shared UI components.
- There is no traditional long-running backend in the repo; the main server-side pieces are lightweight API endpoints under api/ plus Firebase-managed backend services.
2. Primary runtime and deployment model
- The frontend runs as an Angular SPA in the browser.
- The repo is set up for modern deployment targets like Vercel and Firebase hosting/config (vercel.json, firebase.json).
- Environment values are generated at build/start time by scripts/generate-env.js, which turns env variables into Angular environment configuration.
3. Authentication boundary
- Firebase Authentication is the identity boundary for the app.
- src/app/service/auth.service.ts centralizes login/signup/session logic.
- src/app/guards/auth.guard.ts protects authenticated routes.
- src/app/interceptor/auth.interceptor.ts adds auth-related request handling for outbound HTTP calls, so protected API access stays consistent across the app.
4. Data persistence boundary
- Firebase is also the main persistence layer, likely through Firestore and Storage based on the README and file layout.
- User profile, funds, trades, sheets, stocks, and related records appear to be managed through Angular services rather than a custom backend.
- Profile image upload support in the account area suggests Firebase Storage is part of the storage path.
5. Market-data integration boundary
- Live NSE market data is handled separately from the trading data model.
- The api/nse-index.ts and api/nse-search.ts endpoints, together with proxy.conf.json, indicate a proxied API boundary for fetching index values and stock search/autocomplete data.
- src/app/service/market-data.service.ts and src/app/service/nse-data.service.ts are the client-side abstraction layer for this external data.
6. Application shell and global UI
- AppComponent plus shared components form the persistent shell around the feature pages.
- src/app/shared/sidenav is the main navigation container.
- src/app/shared/loader and src/app/shared/screen-loader indicate global loading states.
- src/app/shared/logo is a reusable branding component.
- The README’s “market ticker appears at the top of all pages” behavior is likely implemented in this shell layer.
7. Feature area: dashboard and analytics
- src/app/components/dashboard is the landing/summary view for live market status, charts, and performance snapshots.
- src/app/components/overview and src/app/components/calculate-stoploss support analytics and trading decision tools.
- These screens likely combine internal financial data with external market data to render weekly performance and ROI views.
8. Feature area: trade management
- src/app/components/trades handles the core trade ledger: add/delete and list trades.
- The component split suggests a parent list page plus modal/dialog-style child workflows for create/delete actions.
- This area is one of the main producers of financial metrics used elsewhere in the app.
9. Feature area: trade sheets
- src/app/components/trade-sheet models planned trading campaigns or daily tracking sheets.
- The sheet flow includes a form, entry dialog, and delete dialog, so the page likely supports creating a sheet and then appending daily P/L entries.
- This subsystem is separate from raw trades and looks aimed at planning versus executed trade history.
10. Feature area: account and funds
- src/app/components/account is the user profile and financial account workspace.
- It includes profile editing, fund add/delete workflows, and a dedicated fund dialog.
- This is where user-level metadata, deposits, withdrawals, and summary balances are maintained.
11. Feature area: stock portfolio
- src/app/components/stocks manages a stock watch/holdings style portfolio.
- Add/delete subcomponents and the README’s “quick search” imply integration with NSE search data for symbol lookup.
- This area bridges internal portfolio records with live market identity data.
12. Auxiliary feature areas
- src/app/components/holiday-list provides holiday/calendar awareness, likely used to determine market open/closed state.
- src/app/components/login and signup are the entry points into the authenticated flow.
- These are smaller, but they support the overall market-status and user onboarding story.
13. Data flow through the app
- User actions start in routed feature components, move into Angular services, and then either:
- persist to Firebase-backed data stores, or
- fetch live NSE data via the api/ endpoints.
- The resulting data is then rendered by dashboard, overview, trades, sheets, stocks, and account screens.
- Shared shell components keep navigation, loaders, and ticker-like UI consistent across routes.
14. Styling, UI system, and build tooling
- The UI stack is Angular plus Tailwind CSS, with SCSS used per component for local styling.
- angular.json, tailwind.config.js, and postcss.config.js define the front-end build pipeline.
- The repo includes standard Angular testing setup, but the architecture is primarily driven by routed components and reusable services rather than a separate state-management library.
Main entry points: data.service.ts Data service · app.component.ts App shell · auth.guard.ts Auth guard · vercel.json Deploy config
Components 24
Angular SPA
Browser-based application shell and routed feature pages.
- App shell · Persistent application frame around routed pages and global UI.
src/app/app.component.ts - Side nav · Primary navigation container used across the app.
src/app/shared/sidenav/sidenav.component.ts - Loader · Shared loading indicator for app-wide async states.
src/app/shared/loader/loader.component.ts - Screen loader · Full-screen loading state used during blocking transitions.
src/app/shared/screen-loader/screen-loader.component.ts
Business features
Main user-facing workflows organized under app components.
- Login · Sign-in entry point for authenticated access.
src/app/components/login/login.component.ts - Signup · Account creation entry point.
src/app/components/signup/signup.component.ts - Dashboard · Landing page for market status, charts, and performance snapshots.
src/app/components/dashboard/dashboard.component.ts - Overview · Performance and ROI analysis screen for the trading history.
src/app/components/overview/overview.component.ts - Stoploss tool · Trading decision aid for calculating stop-loss levels.
src/app/components/calculate-stoploss/calculate-stoploss.component.ts - Trades · Core trade list and add/delete workflows.
src/app/components/trades/trades.component.ts - Trade sheet · Planned trading campaigns and daily P/L entry flow.
src/app/components/trade-sheet/trade-sheet.component.ts - Account · User profile, balances, and fund management workspace.
src/app/components/account/account.component.ts - Stocks · Stock holdings/watchlist management with symbol lookup.
src/app/components/stocks/stocks.component.ts - Holiday list · Market holiday awareness for trading context.
src/app/components/holiday-list/holiday-list.component.ts
Core services
Authentication, data access, and market-data integration boundaries.
- Auth service · Centralized login, signup, and session handling.
src/app/service/auth.service.ts - Data service · Shared persistence access for user and trading records.
src/app/service/data.service.ts - Market data · Client-side abstraction over live market data requests.
src/app/service/market-data.service.ts - NSE data · Specialized service for NSE index and search data.
src/app/service/nse-data.service.ts - Auth guard · Protects authenticated routes.
src/app/guards/auth.guard.ts - Auth interceptor · Adds auth-related handling to outbound HTTP calls.
src/app/interceptor/auth.interceptor.ts
Platform
API endpoints, build-time env generation, and deployment config.
- NSE index API · Proxied endpoint for index values.
api/nse-index.ts - NSE search API · Proxied endpoint for stock search and autocomplete.
api/nse-search.ts - Env generator · Generates Angular environment values from process env.
scripts/generate-env.js - Deploy config · Platform configuration for hosting and proxying.
vercel.json
Connections 35
- App shell → Side nav: renders · Shell includes persistent navigation.
- App shell → Loader: hosts · Global loading indicator lives in the shell.
- App shell → Screen loader: hosts · Blocking load state is part of the shell.
- App shell → Dashboard: routes to · Default landing view after navigation.
- App shell → Login: routes to · Unauthenticated entry page.
- App shell → Signup: routes to · Account creation page.
- App shell → Overview: routes to · Analytics page accessible from the shell.
- Auth guard → Dashboard: protects · Authenticated routes are guarded.
- Auth guard → Overview: protects · Authenticated routes are guarded.
- Auth guard → Trades: protects · Authenticated routes are guarded.
- Auth guard → Trade sheet: protects · Authenticated routes are guarded.
- Auth guard → Account: protects · Authenticated routes are guarded.
- Auth guard → Stocks: protects · Authenticated routes are guarded.
- Auth service → Login: drives · Login page uses centralized identity logic.
- Auth service → Signup: drives · Signup page uses centralized identity logic.
- Auth interceptor → Data service: secures · HTTP calls are decorated for authenticated access.
- Data service → Trades: persists · Trade ledger reads and writes shared records.
- Data service → Trade sheet: persists · Trade sheet data is stored through shared services.
- Data service → Account: persists · Profile and fund data are managed through services.
- Data service → Stocks: persists · Portfolio records are managed through shared services.
- Market data → NSE data: wraps · Market service builds on the NSE-specific abstraction.
- NSE data → NSE index API: fetches · Live index data comes through serverless endpoint.
- NSE data → NSE search API: fetches · Search/autocomplete data comes through serverless endpoint.
- Dashboard → Market data: consumes · Dashboard mixes internal and external market inputs.
- Overview → Data service: analyzes · Overview uses internal performance data.
- Stoploss tool → Market data: consumes · Stop-loss calculations use market inputs.
- Stocks → NSE data: searches · Stock lookup relies on live NSE search data.
- Account → Data service: updates · Profile edits and fund actions persist through services.
- Trade sheet → Data service: updates · Sheet entries and deletes persist through services.
- Trades → Data service: updates · Add and delete trade workflows persist through services.
- Env generator → Deploy config: feeds · Generated environment values support deployment targets.
- Deploy config → App shell: hosts · SPA is deployed through hosting configuration.
- Deploy config → NSE index API: routes · Proxy/configuration supports API boundary.
- Deploy config → NSE search API: routes · Proxy/configuration supports API boundary.
- Holiday list → Dashboard: supports · Holiday context informs market-status views.