How being-underscore-me-dot-rajat/stockinews works
Project Type and Purpose
• This is a full-stack web application (“StockiNews”) combining a Vite+React SPA on the frontend with a Python Flask REST API on the backend.
• Purpose: empower Indian retail investors with portfolio management, live stock/market monitoring, sentiment analysis, and curated news within one unified dashboard.
File Structure
• Top-level:
• public/ (static assets served by Vite)
• src/ (all source code)
– App.jsx, routing, CSS
– Feature folders: Login, Portfolio, Sentiment, Stock, dashboard, home
– backend/ (Flask API, controllers: add.py, delete.py, get.py, auth.py, companies.py, portfolios.py, ticker_data.py; models and setupdb; stockinews.db; .env)
• Build/config files: package.json, vite.config.js, eslint.config.js, index.html.
• Tests: App.test.js, setupTests.js.
Extract Key Architectural Insights from the README
• Two-tier architecture: decoupled React frontend <→ Flask backend over REST.
• JWT authentication for protected routes.
• SQLite as the data store, with SQLAlchemy models.
• Chart.js on frontend for interactive charts, Bootstrap for UI.
• Potential external data sources: real-time stock price API, news API, sentiment-analysis engine.
Main Components & Their Relationships
• End User (Browser/Client)
• React/Vite Dev Server or Static Hosting
• Frontend Application
• Feature Modules:
– Authentication (Login.jsx)
– Dashboard (Portfolio, MarketWatch, Watchlist, News)
– Stock Detail Page (Chartgen.jsx, SentimentGauge.jsx, News Feed)
• UI libraries: Bootstrap, Chart.js
• HTTP Client layer (Axios or fetch) attaching JWT in headers
• Backend REST API (Flask)
• Routing/Controllers: auth.py, add.py, delete.py, get.py, companies.py, portfolios.py, ticker_data.py
• Business Logic: portfolio operations, P&L calculations, news aggregation, sentiment analysis
• JWT handling (PyJWT), CORS
• Data Layer
• SQLite database (stockinews.db) via SQLAlchemy models
• Initial data load from EQUITY_L.csv
• External Services (optional)
• Stock Price Feeds (WebSockets or REST)
• News API for headlines & sentiment analysis
Architectural Patterns & Design Principles
• Two-Tier / Client-Server: clear separation of concerns
• Feature-based modularity on frontend for maintainability
• RESTful resource-oriented API design on the backend
• Stateless JWT authentication
• MVC-style separation in Flask: controllers vs. models
• Single Page App (SPA) with client-side routing