How landont168/stockle works
Project Type & Purpose
• The project is a full-stack application that combines a React-based single-page frontend with a Node.js/Express backend backed by MongoDB. A Python script is used to preprocess and load historical stock data.
• The purpose is to allow players to guess a stock (from a curated list) based on clues, thereby combining game logic with market data insights.
• Frontend:
• Built with React, utilizing Redux for state management and Material UI for styling. It includes components for game UI, charts (using Chart.js), forms (login/signup), and various interactive elements.
• Backend:
• Developed with Node.js and Express, it manages API endpoints for stock data, user operations, and authentication (JWT, bcrypt).
• Controllers, models, routes, and utility middleware for secure and organized API handling.
• Database:
• MongoDB (likely MongoDB Atlas) that stores user information, historical stock data (inserted via the Python script), and game state.
• Data Processing:
• A Python script (get_stock_data.py) within the backend/scripts directory processes CSV files and uses yfinance to gather historical stock data that is stored in MongoDB.
• Deployment & Containerization:
• Docker is used extensively, with separate Dockerfiles for the frontend and backend, and a docker-compose.yml file to orchestrate multi-container setup.
• Deployment tools include Vercel for the frontend and AWS (ECR, ECS, EC2, and a load balancer) for the backend.
Relationships & Interactions
• The frontend communicates with the backend APIs (for user authentication, fetching stock data, etc.) using RESTful endpoints.
• The backend interacts with the MongoDB database to store/retrieve data.
• The Python script independently fetches stock data and uploads it to the database; it might be triggered manually during data setup or as a scheduled job.
• Docker Compose links the frontend and backend containers ensuring they're networked together.
• Deployment interactions include pulling Docker images (backend from AWS ECR) and hosting the frontend on Vercel.
Architectural Patterns & Design Principles
• Separation of concerns: The clear separation between the frontend and backend, with dedicated directories and Docker configurations.
• MVC-like structure for the backend: Controllers (handling routes/logic), models (defining data structures), and utilities (middleware/configurations).
• Flux architecture in the frontend using Redux, with state management, reducers, and custom hooks managing game and UI state.
• Containerization and microservices principles: Each part (frontend, backend, data processing) is containerized for deployment and scaling.
Final Detailed Steps for the Principal Software Engineer
• Bidirectional communication between the frontend and backend.
• Backend’s operations toward the database.
• A side module for the Python script that feeds data into MongoDB.
• Containerization:
• A note or container boundary to represent Docker for both the frontend and backend services.
• Optionally, incorporate deployment endpoints like Vercel for the frontend and AWS ECS for the backend.