How aryan7691/stockerr-main works
Project type and purpose
• Stocker is a full-stack web application for simulated stock trading (ReactJS front end, Express/Node back end) plus a separate Discord bot for on-demand stock quotes and alerts.
• It provides real-time stock data, financial news, user authentication, virtual currency management, and chatbot commands driven by Alpha Vantage API.
File structure
• Top-level directories:
• client/ : React application (public, src, components, context)
• server/ : Express REST API (config, controllers, models, routes, server.js)
• bot/ : Standalone Node.js Discord bot (commands, alphaVantage.js, index.js)
• Shared config files: package.json for each module, .gitignore, static.json
• server/config/stocksData.js holds API keys or endpoints
• Routes/controllers/models follow MVC-style pattern in server/
README for additional insights
• Tech stack: React, Express, Node.js, Nodemon
• No explicit DB in README, but server/models indicate a database (likely MongoDB via Mongoose)
• Features: real-time data, virtual currency, charts, news integration
Main components and their interactions
a. Frontend (React):
• User Interface: Authentication pages, Dashboard, Search pages, Charts, Modals
• Communicates via REST (HTTPS) with the backend
b. Backend API (Express/Node):
• AuthController, UserController → handle signup/login, user virtual wallet
• StockController, DataController, NewsController → fetch data from Alpha Vantage & news APIs
• Models (User, Stock) → persist user data, trade history, portfolio in Database
c. Database:
• Stores user credentials, portfolio balances, transaction records
d. External Services:
• Alpha Vantage API (stock quotes, historical data)
• News API or RSS feed for financial news
e. Discord Bot:
• Listens on Discord, handles slash commands (quote, search, autosearch)
• Uses alphaVantage.js internally to fetch data directly from Alpha Vantage
Architectural patterns and design principles
• 3-tier architecture: Presentation (client), Application/API (server), Data (DB)
• MVC on the server: routes → controllers → models
• Modular separation: client, server, and bot are deployable services
• Single-page application in React with context for user state