Predict when trends collapse, understand why they decline, and act before it's too late.
TrendLens AI is an explainable Generative AI system that predicts when and why social media trends (memes, hashtags, viral topics) begin to lose momentum and eventually collapse. Unlike traditional trend analysis tools that focus only on growth, our system identifies early decline signals and provides clear, actionable explanations for each prediction.
Social media trends have a lifecycle: they emerge, peak, decline, and eventually fade. Organizations waste millions on marketing campaigns for trends that are already declining, miss opportunities to exit before saturation, and struggle to understand why trends fail.
Key Challenges:
- Reduced Engagement - Declining interaction rates signal trend fatigue
- Influencer Disengagement - Key creators move on to new trends
- Algorithmic Shifts - Platform algorithms deprioritize saturated content
- Content Saturation - Market oversaturation leads to audience fatigue
- Audience Fatigue - Users become desensitized to repetitive content
Business Impact:
- Wasted marketing spend on declining trends
- Missed opportunities to pivot strategies
- Inability to proactively manage trend risks
- Lack of understanding about trend lifecycle drivers
TrendLens AI combines multi-source data aggregation, explainable AI analysis, and actionable insights to provide a complete trend lifecycle prediction system.
- Early Decline Detection - Identify decline signals before they become obvious
- Explainable Predictions - Understand the "why" behind each prediction, not just the "what"
- Multi-Platform Analysis - Track trends across Instagram, TikTok, Reddit, Twitter, Spotify, and more
- Lifecycle Visualization - See where trends are in their lifecycle (Emerging → Rising → Peak → Declining → Fading)
- Actionable Recommendations - Get specific guidance on when to jump in, proceed with caution, or avoid
- Data Collection - Continuously scrape and aggregate data from multiple social platforms
- SMCE Scoring - Calculate trend health using Search Interest (S), Mention Velocity (M), Cultural Sentiment (C), and Engagement (E)
- AI Analysis - Use Generative AI to analyze patterns and predict decline trajectories
- Explainability - Generate human-readable explanations for each prediction
- Visualization - Present insights through interactive dashboards and 3D network graphs
Track and predict the lifecycle of any social media trend in real-time.
- Real-time Tracking - Monitor trends with live score updates
- Lifecycle Stages - Visualize where trends are (Emerging, Rising, Peak, Declining, Fading)
- Score Breakdown - See SMCE components (Search, Mentions, Culture, Engagement)
- Trend Cards - Beautiful card-based interface showing trend health at a glance
- Historical Analysis - View trend history with interactive sparkline charts
Key Metrics:
- Current Score (0-100)
- Percent Change (growth/decline rate)
- SMCE Breakdown
- Source distribution across platforms
Deep-dive analysis tool for understanding trend dynamics and decline factors.
- Multi-Platform Sentiment - Analyze sentiment across TikTok, Instagram, Reddit, Twitter
- Engagement Patterns - Identify engagement velocity changes
- Cultural Context - Understand cultural relevance and mainstream adoption
- Risk Factors - Identify potential decline drivers
- Opportunity Detection - Find revival or pivot opportunities
- Explainable Insights - Get AI-generated explanations for trend behavior
Analysis Components:
- Platform-specific sentiment breakdown
- Engagement velocity trends
- Cultural vs. mainstream attention signals
- Early warning signals
- Brand impact assessment
AI-powered video content generation based on trending topics and lifecycle predictions.
- Trend-Based Content - Generate videos aligned with trending topics
- Lifecycle-Aware - Create content appropriate for trend stage
- Multi-Format Support - Generate variations for different platforms
- AI Captions - Auto-generate engaging captions
- Performance Prediction - Estimate video performance before publishing
Create marketing campaigns optimized for trend lifecycle stages.
- Trend Integration - Build campaigns around trending topics
- Stage-Specific Strategies - Different approaches for Emerging vs. Peak trends
- Multi-Week Planning - Plan campaigns across trend lifecycle
- Content Suggestions - AI-generated content ideas
- Risk Assessment - Evaluate campaign risks based on trend health
Multi-agent orchestration system for complex, multi-step campaign execution.
What is Orchestration? A BFS (Breadth-First Search) based simulation engine that explores thousands of possible campaign paths, scores them, and recommends optimal strategies.
Key Features:
- Path Simulation - Explore multiple campaign execution paths
- AI-Powered Scoring - Evaluate paths using AI analysis
- Pruning Engine - Automatically eliminate low-value paths
- Multi-Agent Coordination - Coordinate multiple AI agents for different tasks
- Session Management - Track orchestration sessions and results
- Final Recommendations - Get top-scored campaign paths with explanations
Orchestration Process:
- Initialize - Set up brand info, goals, and preferences
- Generate Paths - Create multiple campaign execution paths
- Score Nodes - Evaluate each path node using AI
- Prune - Remove low-performing paths
- Summarize - Generate AI summaries for top paths
- Recommend - Present best paths with explanations
Use Cases:
- Multi-platform campaign coordination
- Complex influencer collaboration strategies
- Long-term trend engagement planning
- Risk-optimized campaign execution
Advanced multi-agent system for complex social media analysis and decision-making.
- Agent Coordination - Multiple specialized AI agents working together
- Task Distribution - Distribute analysis tasks across agents
- Collaborative Analysis - Agents share insights and refine predictions
- Decision Support - Get multi-perspective recommendations
Frontend:
- React 19 with Vite
- Tailwind CSS + shadcn/ui components
- Framer Motion for animations
- React Three Fiber for 3D visualizations
- Recharts for data visualization
Backend:
- Express 5 (Node.js)
- MongoDB with Mongoose
- OpenAI GPT-4 for AI analysis
- Node-cron for scheduled tasks
- Puppeteer for web scraping
Data Sources:
- Instagram (Reels, Posts)
- TikTok
- Twitter/X
- Spotify
- Tavily (Web search)
- Google Trends
Scrapers:
- Instagram scraper (GraphQL + Magic Parameters)
- TikTok scraper
- Reddit API
- Twitter API
- Tavily API
Trends are scored using the SMCE Formula:
Score = 0.35×S + 0.30×M + 0.20×C + 0.15×E
Where:
- S (Search Interest) - 35% weight - Google Trends, search volume
- M (Mention Velocity) - 30% weight - Rate of mentions across platforms
- C (Cultural Sentiment) - 20% weight - Cultural relevance and mainstream adoption
- E (Engagement) - 15% weight - Likes, comments, shares, views
Score Interpretation:
- 80-100: Hot trend, peak engagement
- 60-79: Rising trend, growing momentum
- 40-59: Stable trend, moderate engagement
- 20-39: Declining trend, losing momentum
- 0-19: Fading trend, minimal engagement
- Node.js v20.12 or higher
- MongoDB (local or cloud)
- OpenAI API key
- Instagram cookies (optional, for enhanced scraping)
- Clone the repository
git clone git@github.com:Percobain/TrendLens.git
cd TrendLens- Install server dependencies
cd server
npm install- Install client dependencies
cd ../client
npm install- Configure environment variables
Server (server/.env):
MONGODB_URI=mongodb://localhost:27017/TrendLens
OPENAI_API_KEY=your_openai_api_key
PORT=3000Client (client/.env):
VITE_API_URL=http://localhost:3000- Start MongoDB (if running locally)
mongod- Start the server
cd server
npm run dev- Start the client (in a new terminal)
cd client
npm run dev- Open the application
http://localhost:5173
datathong/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── dashboard/ # Dashboard components
│ │ │ ├── layout/ # Layout components
│ │ │ ├── multiagent/ # Multi-agent components
│ │ │ └── ui/ # UI components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── utils/ # Utilities
│ └── package.json
│
├── server/ # Express backend
│ ├── routes/ # API routes
│ ├── scrapers/ # Platform scrapers
│ ├── llm/ # AI analysis modules
│ ├── orchestrator/ # Campaign orchestration
│ ├── cron/ # Scheduled tasks
│ ├── db/ # Database models
│ └── server.js # Entry point
│
├── scraper/ # Instagram scraper
├── instacrapper/ # Instagram media scraper
└── commentScraper/ # Comment scraping tools
GET /api/stocks- Get all tracked trendsPOST /api/stocks/track- Start tracking a new trendGET /api/stocks/:id- Get trend detailsPOST /api/stocks/refresh/:id- Refresh trend dataDELETE /api/stocks/:id- Stop tracking a trend
POST /api/analyze- Analyze a trendGET /api/discover- Discover trending topics
POST /api/campaign/generate- Generate campaignPOST /api/orchestrate/start- Start orchestrationPOST /api/orchestrate/step- Step through orchestrationGET /api/orchestrate/:sessionId- Get orchestration status
POST /api/video/generate- Generate video content
- StockTicker - Live marquee showing trending topics
- NetworkGraph - 3D interactive network visualization
- TrendTable - Sortable table of trends
- LifecycleGraph - Visual lifecycle stage indicator
- DecisionCard - Actionable recommendations
- ExplainabilityPanel - AI explanation viewer
- SentimentPanel - Platform-specific sentiment breakdown
- TimeSeriesChart - Historical trend visualization
- SourceGraph3D - 3D source network visualization
- Collection - Scrapers collect data from social platforms
- Storage - Data stored in MongoDB with timestamps
- Scoring - SMCE scores calculated for each trend
- Analysis - AI analyzes patterns and predicts decline
- Explanation - AI generates human-readable explanations
- Visualization - Frontend displays insights and predictions
- Action - Users make decisions based on recommendations
- Identify declining trends before wasting ad spend
- Optimize campaign timing based on trend lifecycle
- Understand why trends fail to adjust strategies
- Discover emerging trends early
- Know when to jump on trends vs. when to avoid
- Understand audience fatigue signals
- Optimize content for trend stage
- Plan content calendars around trend lifecycles
- Monitor platform-wide trend health
- Identify algorithmic shifts affecting trends
- Understand user engagement patterns
- Predict content saturation points
- Real-time WebSocket updates
- Advanced ML models for prediction accuracy
- Integration with more platforms (YouTube, LinkedIn)
- Automated campaign execution
- Trend revival prediction
- Competitive trend analysis
- API for third-party integrations
This project is part of a hackathon submission. See individual component licenses for details.
This is a hackathon project. For questions or contributions, please open an issue.
For questions about TrendLens AI, please refer to the project documentation or open an issue.
Built with 💖 by NGM GNG KRT BNG.