How wenjuinchuah/stock_view_frontend works
Project type and purpose
• This is a single-page web application (SPA) built with Vue 3 and Vite.
• It serves as the frontend for “Stock View,” retrieving and displaying stock data, letting users configure screeners and chart settings, and managing real-time notifications.
File structure
• Top-level:
– public/ (static assets: GIFs, SVGs, HTML entry)
– src/ (application code)
– Dockerfile, config files (.eslintrc, .prettierrc, tsconfig, vite.config.ts)
• src/ breakdown:
– main.ts, App.vue, index.html (bootstrapping)
– components/ (reusable UI components)
– views/ (page-level view: DashboardView.vue)
– stores/ (Pinia stores for each feature)
– services/ (FormatService, HttpService for cross-cutting concerns)
– classes/ (domain models: Stock, StockDetails, Notification, etc.)
– enums/ (shared enums for HTTP statuses, indicators, intervals)
Extract insights from the README
• Confirms it’s purely frontend, run via npm run dev or built for production.
• No mention of internal database – it relies on an external backend API.
Main components (to include
a. UI Layer
– Components (AddRule, StockChart, StockScreener, etc.)
– Views (DashboardView)
– Assets (public folder)
b. State Management Layer
– Pinia Stores (e.g., StockScreenerStore, NotificationStore)
c. Domain Model Layer
– Classes (Stock, StockIndicator, StockScreener, etc.)
d. Service Layer
– HttpService (handles API calls to backend)
– FormatService (normalizes data into domain models)
e. External Systems
– Backend API (stock data provider)
– Optional: Notification service if separate
Relationships & data flows
• User → UI Component → Store Action
• Store Action → HttpService → Backend API
• API Response → HttpService → FormatService → Domain Class instance
• Domain instance → Store Mutation → UI updates via reactive bindings
• Notification events propagate from service/store → NotificationToast component
Architectural patterns & design principles
• Component-based MVVM (Vue components bound to Pinia stores)
• Single source of truth via Pinia state management
• Separation of concerns:
– Presentation (components/views)
– Business logic (stores, classes)
– Data access (services)
• Dependency inversion: UI doesn’t call fetch directly – it goes through HttpService.
Details but avoid clutter
• One representative component per feature (e.g., StockChart → StockChartStore → Stock → HttpService).
• Major folder from src/ is visibly represented in the correct layer.