How smartsood/invest-iq-finance-demo works
Project type and purpose
• This is a single-page React frontend served by Vite, paired with an Express-style Node.js backend (in src/server.js), a data layer (models/), and several external services (Polygon, Google Translate, Google Sign-In).
• The system supports user authentication, portfolio and trend analysis, learning modules, and multilingual text services.
File structure
• Top level:
• package.json, vite.config.js, eslint.config.js: build & lint config
• index.html: Vite entry
• models/: domain/entity schemas (levels, module, user)
• public/: static assets
• src/:
– main.jsx, App.jsx: React entry point & root component
– component/: UI components (Auth, Dashboard, Analysis, Learning, ChatBot, etc.)
– context/: React Context providers (Auth, Translation, XP)
– hooks/: custom hooks (useTranslation, useGoogleTranslate)
– middlewares/, routes/, services/: backend logic
– server.js: sets up Express server & middleware
• Architectural patterns:
• Frontend: SPA with React Context and custom hooks
• Backend: MVC-style (routes → controllers/services → models)
• Shared services: caching, external API wrappers (polygonService, translationService)
README
• Confirms React + Vite setup, Fast Refresh, ESLint.
Main components & interactions
a. Frontend (React/Vite)
• Components: LoginPage, DashboardLayout, Analysis pages, Learning modules, ChatBot
• Contexts for auth, translation, XP
• Communicates via HTTP/REST to backend API
b. Backend (Node.js/Express)
• Routes: /auth (in routes/auth.js) and other protected routes
• Middlewares: cache.js, ProtectedRoute logic
• Controllers/Services: polygonService (market data), translationService (calls Google Translate API)
• Models: user, module, levels (persisted in a database, e.g. MongoDB)
c. Database
• A document-oriented store (likely MongoDB) hosting user/module/levels collections
d. External services
• Google OAuth for Sign-In
• Polygon API for financial data
• Google Translate API for multilingual support
Architectural patterns & principles
• Separation of concerns:
• UI (React) vs. API (Express) vs. Data (DB)
• MVC/Layered architecture on backend
• SPA with client-side routing and protected routes
• Context API for cross-cutting concerns (auth, translation, XP)
• Use of middleware for caching & auth checks
• Component subdivisions for clarity, but avoid over-cluttering