Introduction to MarketSage
Relevant source files
The following files were used as context for generating this wiki page:
MarketSage (also referred to as Market Oracle) is an AI-powered financial analytics and investment insights platform designed as an intelligent assistant for marketplace users. It specifically targets Chinese marketplaces like Temu, AliExpress, and DHgate, providing advanced automation, scam detection, and price intelligence.
The system operates primarily as a Chrome Extension, leveraging machine learning (TensorFlow.js) and reactive programming (RxJS) to analyze marketplace listings in real-time. It provides users with security alerts, price predictions, and social commerce analytics to facilitate safer and more informed purchasing decisions.
Sources: WHATAMI.txt:3-12, package.json:20-25, src/manifest.json:2-10
System Architecture
MarketSage is architected as a browser extension (Manifest V3) consisting of several decoupled modules that communicate via message passing. The core logic is split between background service workers, content scripts, and a React-based popup interface.
Core Components
| Component | Description |
|---|---|
| Background Service | Manages the extension lifecycle, coordinates services via ServiceManager, and handles cross-tab analysis. |
| Smart Shopping Assistant | An NLP-driven module that processes natural language queries to find products or perform safety checks. |
| Security Analyzer | Evaluates risk factors including seller history, listing quality, and scam keywords. |
| Price Prediction Engine | A TensorFlow.js powered module that predicts future price trends and optimal buying times. |
| Social Analytics | Tracks engagement metrics, viral content, and community-driven commerce trends. |
Sources: src/manifest.json:15-28, src/background/background.ts:4-10, src/core/ai/SmartShoppingAssistant.ts:80-90, src/core/ai/PricePredictionEngine.ts:50-60
Extension Communication Flow
The following diagram illustrates how the extension interacts with the browser and the user's active tab.
AI and Machine Learning Capabilities
MarketSage utilizes several specialized AI engines to provide financial and security insights.
Price Prediction Engine
The PricePredictionEngine uses a neural network built with TensorFlow.js. It features a dense architecture with dropout layers to predict product prices based on a 15-feature input vector, including price history, market volatility, and seasonal factors.
- Model Architecture: A sequential model using ReLU activation and L2 regularization.
- Optimal Buy Logic: Recommends
buy_now,wait, orbuy_soonbased on predicted savings and trend confidence.
Sources: src/core/ai/PricePredictionEngine.ts:88-120, src/core/ai/PricePredictionEngine.ts:210-230
Security and Scam Detection
The SecurityAnalyzer calculates a riskScore by weighting multiple factors. It integrates a ScamDetectionModel to analyze product titles and descriptions for suspicious patterns.
Social Commerce and Insights
The platform includes a robust SocialCommerceAnalytics service that monitors community engagement and purchase influence.
Key Metrics Tracked
- Influence Metrics: Tracks top influencers, reach, and virality scores of content.
- Community Metrics: Monitors group purchase rates, collaborative purchases, and community health scores.
- Commerce Metrics: Measures socially influenced purchases and revenue attribution models (direct social vs. community-driven).
Sources: src/core/social/SocialCommerceAnalytics.ts:18-60, src/core/social/SocialCommerceAnalytics.ts:310-330
Analytics Data Flow
The system collects real-time metrics and stores them in local storage, providing periodic reports.
Project Structure and Configuration
MarketSage is built with a modern TypeScript stack, utilizing React for the UI and Webpack for bundling.
- Manifest Version: 3
- Permissions:
storage,activeTab,scripting. - Host Permissions: Enabled for
temu.com,aliexpress.com, anddhgate.com. - Key Dependencies:
@tensorflow/tfjs,rxjs,react,@reduxjs/toolkit, andaxios.
Sources: src/manifest.json:2-14, package.json:20-30
Build Verification
A specialized script scripts/verify-build.js ensures project integrity before deployment. It checks for:
- Valid
package.jsonand required dependencies. - Existence of
tsconfig.jsonwith strict mode enabled. - Proper
manifest.jsonstructure for Chrome extension compliance. - Essential files like
StateManager.tsandErrorHandler.ts.
Sources: scripts/verify-build.js:15-80
Conclusion
MarketSage represents a sophisticated integration of AI and browser extension technology, specifically tailored for the financial analytics of global marketplaces. By combining real-time security scanning with predictive price modeling and social engagement tracking, it provides a comprehensive toolset for modern marketplace participants.