chore: merge upstream with local feature additions

- Merged dexscreener connector, composio connectors, crypto realtime tools from upstream
- Kept local additions: dropbox/onedrive connectors, memory routes, model_list routes, RefreshToken model
- Resolved frontend conflicts: kept tool UIs from both sides
- Accepted upstream lock files (uv.lock, pnpm-lock.yaml)
This commit is contained in:
Vonic 2026-04-13 23:31:52 +07:00
commit 6e86cd7e8a
803 changed files with 152168 additions and 14005 deletions

265
_bmad-output/admin-guide.md Normal file
View file

@ -0,0 +1,265 @@
# Hướng Dẫn Quản Trị SurfSense
**Dành cho Administrators**
---
## 📖 Giới Thiệu
Tài liệu này hướng dẫn administrators cách quản lý và vận hành hệ thống SurfSense.
---
## 🚀 Yêu Cầu Hệ Thống
### Backend Server (Production)
- CPU: 4+ cores
- RAM: 8GB+
- Storage: 100GB+ SSD
- OS: Ubuntu 22.04 LTS
### Database
- PostgreSQL 15+
- RAM: 4GB+
- Storage: 50GB+
### Dependencies
- Python 3.11+
- Node.js 18+
- Docker & Docker Compose
- Redis
---
---
## 🔑 Default Admin Account
**Tài khoản quản trị mặc định:**
- **Email:** `admin@surfsense.ai`
- **Password:** `password123`
> [!WARNING]
> **Bảo mật quan trọng:** Đổi mật khẩu ngay sau khi đăng nhập lần đầu!
---
## 👥 Quản Lý Users
### Tạo User Mới
**Via CLI:**
```bash
cd surfsense_backend
python manage.py create-user \
--email user@example.com \
--name "John Doe" \
--role user \
--plan pro
```
### Phân Quyền (Roles)
| Role | Permissions |
|------|-------------|
| `user` | Sử dụng tất cả tính năng end-user |
| `admin` | Quản lý users, xem analytics |
| `superadmin` | Quản lý toàn bộ hệ thống |
**Thay đổi role:**
```bash
python manage.py set-role --email user@example.com --role admin
```
### Quản Lý Plans
| Plan | Limits |
|------|--------|
| **Free** | 100 captures/month, 50 AI queries/month, 1GB storage |
| **Pro** | Unlimited captures, 500 AI queries/month, 10GB storage |
| **Enterprise** | Unlimited everything, custom AI models |
---
## ⚙️ Cấu Hình Hệ Thống
### Environment Variables
**File: `surfsense_backend/.env`**
```bash
DATABASE_URL=postgresql://user:password@localhost:5432/surfsense
REDIS_URL=redis://localhost:6379/0
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
JWT_SECRET=your-secret-key
JWT_EXPIRY=3600
ENABLE_RESEARCH_MODE=true
RATE_LIMIT_PER_MINUTE=60
LOG_LEVEL=INFO
```
### Database Migrations
```bash
cd surfsense_backend
alembic upgrade head
```
---
## 📊 Monitoring
### Health Check
```bash
curl https://api.surfsense.ai/health
```
**Response:**
```json
{
"status": "healthy",
"services": {
"database": "up",
"redis": "up",
"vector_db": "up"
}
}
```
### Logs
```bash
# Real-time logs
tail -f surfsense_backend/logs/app.log
# Docker logs
docker logs -f surfsense_backend
```
### Performance Metrics
**Via Admin Dashboard:**
- Active Users (real-time, daily, monthly)
- API Response Times (p50, p95, p99)
- Error Rates
- Storage Usage
---
## 🔐 Bảo Mật
### SSL/TLS
```bash
# Install certbot
sudo apt install certbot python3-certbot-nginx
# Obtain certificate
sudo certbot --nginx -d api.surfsense.ai
```
### Backup
**Automated backup script:**
```bash
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backups/surfsense"
pg_dump -U surfsense surfsense > $BACKUP_DIR/db_$DATE.sql
tar -czf $BACKUP_DIR/uploads_$DATE.tar.gz /var/surfsense/uploads
# Keep last 7 days
find $BACKUP_DIR -type f -mtime +7 -delete
```
**Cron job (2AM daily):**
```bash
0 2 * * * /usr/local/bin/backup.sh >> /var/log/surfsense-backup.log 2>&1
```
---
## 🛠️ Troubleshooting
### Backend Không Start
```bash
# Check logs
tail -n 100 surfsense_backend/logs/app.log
# Test database
python -c "from app.db import engine; engine.connect()"
# Check port
lsof -i :8000
```
### AI Queries Timeout
```bash
# Test AI endpoint
curl -X POST http://localhost:8000/api/ai/chat \
-H "Authorization: Bearer <token>" \
-d '{"message": "test"}'
# Check queue
redis-cli LLEN ai_query_queue
```
### Slow Search
```sql
-- Create indexes
CREATE INDEX idx_content_user_id ON content(user_id);
CREATE INDEX idx_content_tags ON content USING GIN(tags);
```
---
## 📦 Deployment
### Docker Compose
```yaml
version: '3.8'
services:
backend:
build: ./surfsense_backend
ports: ["8000:8000"]
depends_on: [db, redis]
db:
image: postgres:15
environment:
POSTGRES_USER: surfsense
POSTGRES_PASSWORD: password
redis:
image: redis:7-alpine
qdrant:
image: qdrant/qdrant
ports: ["6333:6333"]
```
**Deploy:**
```bash
docker-compose up -d
```
---
**Cập nhật:** 2026-01-31 | **Version:** 1.0

View file

@ -0,0 +1,49 @@
---
stepsCompleted: [1, 2]
inputDocuments: []
session_topic: 'SurfSense 2.0 - AI Co-Pilot for Crypto Trading & Content Creation'
session_goals: 'Generate comprehensive feature set, explore technical architecture, validate business model, identify competitive advantages, assess risks'
selected_approach: 'Progressive Technique Flow'
techniques_used: ['SCAMPER Method', 'What If Scenarios', 'Mind Mapping', 'Morphological Analysis', 'First Principles Thinking', 'Six Thinking Hats', 'Decision Tree Mapping', 'Resource Constraints']
ideas_generated: []
context_file: '/Users/mac_1/Documents/GitHub/SurfSense/_bmad/bmm/data/project-context-template.md'
---
# Brainstorming Session Results
**Facilitator:** Luis
**Date:** 2026-02-01
## Session Overview
**Topic:** SurfSense 2.0 - AI Co-Pilot for Crypto Trading & Content Creation
Nâng cấp SurfSense hiện tại với crypto intelligence capabilities thông qua integration với multiple data sources: DexScreener, DefiLlama, và QuickNode RPC. Transform SurfSense thành một comprehensive crypto analysis brain.
**Target Users:**
1. **Investors** - Cần data-driven insights để make trading decisions
2. **Crypto KOLs/Content Creators** - Cần research tools và market intelligence để create quality content
**Goals:**
- Generate comprehensive feature set cho MVP
- Explore technical architecture approaches
- Validate business model và monetization
- Identify competitive differentiation strategies
- Assess risks và challenges
### Context Guidance
**Key Exploration Areas:**
- User Problems and Pain Points - Challenges mà investors và KOLs đang face
- Feature Ideas and Capabilities - Những gì product có thể làm với DexScreener, DefiLlama, QuickNode
- Technical Approaches - Cách build với RAG pipeline, multiple API integrations
- User Experience - Cách users tương tác với AI co-pilot
- Business Model and Value - Monetization strategies và value proposition
- Market Differentiation - Unique advantages so với competitors
- Technical Risks and Challenges - Potential blockers và solutions
- Success Metrics - KPIs để measure success
### Session Setup
Session được thiết lập để explore toàn diện SurfSense crypto intelligence upgrade, từ MVP features đến business model validation. Focus vào việc leverage existing SurfSense architecture và RAG capabilities để create một powerful AI co-pilot cho crypto ecosystem.

View file

@ -0,0 +1,315 @@
# SurfSense Crypto Co-Pilot - Tóm Tắt Phiên Brainstorming
**Ngày:** 1 tháng 2, 2026
**Phương pháp:** Progressive Technique Flow
**Thời lượng:** ~2 giờ
**Kết quả:** Lộ trình sẵn sàng triển khai
---
## Tổng Quan Phiên
**Chủ đề:** SurfSense 2.0 - AI Co-Pilot cho Crypto Trading & Content Creation
**Mục tiêu:**
- Tạo ra bộ tính năng toàn diện
- Khám phá kiến trúc kỹ thuật
- Xác thực mô hình kinh doanh
- Xác định lợi thế cạnh tranh
- Đánh giá rủi ro
**Kỹ thuật sử dụng:**
1. SCAMPER Method
2. What If Scenarios
3. Mind Mapping
4. Morphological Analysis
5. First Principles Thinking
6. Six Thinking Hats
7. Decision Tree Mapping
8. Resource Constraints
---
## Phase 1: Khám Phá Mở Rộng
**Kỹ thuật:** SCAMPER + What If Scenarios
**Kết quả:** 75+ ý tưởng
**Danh mục ý tưởng chính:**
- **Tính năng cốt lõi** (25 ý tưởng): Trading assistant, alerts, phân tích, dự đoán
- **Kiến trúc kỹ thuật** (15 ý tưởng): RAG, APIs, embeddings, infrastructure
- **Phân khúc người dùng** (12 ý tưởng): Traders, KOLs, VCs, beginners, developers
- **Mô hình kinh doanh** (10 ý tưởng): Subscription, API, white-label, NFT-gated
- **Lợi thế cạnh tranh** (8 ý tưởng): AI predictions, multi-source, real-time
- **Khả năng hoang dã** (5 ý tưởng): Gamification, DAO, social features
**Điểm nổi bật:**
- Thay thế browser tracking → blockchain tracking
- Kết hợp DexScreener + DefiLlama + QuickNode
- Điều chỉnh fraud detection → rug pull detection
- Đảo ngược: User tìm kiếm → AI chủ động tìm cơ hội
- Nếu AI có thể dự đoán pumps với độ chính xác 80%?
---
## Phase 2: Nhận Diện Pattern
**Kỹ thuật:** Mind Mapping + Morphological Analysis
**Kết quả:** 6 clusters chính
**Clusters được xác định:**
1. **Phân khúc người dùng:** Traders (chính), KOLs, VCs, beginners, developers
2. **Tính năng cốt lõi:** Intelligence, alerts, discovery, portfolio
3. **Kiến trúc kỹ thuật:** Data sources, AI/ML, RAG, infrastructure
4. **Mô hình kinh doanh:** Freemium, API, B2B, community
5. **Lợi thế cạnh tranh:** AI intelligence, multi-source, real-time, NLP
6. **Rủi ro & Thách thức:** Technical, market, operational
**Kết hợp MVP tối ưu:**
- **Người dùng:** Active Traders
- **Dữ liệu:** DexScreener + DefiLlama
- **Tính năng:** Smart Alerts + Token Discovery
- **Nền tảng:** Web Dashboard
- **Giá:** Freemium ($49/tháng Pro)
- **AI:** Pattern Recognition + NLP
**Chủ đề chính:**
1. Intelligent Trading Assistant
2. Risk Protection
3. Opportunity Discovery
4. Content & Research
5. Portfolio Intelligence
---
## Phase 3: Phát Triển Ý Tưởng
**Kỹ thuật:** First Principles + Six Thinking Hats
**Kết quả:** Phân tích sâu 3 khái niệm cốt lõi
### Insights từ First Principles
**Trading Assistant:**
- Sự thật cơ bản: Thị trường 24/7 cần AI monitoring
- Tối thiểu khả thi: DexScreener + RAG + Alerts + UI
- Timeline: 4-6 tuần, $10K-20K
**Risk Protection:**
- Sự thật cơ bản: Patterns lặp lại, ML có thể phát hiện
- Tối thiểu khả thi: Contract analysis + Liquidity monitoring + Risk score
- Timeline: 3-4 tuần, $8K-15K
**Content Tools:**
- Sự thật cơ bản: Content có data-backed hoạt động tốt hơn
- Tối thiểu khả thi: Data access + Chart generation + Templates
- Timeline: 2-3 tuần, $5K-10K
### Kết quả Six Thinking Hats
**⚪ White Hat (Sự thật):**
- Thị trường: Hàng triệu traders
- Cạnh tranh: DexTools, Birdeye, Dex Guru
- APIs: DexScreener (free), DefiLlama (free), QuickNode (trả phí)
**🔴 Red Hat (Cảm xúc):**
- Hứng thú và tự tin mạnh mẽ
- "AI giám sát 24/7" có sức hấp dẫn cảm xúc
- Lo ngại về cạnh tranh và niềm tin
**🟡 Yellow Hat (Lợi ích):**
- Pain point rõ ràng (information overload)
- Cơ hội thị trường lớn
- Sẵn sàng trả tiền đã được chứng minh
- Khả thi kỹ thuật
**⚫ Black Hat (Rủi ro):**
- Phụ thuộc API
- Chi phí scaling
- Cạnh tranh
- Tin tưởng AI predictions
- Giảm thiểu: AI moat, tập trung UX, multi-source
**🟢 Green Hat (Sáng tạo):**
- Mô hình community-driven
- Nền tảng white-label
- AI agent marketplace
- Hybrid human+AI
- Tính năng social trading
**🔵 Blue Hat (Quy trình):**
- **Quyết định:** CONDITIONAL GO
- Tiến hành action planning
- Xác định phạm vi MVP
- Xác thực với users
---
## Phase 4: Lập Kế Hoạch Hành Động
**Kỹ thuật:** Decision Tree + Resource Constraints
**Kết quả:** Lộ trình triển khai 12 tuần
### Quyết định chính
**1. MVP vs Full Product:** MVP ✅
- Xác thực nhanh hơn, rủi ro thấp hơn
**2. Bộ tính năng:** Enhanced Core ✅
- DexScreener + DefiLlama + Smart Alerts + NLP + Dashboard
- 6 tuần, $20K
**3. Phương pháp phát triển:** Đội ngũ hiện tại ✅
- Tận dụng SurfSense developers
- Part-time, tổng 12 tuần
**4. Chiến lược ra mắt:** Private Beta ✅
- 20 users được chọn
- Phản hồi trực tiếp
**5. Kiếm tiền:** Freemium từ đầu ✅
- Free tier + $49/tháng Pro
### Resource Constraints
**Thời gian (3 tháng):**
- Hoãn QuickNode, social sentiment, mobile app
- Tập trung vào tính năng intelligence cốt lõi
**Ngân sách ($18K):**
- Sử dụng đội ngũ hiện tại (opportunity cost)
- Free API tiers
- Tăng trưởng tự nhiên
**Đội ngũ (Part-time):**
- Kiến trúc monorepo
- UI dựa trên template
- Chỉ nền tảng web
**Giới hạn API:**
- Caching 5 phút
- Giới hạn người dùng theo cấp
- Ưu tiên watchlist
### Timeline triển khai
| Phase | Thời lượng | Chi phí | Kết quả chính |
|-------|----------|------|------------------|
| 0: Chuẩn bị | 1 tuần | $0 | Tech spec, beta users |
| 1: Nền tảng | 2 tuần | $4K | DexScreener, RAG, alerts |
| 2: Intelligence | 2 tuần | $5K | DefiLlama, NLP, patterns |
| 3: Giao diện | 2 tuần | $4K | Dashboard, auth, responsive |
| 4: Testing | 2 tuần | $2K | Testing, docs, polish |
| 5: Beta | 2 tuần | $1K | 20 users, feedback |
| 6: Iteration | 2 tuần | $2K | Cải tiến, V2 plan |
| **TỔNG** | **12 tuần** | **$18K** | **MVP sẵn sàng production** |
### Chỉ số thành công
**Kỹ thuật:**
- 99% uptime
- < 2s thời gian phản hồi
- < 5 phút độ tươi dữ liệu
**Người dùng:**
- 20 beta users
- 70% active hàng ngày
- 60% retention
**Kinh doanh:**
- 5+ sẵn sàng trả tiền
- $49/tháng được xác thực
- < $50 CAC
---
## Khuyến Nghị Cuối Cùng
### ✅ XÂY DỰNG ENHANCED CORE MVP
**Phạm vi:**
- DexScreener + DefiLlama connectors
- Smart alerts (giá, khối lượng, dựa trên ML)
- Natural language queries
- Real-time web dashboard
- Mô hình freemium pricing
**Timeline:** 12 tuần
**Ngân sách:** $18K
**Đội ngũ:** SurfSense developers hiện tại (part-time)
**Tại sao:**
1. **Khả thi:** Trong giới hạn thời gian/ngân sách
2. **Có giá trị:** Giải quyết pain points thực của trader
3. **Khác biệt:** AI + multi-source + NLP
4. **Học được:** Phản hồi nhanh với private beta
5. **Mở rộng được:** Con đường rõ ràng đến V2 và xa hơn
**Bước tiếp theo:**
1. Nhận approval từ user ✅ (Đã hoàn thành)
2. Tạo detailed tech spec
3. Tuyển 20 beta users
4. Bắt đầu Phase 1 development
---
## Insights Chính Từ Hành Trình
### Điều gì hoạt động tốt
**Progressive Flow:**
- Tiến triển tự nhiên từ divergent đến convergent thinking
- Mỗi phase xây dựng trên insights trước đó
- Coverage có hệ thống của tất cả các khía cạnh
**Kết hợp kỹ thuật:**
- SCAMPER + What If = Tạo ý tưởng tối đa
- Mind Mapping + Morphological = Patterns rõ ràng
- First Principles + Six Hats = Hiểu biết sâu sắc
- Decision Tree + Constraints = Lộ trình thực tế
**Kết quả:**
- 75+ ý tưởng được tạo ra
- 6 clusters rõ ràng được xác định
- 3 khái niệm được phân tích sâu
- 1 kế hoạch sẵn sàng triển khai
### Yếu tố thành công quan trọng
1. **Giá trị đề xuất rõ ràng:** "AI giám sát thị trường crypto 24/7"
2. **Nền tảng kỹ thuật:** Kiến trúc SurfSense đã tồn tại
3. **Xác thực thị trường:** Đối thủ chứng minh thị trường tồn tại
4. **Phạm vi có thể quản lý:** MVP khả thi
5. **Phản hồi nhanh:** Private beta cho phép iteration
### Rủi ro cần theo dõi
1. **Phụ thuộc API:** Giảm thiểu với multi-source
2. **Cạnh tranh:** Khác biệt với AI intelligence
3. **Niềm tin người dùng:** Xây dựng qua minh bạch
4. **Chi phí scaling:** Bắt đầu với caching và limits
5. **Năng lực đội ngũ:** Part-time chấp nhận được cho MVP
---
## Artifacts đã tạo
1. **Phase 1 Ideas** (75+ ý tưởng qua 6 categories)
2. **Phase 2 Patterns** (6 clusters, morphological analysis)
3. **Phase 3 Development** (First principles + Six Hats analysis)
4. **Phase 4 Roadmap** (Kế hoạch 12 tuần, ngân sách $18K)
5. **Tóm tắt này** (Documentation hành trình hoàn chỉnh)
---
## Kết Luận
Phiên brainstorming này đã thành công chuyển đổi một khái niệm rộng ("Crypto AI Co-Pilot") thành một kế hoạch triển khai cụ thể, có thể thực hiện. Thông qua việc áp dụng có hệ thống 8 kỹ thuật brainstorming khác nhau qua 4 giai đoạn tiến bộ, chúng ta đã:
- Tạo ra 75+ ý tưởng đa dạng
- Xác định patterns và priorities rõ ràng
- Phân tích sâu các khái niệm cốt lõi
- Tạo lộ trình 12 tuần thực tế
**Kết quả:** Một kế hoạch đã được xác thực, sẵn sàng triển khai cho SurfSense Crypto Co-Pilot MVP cân bằng giữa tham vọng với thực dụng, đổi mới với khả thi, và tầm nhìn với thực thi.
**Trạng thái:** Sẵn sàng cho user approval và thực thi ngay lập tức. ✅ (Đã được phê duyệt)

View file

@ -0,0 +1,564 @@
# Business Model Analysis - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Step 3
**Focus:** Revenue Model, Cost Structure, Unit Economics, Defensibility
---
## 💰 REVENUE MODEL DESIGN
### Freemium SaaS Model (Recommended)
**Tier Structure:**
#### **FREE TIER** (Lead Generation)
**Target:** Casual traders, tire-kickers
**Features:**
- Basic token monitoring (5 tokens max)
- Historical price charts (7 days)
- Community alerts (delayed 15 min)
- Basic AI queries (10/day limit)
**Purpose:**
- User acquisition (low CAC)
- Product validation
- Conversion funnel top
- Viral growth potential
**Conversion Target:** 2-5% to paid tiers
- Industry benchmark: 2-5% (general SaaS)
- Crypto tools: likely higher (3-7%) due to high intent
---
#### **PRO TIER** ($49/month or $470/year)
**Target:** Active traders (primary revenue driver)
**Features:**
- Unlimited token monitoring
- Real-time alerts (instant)
- AI-powered pattern recognition
- Smart alerts (ML-based)
- Historical data (30 days)
- Portfolio tracking
- Natural language queries (unlimited)
- Email/Telegram notifications
**Value Proposition:**
- "AI co-pilot pays for itself with ONE good trade"
- Time savings: 10+ hours/week research
- Risk reduction: Rug pull detection
- Opportunity discovery: Whale tracking
**Pricing Rationale:**
- Below DexTools Standard ($100/month)
- Above "free" (perceived value)
- Affordable for serious traders
- Annual discount (20%) encourages commitment
**Expected ARPU:** $50-60/month (including annual subscribers)
---
#### **PREMIUM TIER** ($199/month or $1,990/year)
**Target:** Professional traders, power users
**Features:**
- Everything in Pro
- Advanced AI predictions (price targets, trend forecasting)
- Custom alert rules (complex conditions)
- API access (programmatic integration)
- Historical data (unlimited)
- Priority support
- Multi-portfolio tracking
- Advanced analytics dashboard
- Whale wallet tracking
- Arbitrage opportunity detection
**Value Proposition:**
- "Professional intelligence for professional traders"
- Competitive edge through AI predictions
- Automation via API
- Institutional-grade analytics
**Pricing Rationale:**
- Competitive with DexTools Premium (token-gated)
- Targets top 10% of users (high LTV)
- Justifiable for traders with $50K+ portfolios
**Expected ARPU:** $180-220/month (including annual subscribers)
---
### Revenue Projections
#### **Year 1 (Conservative)**
- Free users: 2,000-5,000
- Pro users: 80-400 (2-5% conversion)
- Premium users: 20-100 (0.5-1% conversion)
- **MRR:** $5K-25K
- **ARR:** $60K-300K
**Mix:**
- Pro (80%): $4K-20K MRR
- Premium (20%): $1K-5K MRR
#### **Year 2 (Moderate)**
- Free users: 10,000-25,000
- Pro users: 800-4,000
- Premium users: 200-1,000
- **MRR:** $50K-250K
- **ARR:** $600K-3M
**Mix:**
- Pro (75%): $37.5K-187.5K MRR
- Premium (25%): $12.5K-62.5K MRR
#### **Year 3+ (Aggressive)**
- Free users: 50,000-100,000
- Pro users: 8,000-15,000
- Premium users: 2,000-5,000
- **MRR:** $500K-1M+
- **ARR:** $6M-12M+
**Mix:**
- Pro (70%): $350K-700K MRR
- Premium (30%): $150K-300K MRR
---
## 💸 COST STRUCTURE
### Fixed Costs (Monthly)
#### **Infrastructure**
- **Hosting:** $200-500/month
- Backend API (FastAPI): $100-200
- Frontend (Next.js): $50-100
- Database (Supabase/PostgreSQL): $50-200
- **AI/ML Services:** $300-800/month
- OpenAI API (embeddings, GPT-4): $200-500
- Vector database (Pinecone/Weaviate): $100-300
- **Monitoring/Analytics:** $50-100/month
- Sentry, Datadog, Mixpanel
**Total Infrastructure:** $550-1,400/month
#### **Data/API Costs**
- **DexScreener Premium:** $0 (free tier during dev, premium later)
- **DefiLlama:** $0 (free API)
- **QuickNode RPC:** $300-1,000/month (premium tier)
- Alternative: Self-host with RPC ($500-800/month)
**Total Data Costs:** $300-1,000/month
#### **Tools/Software**
- **Development:** $50-100/month
- GitHub, Vercel, monitoring tools
- **Marketing:** $100-500/month
- Email (Mailgun), analytics, SEO tools
**Total Tools:** $150-600/month
#### **Total Fixed Costs:** $1,000-3,000/month
---
### Variable Costs (Per User)
#### **AI/ML Costs**
- **Embeddings:** $0.01-0.05/user/month
- Document indexing, semantic search
- **LLM Queries:** $0.50-2.00/user/month
- GPT-4 for AI predictions, natural language queries
- Depends on usage (10-100 queries/month)
**Total AI Cost:** $0.50-2.00/user/month
#### **Data/API Costs**
- **QuickNode RPC:** $0.10-0.50/user/month
- Real-time blockchain data
- Scales with active users
- **DexScreener Premium:** $0.05-0.20/user/month
- If using premium tier
**Total Data Cost:** $0.15-0.70/user/month
#### **Total Variable Cost:** $0.65-2.70/user/month
**Margin Analysis:**
- **Pro Tier ($49/month):**
- Cost: $0.65-2.70
- Margin: $46.30-48.35 (94-99%)
- **Premium Tier ($199/month):**
- Cost: $1.50-5.00 (higher usage)
- Margin: $194-197.50 (97-99%)
**Gross Margin: 94-99%** (typical SaaS)
---
## 📈 UNIT ECONOMICS
### Customer Acquisition Cost (CAC)
**Channels:**
1. **Organic (Content Marketing):** $5-20/user
- Twitter threads, blog posts, YouTube tutorials
- Low cost, high quality users
2. **Paid Ads (Twitter, Google):** $50-150/user
- Targeted crypto trader audiences
- Higher cost, faster scale
3. **Referrals/Viral:** $2-10/user
- Referral program (1 month free for referrer)
- Lowest cost, best retention
**Blended CAC Target:** $20-50/user (Year 1)
- Heavy organic focus (solo founder constraint)
- Paid ads only after PMF validation
**CAC Payback Period:**
- Pro user: 1-2 months ($49/month, $20-50 CAC)
- Premium user: <1 month ($199/month, $20-50 CAC)
---
### Lifetime Value (LTV)
**Churn Rate Assumptions:**
- **Year 1:** 25-30% annual churn (high, early product)
- **Year 2:** 15-20% annual churn (improving PMF)
- **Year 3+:** 10-15% annual churn (mature product)
**Average Customer Lifetime:**
- Year 1: 3-4 years (30% churn)
- Year 2: 5-7 years (20% churn)
- Year 3+: 7-10 years (15% churn)
**LTV Calculation (Year 2 steady state):**
**Pro Tier:**
- ARPU: $50/month
- Lifetime: 5 years (60 months)
- Churn: 20% annual
- **LTV:** $50 × 60 × (1 - 0.20) = **$2,400**
**Premium Tier:**
- ARPU: $200/month
- Lifetime: 6 years (72 months)
- Churn: 15% annual (lower, higher commitment)
- **LTV:** $200 × 72 × (1 - 0.15) = **$12,240**
**Blended LTV (75% Pro, 25% Premium):**
- $2,400 × 0.75 + $12,240 × 0.25 = **$4,860**
---
### LTV:CAC Ratio
**Target:** 3:1 minimum (healthy SaaS)
**Year 1:**
- LTV: $2,000-3,000 (high churn)
- CAC: $20-50
- **Ratio: 40:1 to 150:1** ✅ (EXCELLENT)
**Year 2:**
- LTV: $4,000-5,000
- CAC: $30-60 (more paid ads)
- **Ratio: 67:1 to 167:1** ✅ (EXCELLENT)
**Interpretation:**
- Solo founder advantage: LOW CAC (organic focus)
- High-margin SaaS: HIGH LTV
- Ratio is EXCEPTIONAL (10x+ better than 3:1 target)
- Can afford to invest in paid acquisition
---
### Break-Even Analysis
**Monthly Fixed Costs:** $1,000-3,000
**Break-Even Users (Pro Tier @ $49/month):**
- Low end: $1,000 / $49 = **21 users**
- High end: $3,000 / $49 = **62 users**
**Break-Even Timeline:**
- Month 3-6 (private beta): 20-50 users
- **Break-even: Month 4-7**
**Profitability Timeline:**
- Month 12: 100-500 users = $5K-25K MRR
- Costs: $2K-4K/month
- **Profit: $1K-23K/month**
---
## 🛡️ DEFENSIBILITY ANALYSIS
### Moat Assessment
#### 1. **AI/ML Moat** (STRONG) ✅
**Defensibility:**
- Proprietary AI models trained on crypto patterns
- Prediction accuracy improves with data (network effect)
- Pattern recognition library (rug pulls, whale behavior)
- Difficult to replicate without historical data
**Sustainability:**
- 6-12 month lead time (before incumbents catch up)
- Continuous improvement (more data = better models)
- Requires ML expertise (barrier for competitors)
**Risk:**
- OpenAI/GPT-4 is commoditized (anyone can use)
- Must build proprietary models on top
- Data moat more important than model moat
---
#### 2. **Data Moat** (MEDIUM) ⚠️
**Defensibility:**
- Historical pattern library (rug pulls, pumps, dumps)
- User behavior data (what traders care about)
- Proprietary alert triggers (ML-learned)
**Weakness:**
- Raw data is PUBLIC (DexScreener, DefiLlama)
- Competitors can access same sources
- No exclusive data partnerships
**Mitigation:**
- Build proprietary pattern library
- User feedback loop (what predictions work)
- Community-contributed insights
---
#### 3. **Brand Moat** (WEAK → STRONG) ⚠️→✅
**Current State (WEAK):**
- New brand (no recognition)
- No existing customer base
- Competing with established players
**Future State (STRONG):**
- "The AI co-pilot for crypto traders"
- Trusted predictions (accuracy track record)
- Community advocacy (referrals)
- Thought leadership (content marketing)
**Timeline:** 12-24 months to build brand
---
#### 4. **Network Effects** (WEAK) ⚠️
**Limited Network Effects:**
- Not a marketplace (no buyer-seller dynamics)
- Not a social network (no user-to-user value)
- Individual tool (value doesn't increase with users)
**Potential Network Effects:**
- Community insights (user-contributed patterns)
- Shared alert triggers (what works for others)
- Referral program (viral growth)
**Verdict:** Network effects are WEAK (not a core moat)
---
#### 5. **Switching Costs** (MEDIUM) ⚠️
**Switching Barriers:**
- Portfolio history (sunk data)
- Custom alert rules (configuration effort)
- Learned interface (familiarity)
- Historical predictions (track record)
**Weakness:**
- Easy to export data (no lock-in)
- Competitors can import data
- Low technical switching cost
**Mitigation:**
- Build sticky features (portfolio tracking)
- Personalized AI (learns user preferences)
- Integration with trading workflows
---
### Overall Defensibility: **MEDIUM** ⚠️
**Strengths:**
- ✅ AI/ML moat (6-12 month lead)
- ✅ High-margin SaaS (profitable)
- ✅ Low CAC (organic growth)
**Weaknesses:**
- ❌ Weak network effects
- ❌ Public data (no exclusive sources)
- ❌ Easy to copy features
**Strategic Imperative:**
> Build AI moat FAST (6-12 months). Focus on prediction accuracy and proprietary pattern library. Brand and community will follow.
---
## 🎯 BUSINESS MODEL SCORECARD
| Metric | Target | Crypto Co-Pilot | Score |
|--------|--------|-----------------|-------|
| **Gross Margin** | >70% | 94-99% | ✅ 10/10 |
| **LTV:CAC Ratio** | >3:1 | 40:1 to 150:1 | ✅ 10/10 |
| **CAC Payback** | <12 months | 1-2 months | 10/10 |
| **Churn Rate** | <20% annual | 15-25% annual | 7/10 |
| **Break-Even** | <12 months | 4-7 months | 10/10 |
| **Defensibility** | Strong moat | Medium moat | ⚠️ 6/10 |
| **Scalability** | Solo → Team | Solo only | ⚠️ 5/10 |
| **Market Size** | $100M+ TAM | $500M-800M SAM | ✅ 9/10 |
| **TOTAL** | | | **✅ 8.4/10** |
**Interpretation:** **STRONG BUSINESS MODEL**
Excellent unit economics, fast break-even, high margins. Main risks: defensibility and solo scaling.
---
## 💡 STRATEGIC RECOMMENDATIONS
### 1. **Pricing Strategy**
**Recommendation:** Freemium with $49 Pro / $199 Premium
**Rationale:**
- Below DexTools ($100/month) = competitive
- Above "free" = perceived value
- Affordable for active traders
- Premium tier captures power users (high LTV)
**Tactics:**
- Annual discount (20%) to reduce churn
- Referral credits (1 month free)
- Early adopter lifetime discount (lock in evangelists)
---
### 2. **Cost Optimization**
**Recommendation:** Aggressive cost control in Year 1
**Tactics:**
- Use free tiers during development (DexScreener, DefiLlama)
- Self-host QuickNode RPC if costs exceed $1K/month
- Optimize AI queries (caching, batch processing)
- Serverless architecture (pay per use)
**Target:** Keep fixed costs <$2K/month in Year 1
---
### 3. **CAC Strategy**
**Recommendation:** Organic-first, paid later
**Year 1 (Organic Focus):**
- Twitter threads (crypto trading tips)
- YouTube tutorials (how to use AI co-pilot)
- Blog posts (crypto intelligence insights)
- Community engagement (Discord, Telegram)
- **Target CAC:** $10-30/user
**Year 2 (Paid Ads):**
- Twitter ads (targeted crypto traders)
- Google ads (crypto trading tools)
- Influencer partnerships (crypto YouTubers)
- **Target CAC:** $30-60/user
---
### 4. **Churn Reduction**
**Recommendation:** Build sticky features
**Tactics:**
- Portfolio tracking (historical data)
- Custom alert rules (configuration effort)
- Prediction track record (accuracy validation)
- Community insights (shared patterns)
- Email engagement (weekly insights)
**Target:** Reduce churn from 25% → 15% by Year 2
---
### 5. **Defensibility Strategy**
**Recommendation:** Build AI moat FAST
**6-Month Plan:**
- Build proprietary pattern library (rug pulls, pumps)
- Train ML models on historical data
- Validate prediction accuracy (track record)
- Publish accuracy metrics (transparency)
- Build community (user-contributed insights)
**12-Month Plan:**
- Establish brand as "AI crypto intelligence leader"
- Thought leadership (blog, Twitter, YouTube)
- Case studies (successful predictions)
- Partnerships (crypto influencers, exchanges)
---
## ⚠️ CRITICAL RISKS
### 1. **Solo Founder Scaling Challenge** ⚠️
**Risk:** One person cannot serve 1K+ users
**Mitigation:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- Prioritize product over support (Year 1)
- Hire support (Year 2, after $50K MRR)
### 2. **Market Timing Risk** ⚠️
**Risk:** Bear market kills demand
**Mitigation:**
- Build sticky features (survive bear market)
- Freemium model (low churn)
- Focus on serious traders (less price-sensitive)
- Diversify revenue (API access, white-label)
### 3. **Competitive Risk** ⚠️
**Risk:** Incumbents add AI features
**Mitigation:**
- Move FAST (6-12 month window)
- Build proprietary models (not just GPT-4)
- Focus on accuracy (not just features)
- Brand as "AI-first" (not "data + AI")
---
## 🚀 NEXT STEPS
**Step 4:** Disruption Opportunities Analysis
- Jobs-to-be-done framework
- Blue ocean strategy
- Platform potential
- Strategic options development
---
**BUSINESS MODEL VERDICT:** ✅ **STRONG - PROCEED**
Excellent unit economics, fast break-even, high margins. Main risks are defensibility and solo scaling, but mitigable with aggressive AI moat building and automation.

View file

@ -0,0 +1,412 @@
# SurfSense Crypto Co-Pilot - Lộ Trình Triển Khai
**Ngày:** 1 tháng 2, 2026
**Trạng thái:** Đã được phê duyệt
**Thời gian:** 12 tuần
**Ngân sách:** $18K
---
## Tóm Tắt Điều Hành
**Khuyến nghị:** XÂY DỰNG MVP ENHANCED CORE
**Phạm vi:**
- DexScreener + DefiLlama connectors
- Smart alerts (giá, khối lượng, patterns)
- Natural language queries
- Real-time web dashboard
- Mô hình freemium pricing
**Lý do:**
- Khả thi trong giới hạn
- Giá trị đề xuất mạnh mẽ
- Sự khác biệt rõ ràng
- Vòng phản hồi nhanh
- Nền tảng có thể mở rộng
---
## Phân Tích Decision Tree
### Quyết định gốc: Xây dựng hay Chờ đợi
**QUYẾT ĐỊNH:** Xây dựng ✅
**Lý do:**
- Thời điểm thị trường (bull run)
- Nền tảng kỹ thuật đã có
- Nhu cầu người dùng rõ ràng
- Rủi ro có thể quản lý
### Phạm vi MVP: Tối thiểu vs Nâng cao
**QUYẾT ĐỊNH:** Enhanced Core ✅
**Tính năng:**
- DexScreener + DefiLlama (không chỉ DexScreener)
- Smart alerts (dựa trên ML, không chỉ ngưỡng)
- NLP queries (không chỉ tìm kiếm từ khóa)
- Real-time dashboard (không chỉ tĩnh)
**Đánh đổi:** +2 tuần, +$10K, nhưng sự khác biệt tốt hơn 3 lần
### Phương pháp phát triển
**QUYẾT ĐỊNH:** Đội ngũ hiện tại ✅
**Đội ngũ:** Developers SurfSense (part-time)
**Thời gian:** 12 tuần
**Chi phí:** $18K (chủ yếu là opportunity cost)
### Chiến lược ra mắt
**QUYẾT ĐỊNH:** Private Beta ✅
**Cách tiếp cận:**
- 20 người dùng được chọn
- Onboarding thủ công
- Phản hồi trực tiếp
- Giai đoạn beta 2 tuần
### Kiếm tiền
**QUYẾT ĐỊNH:** Freemium từ đầu ✅
**Các cấp:**
- Free: 10 queries/ngày, alerts cơ bản
- Pro: $49/tháng, queries không giới hạn, tính năng nâng cao
- Premium: $199/tháng (tương lai), predictions, whale tracking
---
## Phân Tích Resource Constraints
### Ràng buộc thời gian: Tối đa 3 tháng
**Ưu tiên bắt buộc:**
- ✅ DexScreener + DefiLlama
- ✅ Smart alerts
- ✅ NLP queries
- ✅ Web dashboard
**Hoãn lại V2:**
- ❌ QuickNode integration
- ❌ Social sentiment
- ❌ Mobile app
- ❌ Advanced predictions
### Ràng buộc ngân sách: $18K
**Phân bổ:**
- Development: $15K (83%)
- Infrastructure: $2K (11%)
- Marketing: $1K (6%)
**Tiết kiệm chi phí:**
- Sử dụng đội ngũ hiện tại
- Free API tiers
- Free hosting tiers
- Tăng trưởng tự nhiên
### Ràng buộc đội ngũ: Part-Time
**Đơn giản hóa:**
- Kiến trúc monorepo
- UI dựa trên template
- Testing thủ công ban đầu
- Chỉ nền tảng web
### Ràng buộc API: Rate Limits
**Tối ưu hóa:**
- Caching 5 phút
- Batch requests
- Ưu tiên watchlist
- Giới hạn người dùng theo cấp
---
## Kế Hoạch Triển Khai 12 Tuần
### Phase 0: Chuẩn bị (Tuần 0)
**Thời lượng:** 1 tuần
**Chi phí:** $0
**Nhiệm vụ:**
- Hoàn thiện MVP spec
- Thiết lập dự án
- Tạo tech spec
- Tuyển beta users
**Kết quả:**
- Technical specification
- Project roadmap
- 20 beta user commitments
---
### Phase 1: Nền tảng (Tuần 1-2)
**Thời lượng:** 2 tuần
**Chi phí:** $4K
**Nhiệm vụ:**
- Mở rộng DexScreener connector (caching, rate limiting)
- Xây dựng crypto RAG pipeline (time-based chunks, price embeddings)
- Tạo alert system backend
**Kết quả:**
- DexScreener integration hoạt động
- Crypto-optimized RAG
- Alert database
**Tiêu chí thành công:**
- Query "Tìm token Solana mới" hoạt động
- Có thể đặt price alerts
- Cập nhật dữ liệu 5 phút
---
### Phase 2: Intelligence (Tuần 3-4)
**Thời lượng:** 2 tuần
**Chi phí:** $5K
**Nhiệm vụ:**
- Thêm DefiLlama connector
- Triển khai NLP query interface
- Xây dựng pattern recognition
**Kết quả:**
- DefiLlama integration
- Natural language queries
- Pattern matching
**Tiêu chí thành công:**
- "Cho tôi xem tokens giống BONK" hoạt động
- Phát hiện pattern similarity
- Tương quan multi-source
---
### Phase 3: Giao diện (Tuần 5-6)
**Thời lượng:** 2 tuần
**Chi phí:** $4K
**Nhiệm vụ:**
- Xây dựng web dashboard (charts, alerts, watchlists)
- Triển khai authentication (wallet connect)
- Tạo responsive design
**Kết quả:**
- Dashboard chức năng
- User authentication
- Mobile-responsive UI
**Tiêu chí thành công:**
- Users có thể đăng nhập
- Quản lý watchlists
- Xem alerts
- Mobile-friendly
---
### Phase 4: Testing & Polish (Tuần 7-8)
**Thời lượng:** 2 tuần
**Chi phí:** $2K
**Nhiệm vụ:**
- End-to-end testing
- Bug fixes
- Documentation
**Kết quả:**
- Sản phẩm ổn định
- User guide
- API docs
**Tiêu chí thành công:**
- Không có critical bugs
- Performance chấp nhận được
- Documentation đầy đủ
---
### Phase 5: Beta Launch (Tuần 9-10)
**Thời lượng:** 2 tuần
**Chi phí:** $1K
**Nhiệm vụ:**
- Deploy lên production
- Onboard 20 beta users
- Monitor & support
**Kết quả:**
- Sản phẩm live
- 20 active users
- Feedback được thu thập
**Tiêu chí thành công:**
- 20 users onboarded
- 70%+ active hàng ngày
- Feedback tích cực
---
### Phase 6: Iteration (Tuần 11-12)
**Thời lượng:** 2 tuần
**Chi phí:** $2K
**Nhiệm vụ:**
- Phân tích feedback
- Ưu tiên cải tiến
- Triển khai top requests
**Kết quả:**
- Sản phẩm cải thiện
- V2 roadmap
- Public launch plan
**Tiêu chí thành công:**
- Top 3 requests hoàn thành
- 60%+ retention
- Sẵn sàng cho public beta
---
## Phân Tích Ngân Sách
| Phase | Thời lượng | Chi phí | % |
|-------|----------|------|---|
| Chuẩn bị | 1 tuần | $0 | 0% |
| Nền tảng | 2 tuần | $4K | 22% |
| Intelligence | 2 tuần | $5K | 28% |
| Giao diện | 2 tuần | $4K | 22% |
| Testing | 2 tuần | $2K | 11% |
| Beta Launch | 2 tuần | $1K | 6% |
| Iteration | 2 tuần | $2K | 11% |
| **TỔNG** | **12 tuần** | **$18K** | **100%** |
---
## Chỉ Số Thành Công
### Chỉ số kỹ thuật
- 99% uptime
- < 2s thời gian phản hồi query
- < 5 phút độ tươi dữ liệu
- Không có critical bugs
### Chỉ số người dùng
- 20 beta users
- 70% active hàng ngày
- 60% retention sau 2 tuần
- NPS > 40
### Chỉ số kinh doanh
- 5+ sẵn sàng trả tiền
- $49/tháng được xác thực
- < $50 CAC
- Con đường rõ ràng đến lợi nhuận
---
## Điểm Kiểm Tra Go/No-Go
### Checkpoint 1: Tuần 4
**Đánh giá:** Nền tảng kỹ thuật
**GO nếu:** Integrations hoạt động, đúng lịch trình
**NO-GO nếu:** Blockers lớn
### Checkpoint 2: Tuần 8
**Đánh giá:** Chức năng sản phẩm
**GO nếu:** End-to-end hoạt động
**NO-GO nếu:** Thiếu tính năng quan trọng
### Checkpoint 3: Tuần 10
**Đánh giá:** User engagement
**GO to public nếu:** Tín hiệu mạnh
**PIVOT nếu:** Engagement yếu
**KILL nếu:** Từ chối cơ bản
---
## Rủi Ro & Giảm Thiểu
### Rủi ro kỹ thuật
- **API changes:** Multi-source giảm dependency
- **Scaling costs:** Bắt đầu với caching, tiered limits
- **Data accuracy:** Cross-reference nhiều nguồn
### Rủi ro thị trường
- **Competition:** Tập trung vào AI differentiation
- **Bear market:** Freemium giảm churn
- **Trust:** Giải thích minh bạch, không đảm bảo
### Rủi ro vận hành
- **Team capacity:** Part-time chấp nhận được cho MVP
- **Support load:** Private beta giới hạn phạm vi
- **Infrastructure:** Sử dụng free tiers ban đầu
---
## Bước Tiếp Theo
1. **User approval** trên plan này ✅ (Đã hoàn thành)
2. **Tạo detailed tech spec** (Phase 0)
3. **Tuyển 20 beta users** (Phase 0)
4. **Bắt đầu Phase 1** development
---
## Phụ Lục
### Phụ lục A: So sánh tính năng
| Tính năng | MVP | V2 | V3 |
|---------|-----|----|----|
| DexScreener | ✅ | ✅ | ✅ |
| DefiLlama | ✅ | ✅ | ✅ |
| QuickNode | ❌ | ✅ | ✅ |
| Social Sentiment | ❌ | ✅ | ✅ |
| Smart Alerts | ✅ | ✅ | ✅ |
| NLP Queries | ✅ | ✅ | ✅ |
| Pattern Recognition | Cơ bản | Nâng cao | Dự đoán |
| Web Dashboard | ✅ | ✅ | ✅ |
| Mobile App | ❌ | ❌ | ✅ |
| Browser Extension | ❌ | ❌ | ✅ |
### Phụ lục B: Technology Stack
**Backend:**
- FastAPI (hiện có)
- PostgreSQL + pgvector
- Redis (caching)
**Frontend:**
- Next.js (hiện có)
- React
- TailwindCSS
**AI/ML:**
- OpenAI embeddings
- Custom pattern matching
- NLP query parsing
**Infrastructure:**
- Vercel (frontend)
- Railway (backend)
- Supabase (database)
### Phụ lục C: Phân tích cạnh tranh
| Đối thủ | Điểm mạnh | Điểm yếu | Lợi thế của chúng ta |
|------------|-----------|------------|---------------|
| DexTools | Đã thành lập, toàn diện | Không có AI, UI phức tạp | AI intelligence, đơn giản |
| Birdeye | Multi-chain, UX tốt | Đắt, không có predictions | Freemium, predictions |
| Dex Guru | Tập trung analytics | Không có alerts, kỹ thuật | Smart alerts, dễ tiếp cận |
| CoinGecko | Coverage rộng | Không tập trung DEX | Chuyên môn hóa DEX |
**Hào của chúng ta:**
1. AI-powered intelligence
2. Natural language interface
3. Multi-source aggregation
4. Proactive alerts
5. Freemium accessibility

View file

@ -0,0 +1,612 @@
# Disruption Opportunities Analysis - Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Step 4
**Frameworks:** Jobs-to-be-Done, Blue Ocean Strategy, Platform Potential
---
## 🎯 JOBS-TO-BE-DONE ANALYSIS
### The Core "Job" Crypto Traders Hire Tools For
**Functional Job:**
> "Help me make profitable trading decisions faster and with less risk"
**Emotional Job:**
> "Make me feel confident and in control in a chaotic, overwhelming market"
**Social Job:**
> "Help me appear knowledgeable and successful to my trading community"
---
### Current Solutions & Their Shortcomings
#### **Job 1: "Find profitable trading opportunities before others"**
**Current Solutions:**
- DexTools, DEX Screener (data aggregation)
- Twitter, Discord, Telegram (social signals)
- Manual research (blockchain explorers)
**Shortcomings:**
- ❌ **Information overload:** Too much data, not enough insight
- ❌ **Reactive, not proactive:** Must actively search
- ❌ **No intelligence:** Just raw data, no predictions
- ❌ **Time-consuming:** 10+ hours/week research
- ❌ **FOMO:** Always feel like missing opportunities
**Our Solution:**
- ✅ **AI-powered opportunity detection:** Proactive alerts
- ✅ **Pattern recognition:** Identify trends before they're obvious
- ✅ **Natural language:** "Show me tokens with whale accumulation"
- ✅ **Time-saving:** 10 hours → 1 hour/week
**Value Proposition:**
> "Your AI co-pilot finds opportunities while you sleep"
---
#### **Job 2: "Avoid rug pulls, scams, and bad trades"**
**Current Solutions:**
- DexTools honeypot detection
- Manual contract verification
- Community warnings (Twitter, Discord)
- "Trust your gut"
**Shortcomings:**
- ❌ **Reactive:** Only check AFTER suspicion
- ❌ **Incomplete:** Honeypot detection misses many scams
- ❌ **Manual:** Must remember to check
- ❌ **False positives:** Community FUD vs real scams
- ❌ **Emotional:** Fear overrides logic
**Our Solution:**
- ✅ **Proactive rug pull detection:** AI flags suspicious patterns
- ✅ **Multi-signal analysis:** Contract + liquidity + whale behavior
- ✅ **Automatic alerts:** "Warning: Unusual liquidity removal detected"
- ✅ **Historical patterns:** "This pattern preceded 87% of rug pulls"
- ✅ **Confidence scores:** "High confidence (92%) this is a scam"
**Value Proposition:**
> "Your AI bodyguard protects you from scams 24/7"
---
#### **Job 3: "Understand what's happening in the market RIGHT NOW"**
**Current Solutions:**
- Price charts (DexTools, TradingView)
- Volume analysis
- Social media sentiment
- News aggregators
**Shortcomings:**
- ❌ **Lagging indicators:** Charts show PAST, not FUTURE
- ❌ **No context:** "Why is this pumping?"
- ❌ **Fragmented:** Must check 10+ sources
- ❌ **No synthesis:** Can't see the big picture
- ❌ **Overwhelming:** Too much noise
**Our Solution:**
- ✅ **Natural language explanations:** "WETH is pumping because..."
- ✅ **Multi-source synthesis:** DexScreener + DefiLlama + social signals
- ✅ **Real-time context:** "Whale wallet just bought $2M"
- ✅ **Predictive insights:** "This pattern suggests continued uptrend"
- ✅ **Single dashboard:** All insights in one place
**Value Proposition:**
> "Your AI analyst explains the market in plain English"
---
#### **Job 4: "Track my portfolio and know when to act"**
**Current Solutions:**
- Manual spreadsheets
- DexTools portfolio tracker
- Wallet trackers (Zapper, DeBank)
- Price alerts (basic)
**Shortcomings:**
- ❌ **Manual updates:** Spreadsheets outdated instantly
- ❌ **Basic alerts:** "Price hit $X" (too simple)
- ❌ **No intelligence:** Don't know WHEN to sell
- ❌ **No context:** "Is this a good exit point?"
- ❌ **Emotional:** Panic sell or hold too long
**Our Solution:**
- ✅ **Auto-updated portfolio:** Real-time tracking
- ✅ **Smart alerts:** "Whale selling detected - consider exit"
- ✅ **AI recommendations:** "Optimal exit: $X based on patterns"
- ✅ **Risk scoring:** "Portfolio risk: MEDIUM (3 high-risk tokens)"
- ✅ **Historical performance:** "Your best trades had these patterns"
**Value Proposition:**
> "Your AI portfolio manager tells you when to act"
---
#### **Job 5: "Learn and improve my trading skills"**
**Current Solutions:**
- YouTube tutorials
- Trading courses
- Trial and error
- Community mentors
**Shortcomings:**
- ❌ **Generic advice:** Not personalized
- ❌ **No feedback loop:** Don't know what works
- ❌ **Expensive:** Courses cost $500-5,000
- ❌ **Time-consuming:** 100+ hours learning
- ❌ **No accountability:** Easy to ignore lessons
**Our Solution:**
- ✅ **Personalized insights:** "Your best trades share these patterns"
- ✅ **Feedback loop:** "This trade matched your successful pattern"
- ✅ **AI coaching:** "You tend to panic sell - consider this..."
- ✅ **Track record:** "Your AI predictions: 73% accurate"
- ✅ **Continuous learning:** AI improves with your data
**Value Proposition:**
> "Your AI coach helps you become a better trader"
---
## 🌊 BLUE OCEAN STRATEGY
### Four Actions Framework
#### **ELIMINATE** (What can we remove that competitors take for granted?)
1. **Complex UI/UX**
- Competitors: DexTools has steep learning curve
- Us: Natural language interface ("Show me whale activity")
2. **Token-gated premium features**
- Competitors: DexTools requires holding 100K DEXT tokens
- Us: Simple subscription ($49-199/month)
3. **Manual research workflows**
- Competitors: Users must actively search
- Us: Proactive AI alerts
4. **Technical jargon**
- Competitors: "Liquidity pool TVL", "DEXTScore"
- Us: Plain English explanations
---
#### **REDUCE** (What can we reduce below industry standard?)
1. **Price**
- Industry: $100-300/month (DexTools, Birdeye)
- Us: $49-199/month (50% lower)
2. **Time to insight**
- Industry: 10+ hours/week research
- Us: 1 hour/week (10x reduction)
3. **Cognitive load**
- Industry: Must interpret charts, data
- Us: AI explains in plain English
4. **Setup complexity**
- Industry: Configure 20+ settings
- Us: 3-click setup (connect wallet, select tokens, done)
---
#### **RAISE** (What can we raise above industry standard?)
1. **AI intelligence**
- Industry: Data aggregation only
- Us: Predictions, patterns, proactive insights
2. **Accessibility**
- Industry: Technical traders only
- Us: Anyone can use (natural language)
3. **Proactivity**
- Industry: Reactive queries
- Us: Proactive alerts, recommendations
4. **Personalization**
- Industry: Generic data for everyone
- Us: AI learns your preferences, portfolio, risk tolerance
---
#### **CREATE** (What can we create that the industry has never offered?)
1. **AI-powered predictions**
- "This token has 78% probability of 2x in 7 days"
- No competitor offers quantified predictions
2. **Natural language crypto intelligence**
- "Explain why WETH is pumping"
- No competitor has conversational AI
3. **Proactive rug pull detection**
- "Warning: Suspicious liquidity removal detected"
- DexTools has honeypot detection, but not proactive alerts
4. **AI trading coach**
- "Your best trades share these 3 patterns"
- No competitor provides personalized learning
5. **Whale behavior tracking**
- "Whale wallet just bought $2M of TOKEN"
- DexTools has Big Swap Explorer, but not AI analysis
---
### Value Curve Comparison
```
Value Factor | DexTools | DEX Screener | Crypto Co-Pilot
---------------------|----------|--------------|------------------
Price | Low (3) | High (10) | Medium (7)
Data Coverage | High (9) | Medium (6) | High (8)
AI Intelligence | Low (2) | None (0) | HIGH (10) ⭐
Accessibility | Low (3) | High (8) | HIGH (9) ⭐
Proactivity | Low (2) | None (0) | HIGH (10) ⭐
Personalization | Low (2) | None (0) | HIGH (9) ⭐
Setup Simplicity | Low (3) | High (9) | HIGH (9) ⭐
Prediction Accuracy | None (0) | None (0) | HIGH (8) ⭐
```
**Blue Ocean Positioning:**
- **Eliminate:** Complexity, token-gating, manual work
- **Reduce:** Price, time, cognitive load
- **Raise:** AI intelligence, accessibility, proactivity
- **Create:** Predictions, natural language, AI coaching
**Result:** NEW VALUE CURVE (not competing on same factors)
---
## 🏗️ PLATFORM POTENTIAL ASSESSMENT
### Is This a Platform or a Product?
**Current State:** **PRODUCT** (SaaS tool)
- Individual users
- No network effects
- Value doesn't increase with users
**Future State:** **PLATFORM** (potential)
- Community insights
- Shared pattern library
- User-contributed alerts
---
### Platform Evolution Path
#### **Phase 1: Product (Year 1-2)**
**Focus:** Individual AI co-pilot
- Solo user experience
- Proprietary AI models
- No social features
**Rationale:**
- Solo founder constraint
- Must prove AI value first
- Avoid complexity
---
#### **Phase 2: Community (Year 2-3)**
**Focus:** Shared insights
- User-contributed patterns
- Community alert triggers
- Shared watchlists
**Features:**
- "Top traders are watching these 10 tokens"
- "This pattern was profitable for 87% of users"
- "Community consensus: BULLISH on TOKEN"
**Network Effects:**
- More users = more patterns
- More patterns = better AI
- Better AI = more users
---
#### **Phase 3: Marketplace (Year 3+)**
**Focus:** Third-party integrations
- Trading bot integrations
- Custom alert plugins
- AI model marketplace
**Features:**
- "Install 'Whale Tracker Pro' plugin"
- "Use 'Rug Pull Detector v2' AI model"
- "Connect to '1inch' for auto-trading"
**Platform Economics:**
- Revenue share (70/30 split)
- Developer ecosystem
- Network effects
---
### Platform Viability Score
| Factor | Score | Rationale |
|--------|-------|-----------|
| **Network Effects** | 6/10 | Weak initially, strong with community |
| **Multi-Sided Market** | 7/10 | Users + developers (future) |
| **Switching Costs** | 5/10 | Low initially, high with community data |
| **Ecosystem Potential** | 8/10 | Trading bots, plugins, AI models |
| **Solo Founder Fit** | 3/10 | Platforms need teams (Year 1-2 constraint) |
| **TOTAL** | **5.8/10** | **MEDIUM POTENTIAL** |
**Recommendation:** Start as PRODUCT, evolve to PLATFORM (Year 2-3)
---
## 🚀 STRATEGIC DISRUPTION OPPORTUNITIES
### Opportunity 1: **AI-First Positioning** (HIGHEST PRIORITY) ⭐⭐⭐
**The Opportunity:**
- Incumbents are "data + AI" (AI is add-on)
- We are "AI-first" (data serves AI)
**Differentiation:**
- DexTools: "Data platform with AI features"
- Us: "AI co-pilot powered by data"
**Strategic Advantage:**
- Brand positioning (AI leader)
- Product roadmap (AI-driven)
- Marketing messaging (AI benefits)
**Execution:**
- Launch with AI predictions (not just data)
- Market as "AI co-pilot" (not "analytics tool")
- Thought leadership (AI in crypto trading)
---
### Opportunity 2: **Natural Language Interface** (HIGH PRIORITY) ⭐⭐
**The Opportunity:**
- No competitor has conversational AI
- Crypto traders overwhelmed by complexity
**Differentiation:**
- DexTools: Charts, tables, technical UI
- Us: "Explain why WETH is pumping"
**Strategic Advantage:**
- Lower barrier to entry (anyone can use)
- Viral potential (demo-able in 30 seconds)
- Defensible (requires NLP expertise)
**Execution:**
- Natural language queries (unlimited)
- Conversational explanations
- Voice interface (future)
---
### Opportunity 3: **Proactive Intelligence** (HIGH PRIORITY) ⭐⭐
**The Opportunity:**
- Competitors are reactive (user must search)
- Traders want to be alerted, not search
**Differentiation:**
- DexTools: User searches for data
- Us: AI alerts user proactively
**Strategic Advantage:**
- Sticky (users rely on alerts)
- Valuable (time-saving)
- Defensible (requires ML models)
**Execution:**
- Smart alerts (ML-based)
- Rug pull detection (proactive)
- Opportunity discovery (automated)
---
### Opportunity 4: **Accessible Pricing** (MEDIUM PRIORITY) ⭐
**The Opportunity:**
- DexTools is expensive ($100/month) or token-gated
- DEX Screener is free but limited
**Differentiation:**
- DexTools: $100/month or 100K token hold
- Us: $49/month (50% cheaper)
**Strategic Advantage:**
- Larger addressable market
- Faster adoption
- Less price resistance
**Execution:**
- Freemium model (low barrier)
- $49 Pro tier (affordable)
- $199 Premium tier (power users)
---
### Opportunity 5: **Community Platform** (FUTURE) ⭐
**The Opportunity:**
- No competitor has community insights
- Traders want to learn from successful traders
**Differentiation:**
- DexTools: Individual tool
- Us: Community-powered intelligence
**Strategic Advantage:**
- Network effects (more users = better AI)
- Sticky (community data)
- Defensible (proprietary patterns)
**Execution:**
- Phase 2 (Year 2-3)
- User-contributed patterns
- Shared watchlists
- Top trader insights
---
## 🎯 STRATEGIC RECOMMENDATIONS
### 1. **Lead with AI Differentiation**
**Strategy:** Position as "AI-first" crypto intelligence
**Tactics:**
- Brand: "Your AI co-pilot for crypto trading"
- Product: AI predictions, not just data
- Marketing: AI benefits (time-saving, accuracy)
- Thought leadership: AI in crypto trading
**Rationale:**
- Only defensible moat
- Clear differentiation
- 6-12 month window
---
### 2. **Build Natural Language Interface**
**Strategy:** Make crypto intelligence accessible to everyone
**Tactics:**
- Natural language queries ("Show me whale activity")
- Conversational explanations ("WETH is pumping because...")
- Voice interface (future)
**Rationale:**
- Lower barrier to entry
- Viral potential
- Defensible (NLP expertise)
---
### 3. **Focus on Proactive Intelligence**
**Strategy:** Alert users, don't make them search
**Tactics:**
- Smart alerts (ML-based)
- Rug pull detection (proactive)
- Opportunity discovery (automated)
**Rationale:**
- Sticky (users rely on alerts)
- Valuable (time-saving)
- Defensible (ML models)
---
### 4. **Price Competitively**
**Strategy:** Undercut DexTools, beat DEX Screener on value
**Tactics:**
- Freemium (low barrier)
- $49 Pro (50% cheaper than DexTools)
- $199 Premium (power users)
**Rationale:**
- Larger addressable market
- Faster adoption
- Less price resistance
---
### 5. **Plan for Platform Evolution**
**Strategy:** Start as product, evolve to platform (Year 2-3)
**Tactics:**
- Year 1-2: Individual AI co-pilot
- Year 2-3: Community insights
- Year 3+: Marketplace (plugins, bots)
**Rationale:**
- Solo founder constraint (Year 1-2)
- Network effects (Year 2-3)
- Platform economics (Year 3+)
---
## 💡 KEY INSIGHTS
### 1. **Jobs-to-be-Done Clarity**
Crypto traders hire tools for 5 core jobs:
1. Find opportunities (proactive)
2. Avoid scams (protective)
3. Understand market (contextual)
4. Track portfolio (actionable)
5. Improve skills (educational)
**Our Advantage:** AI solves ALL 5 jobs better than incumbents
---
### 2. **Blue Ocean Positioning**
**Eliminate:** Complexity, token-gating, manual work
**Reduce:** Price, time, cognitive load
**Raise:** AI intelligence, accessibility, proactivity
**Create:** Predictions, natural language, AI coaching
**Result:** NEW VALUE CURVE (not competing on same factors)
---
### 3. **Platform Potential**
**Year 1-2:** Product (individual AI co-pilot)
**Year 2-3:** Community (shared insights)
**Year 3+:** Platform (marketplace)
**Constraint:** Solo founder (must start simple)
---
### 4. **Disruption Opportunities**
**Highest Priority:**
1. AI-first positioning ⭐⭐⭐
2. Natural language interface ⭐⭐
3. Proactive intelligence ⭐⭐
**Medium Priority:**
4. Accessible pricing ⭐
**Future:**
5. Community platform ⭐
---
## 🚀 NEXT STEPS
**Step 5-6:** Strategic Options Development
- Multiple strategic paths
- Risk/reward evaluation
- Final recommendation
---
**DISRUPTION VERDICT:** ✅ **STRONG OPPORTUNITIES**
Clear white space in AI-first positioning, natural language interface, and proactive intelligence. Blue ocean strategy validated. Platform potential exists but defer to Year 2-3.

View file

@ -0,0 +1,592 @@
# Innovation Strategy Analysis Walkthrough - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Workflow:** Innovation Strategy (BMAD CIS)
**Duration:** ~2 hours
**Outcome:** ✅ CONDITIONAL GO
---
## 📋 EXECUTIVE SUMMARY
### What We Did
Conducted comprehensive **Innovation Strategy analysis** cho SurfSense Crypto Co-Pilot project, evaluating:
1. **Strategic Context** - Ambition, constraints, success definition
2. **Market Landscape** - TAM/SAM/SOM, competitive analysis, Five Forces
3. **Business Model** - Revenue model, unit economics, defensibility
4. **Disruption Opportunities** - Jobs-to-be-Done, Blue Ocean Strategy
5. **Strategic Recommendation** - GO/NO-GO decision với execution roadmap
### The Verdict
# ✅ **CONDITIONAL GO**
**Decision:** Proceed với AI-First MVP strategy
**Conditions:**
1. AI moat FIRST (build proprietary AI before features)
2. Speed is CRITICAL (6-12 month window)
3. Focus on PMF (100 users > 1,000 users)
4. Plan for scaling (automation + community)
5. Bear market hedge (sticky features)
---
## 🎯 STRATEGIC CONTEXT
### The Situation
**Company:** SurfSense Crypto Co-Pilot (future standalone brand)
- Starting as SurfSense extension
- Will rebrand as independent product
- Open-source foundation, entering monetization
**Strategic Driver:** **MARKET OPPORTUNITY**
- Bull run timing (2026)
- Technical readiness (RAG infrastructure)
- Clear market need (information overload)
**Strategic Ambition:** 🔥 **BET-THE-COMPANY / ALL-IN**
### Key Constraints
**Solo Founder:**
- No team (1 person)
- No existing customer base (greenfield)
- No budget constraints (can invest as needed)
- No timeline pressure (quality over speed)
**Strategic Challenge:**
> "Solo founder với no existing customer base phải build market-leading AI crypto intelligence platform trong competitive market với well-funded players"
### Success Targets
**Year 1:** 100-500 users, $5K-25K MRR ✅
**Year 2:** 1K-5K users, $50K-250K MRR ✅
**Year 3+:** 10K+ users, $500K+ MRR, acquisition target ✅
**All targets accepted = AGGRESSIVE AMBITION**
---
## 📊 MARKET LANDSCAPE ANALYSIS
### Market Sizing
**TAM (Total Addressable Market):**
- Crypto trading platforms: **$38.5B (2026)**
- Growth rate: **15% YoY**
- Crypto intelligence subset: **$3.8B-5.8B**
**SAM (Serviceable Addressable Market):**
- DEX-focused intelligence tools: **$500M-800M**
- Geographic: Global (North America 33%, Asia Pacific 31%)
- User segment: Active traders (20-30% of crypto users)
**SOM (Serviceable Obtainable Market):**
- Year 1: $60K-300K ARR (0.008%-0.04% of SAM)
- Year 2: $600K-3M ARR (0.08%-0.4% of SAM)
- Year 3+: $6M+ ARR (0.75%-1.2% of SAM)
### Competitive Landscape
#### **DexTools** (Market Leader, 30-40% share)
**Strengths:**
- Comprehensive data (100+ chains, 7M+ pools)
- Advanced security (honeypot detection)
- Established brand
**Weaknesses:**
- Expensive ($100/month or 100K token hold)
- Complex UI (steep learning curve)
- No AI predictions (data aggregation only)
#### **DEX Screener** (40-50% users, low revenue)
**Strengths:**
- 100% free (no barriers)
- Simple, clean UI
**Weaknesses:**
- Limited features
- Slower data refresh
- No AI intelligence
#### **Birdeye, Dex Guru, CoinGecko** (10-20% combined)
- Various strengths/weaknesses
- None have AI-powered predictions
### Strategic White Space
**OPPORTUNITY:** AI-Powered + Accessible + Mid-Tier Pricing
```
Intelligence Level
| [OUR POSITION]
AI | AI + Simple + $49-199
| ⭐
| DexTools Birdeye
| (Complex) (Expensive)
|
Data | DEX Screener
| (Free/Simple)
└──────────────────────────────→
Free $100+ Price
```
### Five Forces Analysis
**Competitive Rivalry:** HIGH ⚠️
**Threat of New Entrants:** MEDIUM ⚠️
**Threat of Substitutes:** HIGH ⚠️
**Buyer Power:** HIGH ⚠️
**Supplier Power:** MEDIUM ⚠️
**Overall Attractiveness:** MEDIUM ⚠️
**Strategic Imperative:**
> Build AI moat FAST. Differentiation window is 6-12 months.
### Market Timing
**Favorable Factors:**
- ✅ Market growing 15% YoY
- ✅ Bull run momentum (2026)
- ✅ AI/ML technology mature
- ✅ Proven willingness to pay ($100/month)
**Risk Factors:**
- ⚠️ Bear market could kill demand
- ⚠️ Incumbents adding AI features
- ⚠️ Regulatory uncertainty
**Window of Opportunity:** **NOW (Q1 2026)**
### Market Opportunity Score: **7.75/10 (STRONG)**
---
## 💰 BUSINESS MODEL ANALYSIS
### Revenue Model
**Freemium SaaS:**
**FREE TIER:**
- Basic monitoring (5 tokens)
- Historical charts (7 days)
- Basic AI queries (10/day)
- **Purpose:** Lead generation, viral growth
**PRO TIER ($49/month):**
- Unlimited monitoring
- Real-time alerts
- AI pattern recognition
- Portfolio tracking
- **Target:** Active traders (primary revenue)
**PREMIUM TIER ($199/month):**
- Everything in Pro
- Advanced AI predictions
- API access
- Custom alert rules
- **Target:** Professional traders (high LTV)
### Unit Economics
**LTV (Lifetime Value):**
- Pro: $2,400 (5 years, 20% churn)
- Premium: $12,240 (6 years, 15% churn)
- **Blended:** $4,860
**CAC (Customer Acquisition Cost):**
- Organic: $5-20/user
- Paid ads: $50-150/user
- **Blended target:** $20-50/user
**LTV:CAC Ratio:** **40:1 to 150:1** ✅ (EXCEPTIONAL)
- Industry benchmark: 3:1
- Our ratio: **10x+ better**
**Gross Margin:** **94-99%** ✅ (typical SaaS)
**Break-Even:** **4-7 months**
- Fixed costs: $1K-3K/month
- Need 21-62 Pro users
### Defensibility Analysis
**AI/ML Moat:** STRONG ✅
- Proprietary models
- Pattern library
- 6-12 month lead time
**Data Moat:** MEDIUM ⚠️
- Historical patterns
- User behavior data
- But raw data is public
**Brand Moat:** WEAK → STRONG ⚠️→✅
- New brand (weak initially)
- 12-24 months to build
**Network Effects:** WEAK ⚠️
- Not a marketplace
- Limited user-to-user value
**Switching Costs:** MEDIUM ⚠️
- Portfolio history
- Custom alerts
- But easy to export
**Overall Defensibility:** MEDIUM ⚠️
**Strategic Imperative:**
> Build AI moat FAST (6-12 months). Focus on prediction accuracy.
### Business Model Score: **8.4/10 (STRONG)**
---
## 🌊 DISRUPTION OPPORTUNITIES ANALYSIS
### Jobs-to-be-Done
**5 Core Jobs Crypto Traders Hire Tools For:**
1. **Find opportunities before others**
- Current: Information overload, reactive
- Our solution: AI-powered proactive alerts
2. **Avoid rug pulls and scams**
- Current: Manual checks, incomplete
- Our solution: Proactive rug pull detection
3. **Understand market RIGHT NOW**
- Current: Fragmented sources, no context
- Our solution: Natural language explanations
4. **Track portfolio and know when to act**
- Current: Manual spreadsheets, basic alerts
- Our solution: Smart alerts, AI recommendations
5. **Learn and improve trading skills**
- Current: Generic courses, no feedback
- Our solution: Personalized AI coaching
### Blue Ocean Strategy
**Four Actions Framework:**
**ELIMINATE:**
- Complex UI/UX
- Token-gated features
- Manual research
- Technical jargon
**REDUCE:**
- Price (50% vs DexTools)
- Time to insight (10x faster)
- Cognitive load
- Setup complexity
**RAISE:**
- AI intelligence
- Accessibility
- Proactivity
- Personalization
**CREATE:**
- AI predictions
- Natural language interface
- Proactive rug pull detection
- AI trading coach
- Whale behavior tracking
### Platform Potential
**Current State:** PRODUCT (SaaS tool)
**Future Evolution:**
- **Phase 1 (Year 1-2):** Individual AI co-pilot
- **Phase 2 (Year 2-3):** Community insights
- **Phase 3 (Year 3+):** Marketplace (plugins, bots)
**Platform Viability:** 5.8/10 (MEDIUM)
**Recommendation:** Start as PRODUCT, evolve to PLATFORM (Year 2-3)
### Top Disruption Opportunities
1. **AI-first positioning** ⭐⭐⭐ (vs "data + AI")
2. **Natural language interface** ⭐⭐ (vs charts/tables)
3. **Proactive intelligence** ⭐⭐ (vs reactive queries)
4. **Accessible pricing** ⭐ (vs expensive/token-gated)
5. **Community platform** ⭐ (future, Year 2-3)
---
## ✅ STRATEGIC RECOMMENDATION
### The Decision
# ✅ **CONDITIONAL GO**
**Proceed với AI-First MVP strategy**
### The Rationale
1. **Market is REAL:** $500M-800M SAM, 15% YoY growth
2. **Timing is FAVORABLE:** Bull run 2026, 6-12 month AI window
3. **Business model is STRONG:** LTV:CAC 40:1-150:1, 94-99% margin
4. **Differentiation is CLEAR:** AI-first positioning (white space)
5. **Solo founder is VIABLE:** No budget constraints, automation possible
### The Conditions
**MUST DO:**
1. **AI moat FIRST** - Build proprietary AI before features
2. **Speed is CRITICAL** - 6-12 month window to establish lead
3. **Focus on PMF** - 100 users with great AI > 1,000 users with mediocre AI
4. **Plan for scaling** - Automation + community (solo constraint)
5. **Bear market hedge** - Sticky features (survive downturn)
**MUST AVOID:**
1. Feature creep (don't build data aggregation tool)
2. Premature scaling (don't chase 1,000+ users Year 1)
3. Ignoring AI accuracy (if <60%, pivot immediately)
4. Solo hero syndrome (automate, outsource, build community)
5. Regulatory risk (disclaimers, legal review)
### The Strategy
**AI-First MVP:**
**Strategic Pillars:**
1. **AI Differentiation** (HIGHEST PRIORITY)
- AI predictions, pattern recognition
- Natural language interface
- Proactive alerts
2. **Accessible UX** (HIGH PRIORITY)
- Natural language queries
- 3-click setup
- Plain English explanations
3. **Proactive Intelligence** (HIGH PRIORITY)
- Smart alerts (ML-based)
- Rug pull detection
- Opportunity discovery
4. **Competitive Pricing** (MEDIUM PRIORITY)
- Freemium model
- $49 Pro / $199 Premium
5. **Solo Founder Optimization** (CRITICAL)
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- Outsource non-core
### The Roadmap
**Months 1-3: AI MVP Development**
- AI predictions (price direction)
- Natural language queries
- Proactive alerts (rug pull detection)
- Simple UX (3-click setup)
- **Target:** 60%+ prediction accuracy
**Months 4-6: Private Beta Launch**
- 20-50 beta users
- User feedback loop
- AI refinement
- **Target:** 70%+ prediction accuracy, 80%+ satisfaction
**Months 7-9: Public Launch**
- Freemium + Pro/Premium tiers
- Marketing (content, Twitter, YouTube)
- **Target:** 100-500 paying users, $5K-25K MRR
**Months 10-12: PMF Validation**
- AI refinement (80%+ accuracy)
- Feature expansion
- Community building
- **Target:** 500-1,000 users, $25K-50K MRR, <20% churn
### Critical Risks & Mitigation
**Risk 1: AI Predictions Not Accurate (HIGH)**
- Mitigation: Start simple, validate with beta, publish metrics
- Contingency: Pivot to data aggregation + basic AI
**Risk 2: Solo Founder Cannot Scale (HIGH)**
- Mitigation: Automation, community, limit users (100-500 Year 1)
- Contingency: Pause signups, focus retention, raise prices
**Risk 3: Bear Market Kills Demand (MEDIUM)**
- Mitigation: Sticky features, freemium, serious traders, annual subs
- Contingency: Reduce costs, focus retention, pivot to bear market tools
**Risk 4: Incumbents Add AI (HIGH)**
- Mitigation: Move FAST, proprietary models, brand as AI-first
- Contingency: Pivot to niche, compete on UX, undercut on price
**Risk 5: Regulatory Crackdown (LOW)**
- Mitigation: Disclaimers, legal review, position as info tool
- Contingency: Remove predictions, keep alerts/tracking
### Success Criteria
**Year 1:**
- 100-500 paying users ✅
- $5K-25K MRR ✅
- 70%+ prediction accuracy ✅
- <25% churn
- 4-7 month break-even ✅
**Year 2:**
- 1K-5K paying users
- $50K-250K MRR
- 80%+ prediction accuracy
- <20% churn
- Profitable (30%+ margin)
**Year 3+:**
- 10K+ paying users
- $500K-1M+ MRR
- Market leader
- Acquisition interest
---
## 📚 DELIVERABLES
### Analysis Artifacts
All artifacts saved to `/Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/`:
1. **[strategic_context_synthesis.md](file:///Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/strategic_context_synthesis.md)**
- Bet-the-company ambition
- Solo founder constraints
- Success definition
2. **[market_landscape_analysis.md](file:///Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/market_landscape_analysis.md)**
- TAM/SAM/SOM sizing
- Competitive analysis (DexTools, DEX Screener, etc.)
- Five Forces assessment
- Market timing evaluation
- Score: 7.75/10 (STRONG)
3. **[business_model_analysis.md](file:///Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/business_model_analysis.md)**
- Freemium SaaS model
- Unit economics (LTV:CAC 40:1-150:1)
- Defensibility assessment
- Score: 8.4/10 (STRONG)
4. **[disruption_opportunities_analysis.md](file:///Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/disruption_opportunities_analysis.md)**
- Jobs-to-be-Done framework
- Blue Ocean Strategy
- Platform potential assessment
- Top opportunities identified
5. **[strategic_recommendation.md](file:///Users/mac_1/Documents/GitHub/SurfSense/_bmad-output/analysis/strategic_recommendation.md)**
- CONDITIONAL GO decision
- AI-First MVP strategy
- 12-month execution roadmap
- Risk mitigation plans
- Success criteria
---
## 💡 KEY INSIGHTS
### 1. Market Validation
**The market is REAL and GROWING:**
- $38.5B trading platforms market (15% YoY)
- $500M-800M DEX intelligence SAM
- Proven willingness to pay ($100/month)
- Clear white space (AI + accessible + fair pricing)
### 2. Business Model Strength
**Exceptional unit economics:**
- LTV:CAC ratio 40:1-150:1 (10x better than 3:1 benchmark)
- 94-99% gross margin
- 4-7 month break-even
- Solo founder advantage (low CAC via organic)
### 3. Differentiation Clarity
**AI-first positioning is the ONLY defensible moat:**
- Incumbents are "data + AI" (AI is add-on)
- We are "AI-first" (data serves AI)
- 6-12 month window before incumbents catch up
- Must move FAST
### 4. Strategic Challenges
**Main risks are mitigable:**
- AI accuracy: Start simple, validate with beta
- Solo scaling: Automation + community
- Market timing: Sticky features, freemium
- Competition: Speed + proprietary models
### 5. The Bet
> "AI-powered intelligence will beat pure data aggregation in crypto tools, and a solo founder can build a market-leading AI platform by moving fast, focusing on quality, and leveraging automation."
---
## 🚀 NEXT STEPS
### Immediate Actions (Week 1)
1. **Review strategic recommendation** với stakeholders
2. **Validate AI approach** (GPT-4 + RAG vs custom models)
3. **Define MVP scope** (Months 1-3 deliverables)
4. **Set up development environment** (APIs, infrastructure)
### Month 1 Priorities
1. **AI MVP Development:**
- AI predictions (price direction)
- Natural language queries (basic)
- Proactive alerts (rug pull detection)
2. **Infrastructure Setup:**
- OpenAI API integration
- QuickNode RPC setup
- DexScreener + DefiLlama connectors
3. **UX Design:**
- 3-click setup flow
- Natural language interface
- Simple dashboard
### Success Checkpoints
**Month 3:** AI MVP complete (60%+ accuracy)
**Month 6:** Private beta (20-50 users, 70%+ accuracy)
**Month 9:** Public launch (100-500 users, $5K-25K MRR)
**Month 12:** PMF validation (500-1K users, $25K-50K MRR)
---
## 🎯 FINAL VERDICT
# ✅ **GO BUILD IT** 🚀
**The opportunity is real.**
**The timing is favorable.**
**The business model is strong.**
**The differentiation is clear.**
**The window is NOW. Move fast, build AI moat, validate PMF, and scale.**
---
**END OF WALKTHROUGH**
**All strategic analysis complete. Ready for execution.**

View file

@ -0,0 +1,503 @@
# Market Landscape Analysis - Crypto Intelligence Platforms
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Step 2
**Frameworks Used:** TAM/SAM/SOM, Five Forces, Competitive Positioning, Market Timing
---
## 📊 MARKET SIZING (TAM/SAM/SOM)
### Total Addressable Market (TAM)
**Crypto Trading Platforms Market: $38.5B (2026)**[^1]
**Context:**
- Grew from $33.48B (2025) → $38.5B (2026)
- **Growth Rate: 15% YoY**
- Includes exchange software, trading interfaces, analytics tools
- Broader crypto market: $7.08B in software/tools segment
**TAM Interpretation for Crypto Intelligence:**
- Trading platforms ($38.5B) is the TOTAL market
- Intelligence/analytics tools are a SUBSET
- Estimate: **10-15% of trading platform market = $3.8B-5.8B TAM**
- Rationale: Tools like DexTools, Birdeye are premium add-ons to trading
### Serviceable Addressable Market (SAM)
**DEX-Focused Intelligence Tools: ~$500M-800M (estimated)**
**Segmentation:**
- **Geographic:** Global, but concentrated in:
- North America: ~33% of crypto market
- Asia Pacific: ~31% of crypto market
- Europe: ~25% of crypto market
- **Platform Focus:** DEX vs CEX
- DEX trading growing faster (DeFi boom)
- Our focus: DEX intelligence (DexScreener, DefiLlama data)
- SAM = DEX-focused traders only
- **User Segment:** Active traders (not HODLers)
- Estimate: 20-30% of crypto users are active traders
- Active traders more likely to pay for intelligence tools
**SAM Calculation:**
- Total crypto intelligence TAM: $3.8B-5.8B
- DEX-focused subset: ~15-20% = $570M-1.16B
- Conservative SAM estimate: **$500M-800M**
### Serviceable Obtainable Market (SOM)
**Realistic 3-Year Target: $5M-50M (0.6%-6% of SAM)**
**Year 1 (Conservative):**
- 100-500 paying users @ $49-199/month
- MRR: $5K-25K
- ARR: **$60K-300K**
- Market share: 0.008%-0.04% of SAM
**Year 2 (Moderate):**
- 1K-5K paying users @ $49-199/month
- MRR: $50K-250K
- ARR: **$600K-3M**
- Market share: 0.08%-0.4% of SAM
**Year 3+ (Aggressive):**
- 10K+ paying users @ $49-199/month
- MRR: $500K+
- ARR: **$6M+**
- Market share: 0.75%-1.2% of SAM
**SOM Assumptions:**
- Freemium conversion rate: 2-5%
- Average revenue per user (ARPU): $60-120/month
- Churn rate: 15-25% annually
- Market share achievable as solo founder: 0.5-1% realistic
---
## 🏆 COMPETITIVE LANDSCAPE
### Major Players
#### 1. **DexTools** (Market Leader)
**Positioning:** Premium DEX analytics platform
**Features:**
- Real-time analytics across 100+ blockchains
- Monitors 7M+ liquidity pools, 13M+ tokens
- Aggregates data from 15,000+ DEXs
- DEXTScore reliability ratings
- Honeypot detection, liquidity lock verification
- Whale tracking (Big Swap Explorer)
**Pricing:**
- **Free:** Unlimited token monitoring, charts, volume analysis
- **Standard:** $100/month (paid in DEXT tokens)
- **Premium:** Requires holding 100,000 DEXT tokens
- Portfolio tracking
- Automated trading tools
- Advanced alerts
- Proprietary trading signals
**Business Model:**
- Freemium + token-gated premium
- Deflationary token economics (100% fees → buyback & burn)
- Recent burn: 8M tokens ($3.87M value)
**Strengths:**
- ✅ Comprehensive data coverage (100+ chains)
- ✅ Advanced security scanning (honeypot detection)
- ✅ Established brand (market leader)
- ✅ Token economics creates loyalty
**Weaknesses:**
- ❌ Premium pricing barrier ($100/month or 100K token hold)
- ❌ Token requirement creates friction
- ❌ No AI-powered predictions (data aggregation only)
- ❌ Complex UI (steep learning curve)
**Estimated Market Share:** 30-40% of DEX intelligence market
---
#### 2. **DEX Screener** (Free Alternative)
**Positioning:** Free, ad-supported DEX analytics
**Features:**
- Real-time DEX data
- Token pair monitoring
- Price charts, volume analysis
- No paywalls, no subscriptions
**Pricing:**
- **100% Free**
- Monetization: Ads + promoted token listings ("Dexcreeners")
**Strengths:**
- ✅ Completely free (no barriers)
- ✅ Simple, clean UI
- ✅ Fast adoption (no signup required)
**Weaknesses:**
- ❌ Limited advanced features
- ❌ Slower data refresh vs paid tools
- ❌ Ad-supported (promoted listings)
- ❌ No AI intelligence
**Estimated Market Share:** 40-50% of DEX intelligence users (but low revenue)
---
#### 3. **Birdeye** (Multi-Chain Focus)
**Positioning:** Multi-chain analytics + trading
**Features:** (Limited data available)
- Multi-chain support
- Good UX
- Trading integration
**Pricing:** Premium pricing (expensive)
**Strengths:**
- ✅ Multi-chain coverage
- ✅ Good UX/UI
**Weaknesses:**
- ❌ Expensive
- ❌ No AI predictions
**Estimated Market Share:** 10-15%
---
#### 4. **Dex Guru** (Analytics Focus)
**Positioning:** Advanced analytics for technical traders
**Strengths:**
- ✅ Deep analytics
- ✅ Technical trader focus
**Weaknesses:**
- ❌ No alerts
- ❌ Technical/complex
- ❌ Limited accessibility
**Estimated Market Share:** 5-10%
---
#### 5. **CoinGecko** (Broad Coverage)
**Positioning:** Broad crypto data aggregator
**Strengths:**
- ✅ Massive coverage (all coins)
- ✅ Established brand
**Weaknesses:**
- ❌ Not DEX-focused
- ❌ Limited real-time DEX data
- ❌ No trading intelligence
**Estimated Market Share:** 5% of DEX intelligence (not core focus)
---
### Emerging AI-Powered Competitors (2025-2026)
**Trend:** AI-powered crypto tools reshaping 2026 markets
- **Stoic AI:** Algorithmic trading
- **Botty:** Trading automation
- **DexTools:** Adding AI features
**Threat Level:** HIGH
- Incumbents are adding AI capabilities
- Window for AI differentiation: **6-12 months**
---
## 🔍 COMPETITIVE POSITIONING MAP
### Positioning Dimensions
**Dimension 1: Price (Free → Premium)**
- Free: DEX Screener
- Low: $49-99/month (Our target)
- Medium: $100-199/month (DexTools Standard)
- High: Token-gated (DexTools Premium, Birdeye)
**Dimension 2: Intelligence (Data → AI Predictions)**
- Data Aggregation: DEX Screener, CoinGecko
- Analytics: Dex Guru, Birdeye
- **AI Intelligence: [WHITE SPACE] ← Our Opportunity**
**Dimension 3: Accessibility (Complex → Simple)**
- Complex: DexTools, Dex Guru (technical traders)
- **Simple: [WHITE SPACE] ← Our Opportunity**
- Very Simple: DEX Screener (limited features)
### Strategic White Space
**OPPORTUNITY: AI-Powered + Accessible + Mid-Tier Pricing**
```
Intelligence Level
| [OUR POSITION]
AI | AI + Simple + $49-199
| ⭐
|
| DexTools Birdeye
| (Complex) (Expensive)
|
Data | DEX Screener
| (Free/Simple)
|
└──────────────────────────────→
Free $100+ Price
```
**Differentiation Strategy:**
1. **AI Intelligence** (not just data)
2. **Accessible UX** (not complex)
3. **Fair Pricing** ($49-199, not $100+ or token-gated)
4. **Proactive Insights** (not reactive queries)
---
## ⚔️ FIVE FORCES ANALYSIS
### 1. Competitive Rivalry: **HIGH** ⚠️
**Intensity Factors:**
- Multiple established players (DexTools, DEX Screener, Birdeye)
- Low switching costs (users can use multiple tools)
- Market growing fast (15% YoY) = room for multiple winners
- Differentiation possible (AI vs data aggregation)
**Strategic Implication:**
- Must differentiate clearly (AI intelligence)
- Cannot compete on price alone (DEX Screener is free)
- Must build defensible moat (AI models, proprietary patterns)
### 2. Threat of New Entrants: **MEDIUM** ⚠️
**Barriers to Entry:**
- **Low technical barriers:** APIs are accessible (DexScreener, DefiLlama free)
- **High quality barriers:** Building good AI models is hard
- **Brand barriers:** Established players have trust
- **Network effects:** Limited (not a platform/marketplace)
**Strategic Implication:**
- Easy for others to copy basic features
- AI moat must be built FAST (6-12 months)
- Brand/trust takes time (need social proof)
### 3. Threat of Substitutes: **HIGH** ⚠️
**Substitutes:**
- **Free tools:** DEX Screener, CoinGecko (good enough for many)
- **Manual research:** Twitter, Discord, Telegram (free)
- **CEX tools:** TradingView, Binance analytics (different but overlapping)
- **AI chatbots:** ChatGPT + manual data (emerging threat)
**Strategic Implication:**
- Must provide 10x value over free alternatives
- Must be faster/better than manual research
- Must integrate insights (not just answer questions)
### 4. Bargaining Power of Buyers: **HIGH** ⚠️
**Buyer Power Factors:**
- **Low switching costs:** Easy to cancel subscription
- **Many alternatives:** DexTools, DEX Screener, Birdeye, etc.
- **Price sensitivity:** Crypto traders are cost-conscious
- **Information availability:** Easy to compare tools
**Strategic Implication:**
- Must deliver clear ROI (tool pays for itself)
- Must have sticky features (portfolio tracking, alerts)
- Must provide unique value (AI predictions)
- Freemium model reduces risk for buyers
### 5. Bargaining Power of Suppliers: **MEDIUM** ⚠️
**Supplier Power:**
- **API providers:** DexScreener (free), DefiLlama (free), QuickNode (paid)
- **Switching costs:** Can build own data services if needed
- **Alternatives:** Multiple data sources available
- **Dependency:** High on data quality/reliability
**Strategic Implication:**
- Multi-source strategy reduces dependency
- Can build own QuickNode RPC service if needed
- Premium APIs affordable (no budget constraint)
- Data quality is critical (must validate sources)
### Overall Industry Attractiveness: **MEDIUM** ⚠️
**Positive Factors:**
- ✅ Market growing fast (15% YoY)
- ✅ High willingness to pay ($100/month proven)
- ✅ Clear differentiation opportunity (AI)
**Negative Factors:**
- ❌ High competition
- ❌ Low barriers to entry
- ❌ High buyer power
- ❌ Many substitutes
**Strategic Imperative:**
> Build AI moat FAST. Differentiation window is 6-12 months before incumbents catch up.
---
## ⏰ MARKET TIMING ASSESSMENT
### Is Now the Right Time?
#### ✅ **FAVORABLE FACTORS**
**1. Market Growth**
- 15% YoY growth (2025→2026)
- Bull run momentum (2026)
- DeFi adoption increasing
**2. Technology Readiness**
- AI/ML models mature (GPT-4, embeddings)
- RAG infrastructure proven
- APIs accessible (DexScreener, DefiLlama)
**3. Customer Readiness**
- Traders already paying $100/month (DexTools)
- Proven willingness to pay for intelligence
- Information overload problem acute
**4. Competitive Landscape**
- Incumbents focused on data aggregation
- AI features just emerging (early stage)
- Window of opportunity open
#### ⚠️ **RISK FACTORS**
**1. Market Timing Risk**
- Bull run may not last (bear market kills demand)
- Crypto volatility high
- Regulatory uncertainty
**2. Technology Risk**
- AI predictions may not be accurate enough
- Data quality challenges
- API dependencies
**3. Competitive Risk**
- Incumbents adding AI (DexTools, Birdeye)
- Well-funded competitors
- Fast follower risk
### Window of Opportunity
**Optimal Entry:** **NOW (Q1 2026)**
**Reasoning:**
1. **Bull run timing:** Demand is HIGH now
2. **AI differentiation:** 6-12 month window before incumbents catch up
3. **Technical readiness:** Infrastructure ready (SurfSense)
4. **Market validation:** Competitors prove market exists
**Critical Timeline:**
- **Months 1-3:** Build MVP, validate AI value
- **Months 4-6:** Private beta, iterate to PMF
- **Months 7-12:** Scale to 1K users before bear market risk
**Risk Mitigation:**
- Build sticky features (portfolio tracking, alerts)
- Freemium model reduces churn in bear market
- Focus on serious traders (less price-sensitive)
---
## 🎯 KEY MARKET INSIGHTS
### 1. **Market is REAL and GROWING**
- $38.5B trading platforms market, 15% YoY growth
- $500M-800M DEX intelligence SAM
- Proven willingness to pay ($100/month)
### 2. **Competitive Landscape is CROWDED but DIFFERENTIABLE**
- DexTools dominates (30-40% share) but expensive + complex
- DEX Screener has users (40-50%) but no revenue model
- **WHITE SPACE:** AI-powered + accessible + fair pricing
### 3. **AI Differentiation Window is SHORT**
- Incumbents adding AI features (2025-2026)
- **6-12 month window** to build moat
- Must move FAST
### 4. **Market Timing is FAVORABLE but RISKY**
- Bull run = high demand NOW
- Bear market risk = demand could collapse
- Must achieve traction in 6-12 months
### 5. **Solo Founder Can Compete**
- No budget constraints = can use premium APIs
- Technical foundation ready = faster to market
- AI differentiation = defensible moat
- Freemium model = scalable without team
---
## 📊 MARKET OPPORTUNITY SCORE
| Factor | Score | Weight | Weighted |
|--------|-------|--------|----------|
| Market Size | 8/10 | 25% | 2.0 |
| Market Growth | 9/10 | 20% | 1.8 |
| Competitive Intensity | 5/10 | 15% | 0.75 |
| Differentiation Potential | 9/10 | 20% | 1.8 |
| Market Timing | 8/10 | 10% | 0.8 |
| Entry Barriers | 6/10 | 10% | 0.6 |
| **TOTAL** | **7.75/10** | **100%** | **7.75** |
**Interpretation:** **STRONG OPPORTUNITY**
Market is attractive, timing is favorable, differentiation is possible. Main risks: competition and market timing (bear market).
---
## 🚀 STRATEGIC IMPLICATIONS
### What This Means for Strategy
**1. GO AGGRESSIVE on AI Differentiation**
- This is the ONLY defensible moat
- Must be 10x better than incumbents
- 6-12 month window to build
**2. PRICE Competitively**
- $49-199/month sweet spot
- Below DexTools ($100+)
- Above "free" (perceived value)
**3. FOCUS on Accessibility**
- Simple UX (not complex like DexTools)
- Natural language queries
- Proactive insights (not reactive)
**4. MOVE FAST**
- Market timing is NOW
- Bull run won't last forever
- Incumbents are adding AI
**5. BUILD Sticky Features**
- Portfolio tracking
- Personalized alerts
- Historical patterns
- Survive bear market
---
[^1]: The Business Research Company, "Crypto Trading Platform Global Market Report" (2026)
---
**NEXT STEP:** Business Model Analysis (Step 3)

View file

@ -0,0 +1,240 @@
# Strategic Context - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy
**Strategic Ambition:** BET-THE-COMPANY / ALL-IN
---
## 🎯 STRATEGIC FRAMING
### Company Context
**Name:** SurfSense Crypto Co-Pilot (will rebrand as standalone)
**Current Status:** Extension of SurfSense (open-source project)
**Future Vision:** Independent product with separate brand identity
**Critical Insight:**
- Starting as extension to leverage existing infrastructure
- Planned evolution to standalone brand = serious long-term commitment
- This is NOT a side project - this is a pivot/expansion play
---
## 💪 STRATEGIC DRIVER
**Primary Driver:** **MARKET OPPORTUNITY**
**Context:**
- Crypto bull run timing (2026)
- Existing technical foundation (RAG, connector system)
- Clear market need (information overload in crypto)
- Competitive landscape validation (DexTools, Birdeye exist = proven market)
**Strategic Logic:**
- Market timing is NOW (bull runs don't last forever)
- Technical capability ready (SurfSense infrastructure)
- Opportunity window is open but limited
---
## 🏢 CURRENT BUSINESS MODEL
**SurfSense Status:**
- Open-source project
- No current revenue
- No existing monetization
**Customer Base Overlap:**
- **Clarification needed:** SurfSense users có phải crypto traders không?
- **Assumption:** Likely minimal overlap (browser history tracking ≠ crypto trading)
- **Implication:** This is NEW market entry, not existing customer expansion
**Strategic Implication:**
- Starting from ZERO in crypto market
- No existing customer base to leverage
- Pure greenfield opportunity
- Higher risk, higher potential
---
## 🚧 CONSTRAINTS & BOUNDARIES
### Financial Constraints
**Budget:** NO HARD CONSTRAINT
- Solo founder, self-funded
- Not counting own labor cost
- Can invest as needed
**Strategic Implication:**
- Can compete on quality, not just cost
- Can use premium APIs from start
- Can invest in proper infrastructure
- Financial flexibility = competitive advantage
### Timeline Constraints
**Timeline:** NO HARD CONSTRAINT
- "Cứ làm thôi" (just do it)
- Quality over speed
- Can iterate until right
**Strategic Implication:**
- Can afford to get product-market fit right
- Not rushing to market prematurely
- Can build sustainable foundation
### Technical Constraints
**API Strategy:** FLEXIBLE
- Free tiers during development
- Premium APIs when launched
- Can build own data services with QuickNode RPC if needed
**Strategic Implication:**
- Not locked into free tier limitations
- Can ensure data quality and reliability
- Can differentiate on data depth/speed
### Regulatory Constraints
**Financial Advice Liability:**
- **Clarification:** Cung cấp crypto intelligence có thể bị coi là financial advice
- **Risk:** Nếu AI predictions sai → users mất tiền → potential lawsuits
- **Mitigation needed:** Disclaimers, terms of service, insurance?
**Strategic Implication:**
- Need legal review before launch
- Disclaimer strategy essential
- Position as "information tool" not "investment advisor"
---
## 🎯 SUCCESS DEFINITION
**Breakthrough Success Targets:**
### Conservative (Year 1)
- **Users:** 100-500 paying users
- **MRR:** $5K-25K
- **Status:** Profitable side project
### Moderate (Year 2)
- **Users:** 1K-5K paying users
- **MRR:** $50K-250K
- **Status:** Standalone sustainable business
### Aggressive (Year 3+)
- **Users:** 10K+ paying users
- **MRR:** $500K+
- **Status:** Market leader, potential acquisition target
**All targets marked "OK" = AGGRESSIVE AMBITION**
---
## 🔥 STRATEGIC AMBITION
**Level:** **BET-THE-COMPANY / ALL-IN**
**What this means:**
- This is THE primary focus
- Not an experiment
- Not a side project
- This is a serious entrepreneurial bet
**Implications:**
1. **Resource Allocation:** Solo founder's full attention
2. **Risk Tolerance:** High - willing to invest significant time/money
3. **Success Criteria:** Not just "profitable" - aiming for market leadership
4. **Pivot Readiness:** Will iterate until product-market fit achieved
5. **Exit Strategy:** Building for acquisition or long-term dominance
---
## 🎲 STRATEGIC CHALLENGE
**The Core Challenge:**
> "How does a solo founder with no existing crypto customer base, no revenue, and no team build a market-leading AI-powered crypto intelligence platform in a competitive market dominated by well-funded players?"
**The Opportunity:**
> "Leverage AI differentiation, technical excellence, and market timing to capture underserved segments (active traders seeking intelligence, not just data) before incumbents adapt."
**The Bet:**
> "AI-powered intelligence (predictions, patterns, proactive insights) will beat data aggregation (charts, feeds, alerts) as the primary value proposition in crypto tools."
---
## 🚀 STRATEGIC POSITIONING
**Starting Position:**
- Solo founder (advantage: speed, focus)
- No legacy customers (advantage: no constraints)
- Technical foundation ready (advantage: faster MVP)
- No revenue pressure (advantage: can optimize for quality)
- Market timing favorable (advantage: bull run demand)
**Target Position (12-24 months):**
- Market leader in AI-powered crypto intelligence
- 1K-5K paying users
- $50K-250K MRR
- Recognized brand in crypto trading tools
- Potential acquisition interest from larger players
---
## ⚠️ CRITICAL ASSUMPTIONS TO VALIDATE
1. **Market Assumption:** Crypto traders will pay $49-199/month for AI intelligence
2. **Technical Assumption:** AI can provide valuable predictions/patterns (not just noise)
3. **Competitive Assumption:** AI differentiation is defensible vs incumbents
4. **Timing Assumption:** Bull run will last long enough to achieve traction
5. **Solo Assumption:** One person can build and scale this to 1K+ users
---
## 📊 NEXT STEPS IN ANALYSIS
Now that strategic context is clear, we will analyze:
1. **Market Landscape** (Step 2)
- TAM/SAM/SOM sizing
- Competitive positioning map
- Market timing assessment
2. **Competitive Dynamics** (Step 2)
- Five Forces analysis
- Competitor deep dive
- Differentiation opportunities
3. **Business Model Innovation** (Step 3)
- Revenue model validation
- Cost structure optimization
- Defensibility analysis
4. **Disruption Opportunities** (Step 4)
- Jobs-to-be-done analysis
- Blue ocean strategy
- Platform potential
5. **Strategic Options** (Steps 5-6)
- Multiple strategic paths
- Risk/reward evaluation
- Recommendation
---
## 💡 INITIAL STRATEGIC OBSERVATIONS
**Strengths:**
- ✅ No budget constraints (can compete on quality)
- ✅ No timeline pressure (can get it right)
- ✅ Technical foundation ready (faster to market)
- ✅ Solo founder (speed, focus, no politics)
- ✅ Market timing (bull run demand)
**Concerns:**
- ⚠️ Solo founder (scaling challenge)
- ⚠️ No existing customer base (cold start)
- ⚠️ Competitive market (well-funded incumbents)
- ⚠️ Regulatory risk (financial advice liability)
- ⚠️ Market timing risk (bear market could kill demand)
**Strategic Imperative:**
> Build AI moat FAST before incumbents catch up. The window is 6-12 months.

View file

@ -0,0 +1,614 @@
# Strategic Recommendation - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Final Recommendation
**Decision:** GO / NO-GO / CONDITIONAL GO
---
## 🎯 EXECUTIVE SUMMARY
### The Opportunity
**Market:** $500M-800M DEX intelligence market, growing 15% YoY
**Timing:** Bull run 2026, 6-12 month AI differentiation window
**Positioning:** AI-first crypto intelligence (white space)
**Business Model:** Freemium SaaS, exceptional unit economics (LTV:CAC 40:1-150:1)
### The Challenge
**Solo founder** with **no existing customer base** must build **market-leading AI platform** in **competitive market** with **well-funded incumbents** before **AI window closes** (6-12 months).
### The Verdict
# ✅ **CONDITIONAL GO**
**Conditions:**
1. **AI moat FIRST** - Build proprietary AI models before features
2. **Speed is CRITICAL** - 6-12 month window to establish lead
3. **Focus on PMF** - Quality over quantity (100 users > 1,000 users)
4. **Plan for scaling** - Automation + community (solo constraint)
5. **Bear market hedge** - Sticky features (survive downturn)
---
## 📊 STRATEGIC ANALYSIS SUMMARY
### Market Landscape (Score: 7.75/10 - STRONG)
**Strengths:**
- ✅ Large market ($500M-800M SAM)
- ✅ Fast growth (15% YoY)
- ✅ Proven willingness to pay ($100/month)
- ✅ Clear white space (AI + accessible + fair pricing)
**Risks:**
- ⚠️ High competition (DexTools, DEX Screener, Birdeye)
- ⚠️ Low barriers to entry (APIs are public)
- ⚠️ Market timing risk (bear market could kill demand)
**Key Insight:**
> Market is real and growing, but competitive. AI differentiation is the ONLY defensible moat, and window is 6-12 months.
---
### Business Model (Score: 8.4/10 - STRONG)
**Strengths:**
- ✅ Exceptional unit economics (LTV:CAC 40:1-150:1)
- ✅ High gross margin (94-99%)
- ✅ Fast break-even (4-7 months)
- ✅ Scalable (SaaS model)
**Risks:**
- ⚠️ Medium defensibility (AI moat critical)
- ⚠️ Solo scaling challenge (1 person → 1K+ users)
- ⚠️ Churn risk (25% Year 1)
**Key Insight:**
> Business model is STRONG. Main risks are defensibility (AI moat) and solo scaling (automation critical).
---
### Disruption Opportunities (STRONG)
**Top Opportunities:**
1. **AI-first positioning** ⭐⭐⭐ (vs "data + AI")
2. **Natural language interface** ⭐⭐ (vs charts/tables)
3. **Proactive intelligence** ⭐⭐ (vs reactive queries)
**Blue Ocean Strategy:**
- **Eliminate:** Complexity, token-gating, manual work
- **Reduce:** Price (50% vs DexTools), time (10x faster)
- **Raise:** AI intelligence, accessibility, proactivity
- **Create:** Predictions, natural language, AI coaching
**Key Insight:**
> Clear differentiation path. Must lead with AI (not just add AI to data).
---
## 🎲 STRATEGIC OPTIONS
### Option 1: **AI-FIRST MVP** (RECOMMENDED) ✅
**Strategy:** Build AI differentiation FIRST, then add features
**Year 1 Focus:**
- AI predictions (price targets, trend forecasting)
- Natural language queries ("Explain why WETH is pumping")
- Proactive alerts (rug pull detection, whale tracking)
- Simple UX (3-click setup)
**Year 1 Targets:**
- 100-500 paying users
- $5K-25K MRR
- 70%+ prediction accuracy
- <25% churn
**Rationale:**
- AI moat is ONLY defensible advantage
- 6-12 month window before incumbents catch up
- Quality over quantity (100 users with great AI > 1,000 users with mediocre AI)
**Risks:**
- AI predictions may not be accurate enough
- Solo founder may struggle with ML complexity
- Market may not value predictions over data
**Mitigation:**
- Start with simple predictions (price direction, not targets)
- Use GPT-4 + RAG (don't build from scratch)
- Validate with private beta (20 users)
---
### Option 2: **FEATURE-FIRST MVP** (NOT RECOMMENDED) ❌
**Strategy:** Build features FIRST, add AI later
**Year 1 Focus:**
- Data aggregation (DexScreener + DefiLlama)
- Portfolio tracking
- Basic alerts
- Charts/dashboards
**Year 1 Targets:**
- 1,000+ users
- $10K-50K MRR
- Fast user growth
- High churn (no differentiation)
**Rationale:**
- Faster to market (no AI complexity)
- Easier to build (data aggregation only)
- Lower risk (proven model)
**Why NOT Recommended:**
- No differentiation (competing with DexTools, DEX Screener)
- No defensible moat (easy to copy)
- Price competition (DEX Screener is free)
- Missed AI window (incumbents will add AI)
---
### Option 3: **PLATFORM-FIRST MVP** (NOT RECOMMENDED) ❌
**Strategy:** Build community platform FIRST
**Year 1 Focus:**
- User-contributed patterns
- Shared watchlists
- Community insights
- Social features
**Year 1 Targets:**
- 5,000+ users
- Network effects
- Viral growth
- Community engagement
**Rationale:**
- Network effects (defensible moat)
- Viral growth (low CAC)
- Community value (sticky)
**Why NOT Recommended:**
- Solo founder constraint (platforms need teams)
- Chicken-egg problem (need users for value)
- No differentiation (social features are commoditized)
- Missed AI window (not focusing on core moat)
---
## ✅ RECOMMENDED STRATEGY: AI-FIRST MVP
### Strategic Pillars
#### **Pillar 1: AI Differentiation** (HIGHEST PRIORITY)
**Goal:** Build proprietary AI moat in 6-12 months
**Tactics:**
- AI predictions (price direction, trend forecasting)
- Pattern recognition (rug pulls, whale behavior)
- Natural language interface (conversational AI)
- Proactive alerts (ML-based)
**Success Metrics:**
- 70%+ prediction accuracy (Year 1)
- 80%+ rug pull detection (Year 1)
- 90%+ user satisfaction with AI explanations
**Timeline:** Months 1-6 (MVP), Months 7-12 (refinement)
---
#### **Pillar 2: Accessible UX** (HIGH PRIORITY)
**Goal:** Make crypto intelligence accessible to everyone
**Tactics:**
- Natural language queries ("Show me whale activity")
- 3-click setup (connect wallet, select tokens, done)
- Plain English explanations (no jargon)
- Mobile-first design (trade on the go)
**Success Metrics:**
- <5 min time to first insight
- 80%+ users complete onboarding
- 90%+ users understand AI explanations
**Timeline:** Months 1-3 (MVP), Months 4-12 (refinement)
---
#### **Pillar 3: Proactive Intelligence** (HIGH PRIORITY)
**Goal:** Alert users, don't make them search
**Tactics:**
- Smart alerts (ML-based, not just price thresholds)
- Rug pull detection (proactive warnings)
- Opportunity discovery (automated scanning)
- Portfolio risk scoring (real-time)
**Success Metrics:**
- 50%+ users enable alerts
- 70%+ users act on alerts
- 80%+ users find alerts valuable
**Timeline:** Months 3-6 (MVP), Months 7-12 (refinement)
---
#### **Pillar 4: Competitive Pricing** (MEDIUM PRIORITY)
**Goal:** Undercut DexTools, beat DEX Screener on value
**Tactics:**
- Freemium model (low barrier)
- $49 Pro tier (50% cheaper than DexTools)
- $199 Premium tier (power users)
- Annual discount (20% off)
**Success Metrics:**
- 3-5% freemium conversion
- $50-60 ARPU (blended)
- <25% churn (Year 1)
**Timeline:** Months 1-12 (ongoing)
---
#### **Pillar 5: Solo Founder Optimization** (CRITICAL)
**Goal:** Build scalable product without team
**Tactics:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- No-code tools (Zapier, n8n for integrations)
- Outsource non-core (design, content)
**Success Metrics:**
- <5 hours/week support (Year 1)
- 90%+ self-service resolution
- 80%+ community engagement
**Timeline:** Months 1-12 (ongoing)
---
## 📅 12-MONTH EXECUTION ROADMAP
### **Months 1-3: AI MVP Development**
**Goal:** Build core AI capabilities
**Deliverables:**
- AI predictions (price direction)
- Natural language queries (basic)
- Proactive alerts (rug pull detection)
- Simple UX (3-click setup)
**Success Criteria:**
- 60%+ prediction accuracy
- 70%+ rug pull detection
- <5 min time to first insight
**Resources:**
- Solo founder (full-time)
- OpenAI API ($200-500/month)
- QuickNode RPC ($300-500/month)
---
### **Months 4-6: Private Beta Launch**
**Goal:** Validate AI value with 20-50 users
**Deliverables:**
- Private beta (invite-only)
- User feedback loop
- AI refinement (based on feedback)
- Freemium tier (public)
**Success Criteria:**
- 20-50 beta users
- 70%+ prediction accuracy
- 80%+ user satisfaction
- 50%+ users willing to pay
**Resources:**
- Solo founder (full-time)
- Beta users (free access)
- Community (Discord)
---
### **Months 7-9: Public Launch**
**Goal:** Scale to 100-500 paying users
**Deliverables:**
- Public launch (freemium)
- Pro tier ($49/month)
- Premium tier ($199/month)
- Marketing (content, Twitter, YouTube)
**Success Criteria:**
- 100-500 paying users
- $5K-25K MRR
- 3-5% freemium conversion
- <25% churn
**Resources:**
- Solo founder (full-time)
- Marketing ($500-1,000/month)
- Infrastructure ($2K-3K/month)
---
### **Months 10-12: PMF Validation**
**Goal:** Validate product-market fit
**Deliverables:**
- AI refinement (80%+ accuracy)
- Feature expansion (portfolio tracking, advanced alerts)
- Community building (Discord, Telegram)
- Thought leadership (blog, Twitter, YouTube)
**Success Criteria:**
- 500-1,000 paying users
- $25K-50K MRR
- 80%+ prediction accuracy
- <20% churn
- 40%+ NPS (Net Promoter Score)
**Resources:**
- Solo founder (full-time)
- Community (Discord, Telegram)
- Infrastructure ($3K-4K/month)
---
## ⚠️ CRITICAL RISKS & MITIGATION
### Risk 1: **AI Predictions Not Accurate Enough** (HIGH) ⚠️
**Impact:** Users don't trust AI, churn is high
**Probability:** MEDIUM (30-40%)
**Mitigation:**
- Start with simple predictions (direction, not targets)
- Validate with private beta (20-50 users)
- Publish accuracy metrics (transparency)
- Continuous improvement (feedback loop)
- Hedge with data aggregation (if AI fails, still useful)
**Contingency:**
- If accuracy <60% after 6 months, pivot to data aggregation + basic AI
- Focus on proactive alerts (easier than predictions)
---
### Risk 2: **Solo Founder Cannot Scale** (HIGH) ⚠️
**Impact:** Support overwhelms, product stagnates
**Probability:** HIGH (50-60%)
**Mitigation:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- Limit users (100-500 Year 1, not 1,000+)
- Outsource non-core (design, content)
- Hire support (Year 2, after $50K MRR)
**Contingency:**
- If overwhelmed, pause new signups
- Focus on retention (not acquisition)
- Raise prices (reduce volume, increase margin)
---
### Risk 3: **Bear Market Kills Demand** (MEDIUM) ⚠️
**Impact:** Users churn, revenue drops
**Probability:** MEDIUM (40-50%)
**Mitigation:**
- Build sticky features (portfolio tracking, historical data)
- Freemium model (low churn)
- Focus on serious traders (less price-sensitive)
- Diversify revenue (API access, white-label)
- Annual subscriptions (lock in revenue)
**Contingency:**
- If bear market hits, reduce costs (pause paid ads)
- Focus on retention (not acquisition)
- Pivot to "bear market tools" (risk management, portfolio tracking)
---
### Risk 4: **Incumbents Add AI Features** (HIGH) ⚠️
**Impact:** Differentiation erodes, competition intensifies
**Probability:** HIGH (70-80%)
**Mitigation:**
- Move FAST (6-12 month window)
- Build proprietary models (not just GPT-4)
- Focus on accuracy (not just features)
- Brand as "AI-first" (not "data + AI")
- Community moat (user-contributed patterns)
**Contingency:**
- If incumbents catch up, pivot to niche (e.g., "AI for DeFi traders")
- Focus on UX (simpler, more accessible)
- Compete on price (undercut DexTools)
---
### Risk 5: **Regulatory Crackdown** (LOW) ⚠️
**Impact:** Financial advice liability, legal issues
**Probability:** LOW (10-20%)
**Mitigation:**
- Disclaimers (not financial advice)
- Terms of service (liability waiver)
- Position as "information tool" (not "investment advisor")
- Legal review (before launch)
- Insurance (if needed)
**Contingency:**
- If regulatory issues arise, pivot to "data aggregation only"
- Remove predictions (keep alerts, portfolio tracking)
- Consult legal counsel
---
## 🎯 SUCCESS CRITERIA
### Year 1 (Months 1-12)
**User Metrics:**
- 100-500 paying users ✅
- 2,000-5,000 free users ✅
- 3-5% freemium conversion ✅
**Revenue Metrics:**
- $5K-25K MRR ✅
- $60K-300K ARR ✅
- 4-7 month break-even ✅
**Product Metrics:**
- 70%+ prediction accuracy ✅
- 80%+ rug pull detection ✅
- <25% churn
- 40%+ NPS ✅
**Operational Metrics:**
- <5 hours/week support
- 90%+ self-service resolution ✅
- Solo founder sustainable ✅
---
### Year 2 (Months 13-24)
**User Metrics:**
- 1,000-5,000 paying users
- 10,000-25,000 free users
- 4-6% freemium conversion
**Revenue Metrics:**
- $50K-250K MRR
- $600K-3M ARR
- Profitable (30%+ margin)
**Product Metrics:**
- 80%+ prediction accuracy
- 90%+ rug pull detection
- <20% churn
- 50%+ NPS
**Operational Metrics:**
- Hire support (1-2 people)
- Community-driven (Discord, Telegram)
- Thought leadership (blog, Twitter, YouTube)
---
### Year 3+ (Months 25+)
**User Metrics:**
- 10,000+ paying users
- 50,000-100,000 free users
- Platform evolution (community insights)
**Revenue Metrics:**
- $500K-1M+ MRR
- $6M-12M+ ARR
- Acquisition interest (potential exit)
**Product Metrics:**
- 85%+ prediction accuracy
- Market leader in AI crypto intelligence
- Strong brand recognition
**Operational Metrics:**
- Team of 5-10 people
- Platform ecosystem (plugins, bots)
- Thought leadership (conferences, media)
---
## 💡 FINAL RECOMMENDATION
# ✅ **GO - WITH CONDITIONS**
### The Decision
**PROCEED with AI-First MVP strategy**
**Rationale:**
1. **Market is REAL:** $500M-800M SAM, 15% YoY growth
2. **Timing is FAVORABLE:** Bull run 2026, 6-12 month AI window
3. **Business model is STRONG:** LTV:CAC 40:1-150:1, 94-99% margin
4. **Differentiation is CLEAR:** AI-first positioning (white space)
5. **Solo founder is VIABLE:** No budget constraints, automation possible
### The Conditions
**MUST DO:**
1. **AI moat FIRST** - Build proprietary AI before features
2. **Speed is CRITICAL** - 6-12 month window to establish lead
3. **Focus on PMF** - 100 users with great AI > 1,000 users with mediocre AI
4. **Plan for scaling** - Automation + community (solo constraint)
5. **Bear market hedge** - Sticky features (survive downturn)
**MUST AVOID:**
1. **Feature creep** - Don't build data aggregation tool (that's DexTools)
2. **Premature scaling** - Don't chase 1,000+ users in Year 1
3. **Ignoring AI accuracy** - If <60% accuracy, pivot immediately
4. **Solo hero syndrome** - Automate, outsource, build community
5. **Regulatory risk** - Disclaimers, legal review, insurance
### The Timeline
**Months 1-3:** AI MVP development
**Months 4-6:** Private beta (20-50 users)
**Months 7-9:** Public launch (100-500 users)
**Months 10-12:** PMF validation (500-1,000 users)
### The Bet
> "AI-powered intelligence will beat pure data aggregation in crypto tools, and a solo founder can build a market-leading AI platform by moving fast, focusing on quality, and leveraging automation."
### The Verdict
**GO BUILD IT.** 🚀
The opportunity is real, the timing is favorable, the business model is strong, and the differentiation is clear. The main risks (AI accuracy, solo scaling, market timing, competition) are mitigable with aggressive AI moat building, automation, and speed.
**The window is NOW. Move fast, build AI moat, validate PMF, and scale.**
---
## 📚 APPENDIX: ANALYSIS ARTIFACTS
1. **Strategic Context Synthesis** - Bet-the-company ambition, solo founder, market opportunity driven
2. **Market Landscape Analysis** - TAM $38.5B, SAM $500M-800M, 15% YoY growth, competitive analysis
3. **Business Model Analysis** - Freemium SaaS, LTV:CAC 40:1-150:1, 94-99% margin, 4-7 month break-even
4. **Disruption Opportunities Analysis** - Jobs-to-be-done, Blue Ocean Strategy, platform potential
**All analyses support the GO decision with conditions.**
---
**END OF STRATEGIC RECOMMENDATION**
**Next Steps:** Execute 12-month roadmap, starting with AI MVP development (Months 1-3).

View file

@ -0,0 +1,40 @@
# Hợp Đồng API (Backend)
Tài liệu này tóm tắt các REST API endpoints chính được phơi bày bởi Backend FastAPI.
*Lưu ý: Tất cả các protected endpoints đều yêu cầu Header Authorization: `Bearer <token>`.*
## Quản Lý Tài Liệu (Documents)
| Method | Endpoint | Mô tả | Quyền Truy Cập |
|--------|----------|-------|----------------|
| `POST` | `/api/v1/documents/` | Tạo hoặc upload tài liệu mới. | `User` |
| `GET` | `/api/v1/documents/` | Liệt kê tài liệu (có phân trang & lọc). | `User` |
| `GET` | `/api/v1/documents/{doc_id}` | Lấy chi tiết một tài liệu. | `User` (Owner) |
| `PATCH` | `/api/v1/documents/{doc_id}` | Cập nhật metadata tài liệu. | `User` (Owner) |
| `DELETE`| `/api/v1/documents/{doc_id}` | Xóa tài liệu (Soft or Hard delete). | `User` (Owner) |
| `POST` | `/api/v1/documents/search` | Tìm kiếm ngữ nghĩa (Semantic search) trên tài liệu. | `User` |
## Chat & AI
| Method | Endpoint | Mô tả |
|--------|----------|-------|
| `POST` | `/api/v1/chat/threads` | Tạo phiên chat mới. |
| `GET` | `/api/v1/chat/threads` | Lấy lịch sử các phiên chat. |
| `POST` | `/api/v1/chat/message` | Gửi tin nhắn tới Agent (Streaming response). |
| `GET` | `/api/v1/chat/{thread_id}/history` | Lấy lịch sử tin nhắn của một thread. |
## Connectors (Tích Hợp)
| Method | Endpoint | Mô tả |
|--------|----------|-------|
| `GET` | `/api/v1/connectors/available` | Danh sách các connectors được hỗ trợ. |
| `POST` | `/api/v1/connectors/{type}/auth` | Bắt đầu quy trình OAuth cho connector. |
| `POST` | `/api/v1/connectors/{type}/sync` | Kích hoạt đồng bộ dữ liệu thủ công. |
## Tiện Ích Trình Duyệt (Extension)
| Method | Endpoint | Mô tả |
|--------|----------|-------|
| `POST` | `/api/v1/extension/ingest` | Nhận dữ liệu trang web từ extension. |
| `POST` | `/api/v1/extension/context` | Kiểm tra ngữ cảnh hiện tại (User có đang track trang này không?). |

View file

@ -0,0 +1,184 @@
# Kiến Trúc Backend
## Tổng Quan
Backend của SurfSense là một ứng dụng **Python FastAPI** mạnh mẽ, được thiết kế cho các quy trình làm việc agentic hiệu suất cao. Nó đóng vai trò là hệ thống thần kinh trung ương, điều phối RAG (Retrieval-Augmented Generation), quản lý bộ nhớ của agent (agent memory), và xử lý tương tác với các mô hình ngôn ngữ lớn (LLMs).
## Các Thành Phần Cốt Lõi
### 1. Framework AI Agent (DeepAgents & LangGraph)
- **DeepAgents**: Framework tùy chỉnh để xây dựng các AI agents tự chủ (autonomous agents).
- **LangGraph**: Quản lý StateGraph (đồ thị trạng thái) và quy trình điều phối cho các suy luận phức tạp, nhiều bước.
- **Workflow**: Người dùng gửi truy vấn -> LangGraph xác định ý định (Routing) -> Kích hoạt các Agents cụ thể (Search Agent, Coding Agent, v.v.).
### 2. Dịch Vụ Dữ Liệu (Data Services)
- **Primary Database**: **Postgres** (với extension `pgvector`) lưu trữ:
- Dữ liệu người dùng & ứng dụng.
- Vector Embeddings cho tìm kiếm ngữ nghĩa (semantic search).
- Lịch sử chat và phiên làm việc.
- **ORM**: **SQLAlchemy (Async)** dùng cho các tương tác cơ sở dữ liệu quan hệ.
- **Caching/Queue**: **Redis** dùng cho hàng đợi tác vụ (Celery broker) và caching phản hồi ngắn hạn.
### 3. Hệ Thống Tìm Kiếm & RAG
- **Vector Store**: Sử dụng `pgvector` để lưu trữ embeddings của tài liệu.
- **Retriever**: Logic tùy chỉnh trong `app/retriever/` để lấy ngữ cảnh (fetches context) dựa trên sự tương đồng (similarity) và metadata filtering.
- **Ingestion Pipeline**: Celery workers xử lý việc tải tài liệu từ nguồn bên ngoài, chia nhỏ văn bản (chunking), tạo embedding, và lưu trữ.
### 4. Kết Nối Ứng Dụng Ngoài (Connectors)
- **Kiến Trúc**: Modular adapter pattern.
- **Hỗ trợ**: Slack, Google Drive, Notion, GitHub, v.v. (30+ integrations).
- **Cơ chế**: Webhooks hoặc định kỳ polling (thực hiện bởi Celery beats).
## Luồng Dữ Liệu (Data Flow)
1. **Request**: Client (Web/Extension) gửi REST request tới FastAPI Endpoints.
2. **Auth**: Middleware xác thực JWT/OAuth token.
3. **Controller**: Route handler (`app/routes/`) nhận request, gọi Service layer.
4. **Processing**:
- Nếu là tác vụ nhanh (CRUD): Xử lý trực tiếp với DB.
- Nếu là tác vụ AI: Đẩy vào LangGraph runner để streaming phản hồi.
- Nếu là tác vụ dài (Ingestion): Đẩy job vào Redis queue cho Celery.
5. **Response**: Trả về JSON hoặc Streaming Response (SSE).
## Critical RAG Pipeline Fix (Feb 2026)
### DexScreener Connector Integration
**Issue Discovered**: DexScreener connector was successfully implemented and indexed data into `search_space_id = 7`, but the LLM could not retrieve this data when users asked about crypto prices.
**Root Cause**: Missing connector mapping in `_CONNECTOR_TYPE_TO_SEARCHABLE` dictionary.
**File**: `surfsense_backend/app/agents/new_chat/chat_deepagent.py`
**The Problem**:
```python
# BEFORE (Missing mapping)
_CONNECTOR_TYPE_TO_SEARCHABLE = {
"GMAIL": "GMAIL",
"GOOGLE_DRIVE_CONNECTOR": "GOOGLE_DRIVE",
"SLACK_CONNECTOR": "SLACK",
# ... other connectors ...
# ❌ DEXSCREENER_CONNECTOR was MISSING
}
```
**Impact**:
1. `connector_service.get_available_connectors()` returned DexScreener connector type
2. `_map_connectors_to_searchable_types()` could not find mapping → ignored DexScreener
3. LLM's tool description didn't mention DexScreener as available
4. LLM never searched DexScreener data, responded "can't see price data"
**The Fix**:
```python
# AFTER (Fixed)
_CONNECTOR_TYPE_TO_SEARCHABLE = {
"GMAIL": "GMAIL",
"GOOGLE_DRIVE_CONNECTOR": "GOOGLE_DRIVE",
"SLACK_CONNECTOR": "SLACK",
# ... other connectors ...
"DEXSCREENER_CONNECTOR": "DEXSCREENER_CONNECTOR", # ✅ Added
}
```
**Verification**:
- User query: *"What's the current price of WETH?"*
- LLM successfully retrieved: ~$2,442 USD with DexScreener citations
- Citations linked to indexed trading pairs with metadata (chain, DEX, liquidity, volume)
**Lesson Learned**: When adding new connectors, **ALWAYS** update the `_CONNECTOR_TYPE_TO_SEARCHABLE` mapping to enable RAG retrieval. This is a critical step that's easy to miss during implementation.
---
## Connector Architecture Pattern
### Adding New Connectors (Best Practices)
Khi thêm connector mới, cần update **4 locations**:
1. **Connector Class** (`app/connectors/`)
- Implement data fetching logic
- Format data to markdown for indexing
2. **Database Enum** (`app/db.py`)
- Add to `SearchSourceConnectorType` enum
3. **API Routes** (`app/routes/`)
- Create add/delete/test endpoints
4. **RAG Mapping** (`app/agents/new_chat/chat_deepagent.py`) ⚠️ **CRITICAL**
- Add to `_CONNECTOR_TYPE_TO_SEARCHABLE` dictionary
- **Failure to do this = LLM cannot access connector data**
---
## Hybrid Crypto Data Architecture (Feb 2026)
### Vấn Đề: Data Freshness cho Crypto
Kiến trúc Connector ban đầu sử dụng **periodic indexing** (5-60 phút) để index data từ DexScreener vào database. Điều này phù hợp cho:
- ✅ Phân tích lịch sử, xu hướng
- ✅ Research & context
- ❌ **KHÔNG** phù hợp cho real-time price queries
### Giải Pháp: Hybrid Approach (RAG + Real-time)
```
┌─────────────────────────────────────────────────────────────────────────┐
│ USER QUERY │
│ "Phân tích BULLA cho tôi" │
└─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────┐
│ AI AGENT (LangGraph) │
│ │
│ Quyết định dùng tool nào dựa trên intent: │
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────────────┐ │
│ │ RAG Tools │ │ Real-time Tools │ │
│ │ (Indexed Data) │ │ (Live API Calls) │ │
│ ├─────────────────────────┤ ├─────────────────────────────────┤ │
│ │ search_knowledge_base │ │ get_live_token_price │ │
│ │ │ │ get_live_token_data │ │
│ │ • Xu hướng lịch sử │ │ • Giá hiện tại │ │
│ │ • Phân tích quá khứ │ │ • Volume live │ │
│ │ • Context & tin tức │ │ • Giao dịch real-time │ │
│ └─────────────────────────┘ └─────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
```
### Real-time Tools Implementation
**File**: `surfsense_backend/app/agents/new_chat/tools/crypto_realtime.py`
| Tool | Mô tả | Use Case |
|------|-------|----------|
| `get_live_token_price` | Lấy giá real-time từ DexScreener API | "Giá SOL bây giờ?" |
| `get_live_token_data` | Lấy full market data (price, volume, txns) | "Volume giao dịch BULLA?" |
**Đặc điểm**:
- Gọi trực tiếp DexScreener API (không qua indexed data)
- Không cần dependencies (`requires=[]`)
- Trả về data với `data_source: "DexScreener API (Real-time)"`
### Khi Nào AI Dùng Tool Nào?
| Query Type | Tool | Ví dụ |
|------------|------|-------|
| Giá hiện tại | `get_live_token_price` | "Giá BULLA bây giờ là bao nhiêu?" |
| Market data live | `get_live_token_data` | "Volume giao dịch SOL thế nào?" |
| Phân tích lịch sử | `search_knowledge_base` | "BULLA tuần này như thế nào?" |
| Phân tích tổng hợp | **Cả hai** | "Phân tích BULLA cho tôi" |
### Frontend Tool-UI Components
**Files**:
- `surfsense_web/components/tool-ui/crypto/live-token-price.tsx`
- `surfsense_web/components/tool-ui/crypto/live-token-data.tsx`
Các components này render kết quả từ real-time tools trong chat interface với:
- Badge "Real-time" để phân biệt với RAG data
- Price change indicators (5m, 1h, 6h, 24h)
- Transaction activity bar (buys vs sells)
- Link đến DexScreener chart
---

View file

@ -0,0 +1,411 @@
# Kiến Trúc Browser Extension
## Tổng Quan
SurfSense Browser Extension là "tai mắt" của hệ thống, cho phép thu thập dữ liệu (ingestion) liền mạch và hỗ trợ người dùng ngay trên bất kỳ trang web nào. Nó được xây dựng bằng **Plasmo Framework**, giúp đơn giản hóa việc phát triển extension cho Chrome (Manifest V3).
## Stack Công Nghệ
| Hạng Mục | Công Nghệ |
|----------|-----------|
| **Framework** | Plasmo |
| **UI** | React 18, Tailwind CSS |
| **Stores** | Storage API (Plasmo Storage) |
| **Messaging** | Plasmo Messaging (Port-based) |
## Các Thành Phần Chính
### 1. Popup (`popup.tsx`)
- Giao diện người dùng xuất hiện khi click vào icon extension.
- **Chức năng**:
- Đăng nhập/Đăng xuất.
- Chuyển đổi trạng thái "Tracking" (Bật/Tắt thu thập active tab).
- Tìm kiếm nhanh (Quick Search) vào kho kiến thức SurfSense.
- Hiển thị thông báo trạng thái hệ thống.
### 2. Background Service Worker (`background/`)
- Trái tim của extension, chạy ngầm độc lập với các tab.
- **Nhiệm vụ**:
- **Session Management**: Giữ token xác thực, refresh token khi hết hạn.
- **Ingestion Queue**: Nhận dữ liệu từ Content Scripts, đóng gói (batching) để tránh spam request, và gửi về Backend API.
- **Context Awareness**: Giám sát thay đổi URL/Tab để kích hoạt thu thập lại nếu cần.
### 3. Content Scripts
- Scripts chạy trong ngữ cảnh của trang web người dùng đang xem.
- **Nhiệm vụ**:
- Trích xuất nội dung trang (DOM parsing, Readability.js).
- Lắng nghe các sự kiện (ví dụ: user copy text -> gợi ý lưu làm note).
- Inject UI (nếu cần): Hiển thị nút "Lưu vào SurfSense" trực tiếp trên trang.
## Luồng Hoạt Động (Workflows)
### Quy Trình Thu Thập (Ingestion Flow)
1. User truy cập `example.com`.
2. **Content Script** kích hoạt, parse nội dung chính (loại bỏ quảng cáo/footer).
3. Script gửi message chứa nội dung tới **Background Worker**.
4. **Background** kiểm tra:
- User có đang bật tracking không?
- Token còn hiệu lực không?
- Trang này có bị blacklist không (ví dụ: localhost, banking sites)?
5. Nếu hợp lệ, Background đẩy dữ liệu về Backend `POST /api/v1/extension/ingest`.
### Quy Trình Tra Cứu (Lookup Flow)
1. User bôi đen 1 đoạn text trên web.
2. Extension hiển thị tooltip nhỏ.
3. User click "Search in SurfSense".
4. Request gửi về Backend để tìm kiếm các tài liệu liên quan đến đoạn text đó.
5. Kết quả hiển thị ngay trong Side Panel hoặc Popup.
---
## UX Performance Considerations
This section addresses **P1 Issue #6** from the Implementation Readiness Review. It defines performance requirements, optimization strategies, and monitoring approaches to ensure the extension delivers a smooth, responsive user experience.
### Performance Goals
| Metric | Target | Critical Threshold | Measurement |
|--------|--------|-------------------|-------------|
| **Side Panel Open** | <300ms | <500ms | Time from click to panel visible |
| **Token Detection** | <1s | <2s | Time from page load to token card display |
| **AI Response Start** | <2s | <3s | Time from query submit to first token |
| **Chat Message Render** | <100ms | <200ms | Time to render new message in chat |
| **Settings Sync** | <500ms | <1s | Time to fetch and apply settings |
| **Page Capture** | <3s | <5s | Time to capture and upload page |
### 1. Side Panel Rendering Performance
**Challenge:** Side panel must open instantly without blocking the main thread.
**Optimization Strategies:**
```typescript
// 1. Lazy load heavy components
const ChatInterface = lazy(() => import('./ChatInterface'));
const TokenInfoCard = lazy(() => import('./TokenInfoCard'));
// 2. Virtual scrolling for chat history
import { FixedSizeList } from 'react-window';
function ChatHistory({ messages }) {
return (
<FixedSizeList
height={600}
itemCount={messages.length}
itemSize={80}
width="100%"
>
{({ index, style }) => (
<div style={style}>
<ChatMessage message={messages[index]} />
</div>
)}
</FixedSizeList>
);
}
// 3. Memoize expensive computations
const TokenCard = memo(({ token }) => {
const formattedPrice = useMemo(
() => formatPrice(token.price),
[token.price]
);
return <div>{formattedPrice}</div>;
});
```
**Performance Budget:**
- Initial bundle size: <200KB (gzipped)
- Side panel open: <300ms
- Chat scroll: 60fps (16.67ms per frame)
---
### 2. Streaming Response Performance
**Challenge:** Display AI responses as they stream without UI jank.
**Optimization Strategies:**
```typescript
// 1. Debounce UI updates during streaming
function useStreamingResponse(messageId: string) {
const [content, setContent] = useState('');
const debouncedContent = useDebouncedValue(content, 50); // Update every 50ms
useEffect(() => {
const eventSource = new EventSource(`/chat/stream/${messageId}`);
eventSource.onmessage = (event) => {
const chunk = JSON.parse(event.data);
setContent(prev => prev + chunk.content);
};
return () => eventSource.close();
}, [messageId]);
return debouncedContent;
}
// 2. Use requestAnimationFrame for smooth updates
function StreamingMessage({ content }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
let rafId: number;
const updateContent = () => {
if (ref.current) {
ref.current.textContent = content;
}
};
rafId = requestAnimationFrame(updateContent);
return () => cancelAnimationFrame(rafId);
}, [content]);
return <div ref={ref} />;
}
```
**Performance Budget:**
- Streaming latency: <50ms per chunk
- UI update frequency: 20 updates/second (50ms interval)
- Memory usage: <50MB for 100 messages
---
### 3. Token Detection Performance
**Challenge:** Detect tokens on DexScreener pages without blocking page load.
**Optimization Strategies:**
```typescript
// 1. Use Intersection Observer for lazy detection
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
detectToken(entry.target);
observer.unobserve(entry.target);
}
});
});
// 2. Debounce URL changes
const debouncedDetect = debounce((url: string) => {
const tokenAddress = extractTokenFromURL(url);
if (tokenAddress) {
fetchTokenData(tokenAddress);
}
}, 300);
chrome.tabs.onUpdated.addListener((tabId, changeInfo) => {
if (changeInfo.url) {
debouncedDetect(changeInfo.url);
}
});
// 3. Cache token data aggressively
const tokenCache = new Map<string, { data: TokenData; timestamp: number }>();
const CACHE_TTL = 30_000; // 30 seconds
async function fetchTokenData(address: string) {
const cached = tokenCache.get(address);
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
return cached.data;
}
const data = await fetch(`/api/tokens/${address}`).then(r => r.json());
tokenCache.set(address, { data, timestamp: Date.now() });
return data;
}
```
**Performance Budget:**
- Token detection: <1s from page load
- API call: <500ms (with retry)
- Cache hit rate: >80%
---
### 4. Offline Mode & Resilience
**Challenge:** Extension must work gracefully when backend is unavailable.
**Optimization Strategies:**
```typescript
// 1. Service Worker caching for static assets
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('surfsense-v1').then((cache) => {
return cache.addAll([
'/sidepanel.html',
'/sidepanel.js',
'/styles.css',
]);
})
);
});
// 2. IndexedDB for offline chat history
import { openDB } from 'idb';
const db = await openDB('surfsense-chat', 1, {
upgrade(db) {
db.createObjectStore('messages', { keyPath: 'id' });
},
});
async function saveChatMessage(message: ChatMessage) {
await db.put('messages', message);
}
async function getChatHistory() {
return await db.getAll('messages');
}
// 3. Optimistic UI updates
function sendMessage(content: string) {
const optimisticMessage = {
id: generateId(),
content,
status: 'sending',
timestamp: Date.now(),
};
// Show immediately
addMessageToUI(optimisticMessage);
// Send to backend
fetch('/api/chat/messages', {
method: 'POST',
body: JSON.stringify({ content }),
})
.then(() => updateMessageStatus(optimisticMessage.id, 'sent'))
.catch(() => updateMessageStatus(optimisticMessage.id, 'failed'));
}
```
**Performance Budget:**
- Offline mode activation: <100ms
- IndexedDB read: <50ms
- Cache hit rate: >90% for static assets
---
### 5. Memory Management
**Challenge:** Extension must not leak memory during long browsing sessions.
**Optimization Strategies:**
```typescript
// 1. Cleanup event listeners
useEffect(() => {
const handleMessage = (message: Message) => {
// Handle message
};
chrome.runtime.onMessage.addListener(handleMessage);
return () => {
chrome.runtime.onMessage.removeListener(handleMessage);
};
}, []);
// 2. Limit chat history in memory
const MAX_MESSAGES_IN_MEMORY = 100;
function addMessage(message: ChatMessage) {
setMessages(prev => {
const updated = [...prev, message];
// Keep only last 100 messages in memory
if (updated.length > MAX_MESSAGES_IN_MEMORY) {
return updated.slice(-MAX_MESSAGES_IN_MEMORY);
}
return updated;
});
}
// 3. Clear caches periodically
setInterval(() => {
const now = Date.now();
for (const [key, value] of tokenCache.entries()) {
if (now - value.timestamp > CACHE_TTL) {
tokenCache.delete(key);
}
}
}, 60_000); // Clean every minute
```
**Performance Budget:**
- Memory usage: <100MB after 1 hour
- Memory growth: <10MB per hour
- Cache size: <5MB
---
### 6. Performance Monitoring
**Implementation:**
```typescript
// 1. Performance marks for key operations
performance.mark('sidepanel-open-start');
// ... open side panel
performance.mark('sidepanel-open-end');
performance.measure(
'sidepanel-open',
'sidepanel-open-start',
'sidepanel-open-end'
);
// 2. Send metrics to backend
const metrics = performance.getEntriesByType('measure');
fetch('/api/metrics', {
method: 'POST',
body: JSON.stringify({
metrics: metrics.map(m => ({
name: m.name,
duration: m.duration,
timestamp: Date.now(),
})),
}),
});
// 3. Real User Monitoring (RUM)
window.addEventListener('load', () => {
const perfData = performance.getEntriesByType('navigation')[0];
console.log('Page Load Time:', perfData.loadEventEnd - perfData.fetchStart);
console.log('DOM Content Loaded:', perfData.domContentLoadedEventEnd - perfData.fetchStart);
});
```
**Monitoring Dashboards:**
- Track P95/P99 latencies for all critical operations
- Alert if any metric exceeds critical threshold
- Weekly performance review with team
---
### Definition of Done (Performance)
- [ ] All performance targets met in production
- [ ] Performance monitoring implemented
- [ ] Offline mode tested and working
- [ ] Memory leaks tested (24-hour stress test)
- [ ] Bundle size optimized (<200KB gzipped)
- [ ] Virtual scrolling for chat history
- [ ] Lazy loading for heavy components
- [ ] Cache hit rate >80% for token data
- [ ] Performance regression tests in CI/CD

View file

@ -0,0 +1,48 @@
# Kiến Trúc Web Frontend
## Tổng Quan
Ứng dụng Web SurfSense được xây dựng trên **Next.js 16**, tận dụng các tính năng mới nhất như **React Server Components (RSC)****Server Actions**. Nó mang lại trải nghiệm người dùng (UX) hiện đại, nhanh chóng và tương tác cao, đóng vai trò là giao diện chính để người dùng quản lý kiến thức và tương tác với AI Agents.
## Stack Công Nghệ (Tech Stack)
| Hạng Mục | Công Nghệ | Ghi Chú |
|----------|-----------|---------|
| **Core** | Next.js 16 (Turbopack) | App Router, Server Actions |
| **Language** | TypeScript | Type safety toàn diện |
| **UI Library** | React 19 | Hooks mới (useOptimistic, useFormStatus) |
| **Styling** | Tailwind CSS v4 | Utility-first CSS |
| **State/Sync** | ElectricSQL | Đồng bộ dữ liệu local-first / real-time |
| **ORM Client** | Drizzle ORM | Truy vấn database an toàn (Type-safe) |
| **Components** | Shadcn UI + Assistant UI | Reusable components & AI Chat UI |
## Mô Hình Kiến Trúc (Architecture Patterns)
### 1. App Router & Server Components
- **Mặc định là Server Component**: Hầu hết các components (Layout, Page) được render trên server để tối ưu SEO và tải trang ban đầu.
- **Client Components**: Chỉ sử dụng (`"use client"`) cho các phần tương tác (interactive) như form, button, hoặc real-time chat.
- **Data Fetching**: Fetch dữ liệu trực tiếp trong Server Components (không cần useEffect cho initial data).
### 2. Server Actions cho Mutations
- Thay vì tạo API routes riêng biệt cho mọi hành động (submit form, like bài viết), SurfSense sử dụng **Server Actions**.
- Gọi hàm backend trực tiếp từ frontend code.
- Xử lý xác thực và validation ngay trong action.
### 3. Local-First Sync với ElectricSQL
- **Vấn đề**: Độ trễ mạng khi thao tác nhiều dữ liệu.
- **Giải pháp**: ElectricSQL đồng bộ một phần database Postgres xuống client (trong trình duyệt).
- **Lợi ích**: UI phản hồi tức thì (Optimistic UI), hoạt động offline-first, và tự động đồng bộ khi có mạng.
### 4. Kiến Trúc AI Chat
- **Streaming**: Sử dụng `AI SDK` (hoặc tương đương) để stream phản hồi từ Backend LangGraph.
- **Generative UI**: Render các components React ngay trong luồng chat (ví dụ: hiển thị một bảng dữ liệu hoặc biểu đồ thay vì chỉ text).
- **Tool Call Handling**: Client hiển thị trạng thái "đang xử lý" khi Agent gọi tool kiểm tra thời tiết hoặc tìm kiếm document.
## Cấu Trúc Thư Mục Chính (`surfsense_web/app`)
- `(home)/`: Landing page, Marketing sites (Public).
- `dashboard/`: Không gian làm việc chính của user (Protected).
- `layout.tsx`: Sidebar, Header, Auth Check.
- `page.tsx`: Dashboard tổng quan.
- `chat/[id]/page.tsx`: Giao diện chat chi tiết.
- `search/page.tsx`: Giao diện tìm kiếm nâng cao.
- `api/`: Route Handlers cho các trường hợp đặc biệt (như Webhook từ bên thứ 3).

View file

@ -0,0 +1,38 @@
# Kho Components Web (Component Inventory)
Tài liệu này liệt kê các nhóm components UI chính được sử dụng trong `surfsense_web`.
## 1. UI Primitives (`components/ui`)
Dựa trên **Shadcn UI****Radix Primitives**. Các thành phần cơ bản này đảm bảo tính nhất quán về thiết kế và khả năng tiếp cận (accessibility).
- **Core**: `Button`, `Input`, `Select`, `Checkbox`, `Switch`.
- **Feedback**: `Toast` (thông báo), `Alert`, `Progress`, `Skeleton` (loading state).
- **Overlay**: `Dialog` (Modal), `Sheet` (Sidebar Drawer), `Popover`, `Tooltip`.
- **Layout**: `Card`, `Separator`, `ScrollArea`, `Resizable` (chia đôi màn hình).
## 2. Layout Components (`components/layout`)
Các thành phần cấu trúc dùng chung cho các trang.
- **`Sidebar`**: Menu điều hướng chính bên trái (collapsible).
- **`Header`**: Thanh trên cùng chứa User Menu, Theme Toggle, Breadcrumbs.
- **`UserNav`**: Dropdown menu tài khoản người dùng.
- **`ThemeToggle`**: Chuyển đổi Dark/Light mode.
## 3. Assistant UI (`components/assistant-ui`)
Các components chuyên biệt cho trải nghiệm AI Chat.
- **`ChatThread`**: Container chính quản lý danh sách tin nhắn.
- **`Composer`**: Khung nhập liệu thông minh (hỗ trợ slash commands, file attachment).
- **`MessageList`**: Hiển thị tin nhắn cuộn (scrollable).
- **`MessageBubble`**: Hiển thị nội dung tin nhắn (User/AI).
- Hỗ trợ Markdown rendering.
- Hỗ trợ hiển thị Code Block với syntax highlighting.
- **`ThreadHistory`**: Sidebar danh sách các cuộc hội thoại cũ.
- **`ToolResult`**: Hiển thị kết quả trả về từ tool (VD: Card thông tin thời tiết).
## 4. Feature Components
Các components đặc thù cho nghiệp vụ SurfSense.
- **`DocumentCard`**: Hiển thị tóm tắt tài liệu trong danh sách tìm kiếm.
- **`ConnectorGrid`**: Lưới các icon ứng dụng để user kết nối (Gmail, Slack...).
- **`SearchFilters`**: Bộ lọc nâng cao cho tìm kiếm (theo ngày, loại file, nguồn).

View file

@ -0,0 +1,450 @@
# Giải Thích Hệ Thống Connectors
**Tài liệu bổ sung cho SurfSense**
---
## 📌 Connectors Là Gì?
**Connectors** (Bộ kết nối) là tính năng cho phép SurfSense **tìm kiếm và truy xuất dữ liệu từ các ứng dụng bên ngoài** mà bạn đang sử dụng hàng ngày, như:
- 📧 **Gmail** - Tìm kiếm trong emails
- 📁 **Google Drive** - Tìm kiếm files và documents
- 📅 **Google Calendar** - Tìm kiếm events và meetings
- 💬 **Slack** - Tìm kiếm messages và conversations
- 📝 **Notion** - Tìm kiếm pages và databases
- 🎯 **Linear** - Tìm kiếm issues và projects
- 📊 **Airtable** - Tìm kiếm bases và records
- 🎫 **Jira** - Tìm kiếm tickets
- 📚 **Confluence** - Tìm kiếm wiki pages
- 🗂️ **Microsoft Teams** - Tìm kiếm chats và files
- 💰 **DexScreener** - Theo dõi giá token crypto và trading pairs
**Tổng cộng:** SurfSense hỗ trợ **27+ connectors** khác nhau!
---
## 🎯 Mục Đích
Thay vì phải:
1. Mở Gmail → tìm kiếm email
2. Mở Google Drive → tìm kiếm file
3. Mở Slack → tìm kiếm message
4. Mở Notion → tìm kiếm note
Bạn chỉ cần:
- **Mở SurfSense** → Tìm kiếm 1 lần → Nhận kết quả từ **TẤT CẢ** các ứng dụng đã kết nối!
---
## 🔌 Cách Hoạt Động
### Bước 1: Kết Nối (Connect)
Khi bạn click nút **"Connect"** bên cạnh một connector (ví dụ: Google Drive):
1. **OAuth Authentication:**
- SurfSense chuyển hướng bạn đến trang đăng nhập của Google
- Bạn đăng nhập và cấp quyền cho SurfSense:
- ✅ Đọc files trong Drive
- ✅ Đọc metadata (tên file, ngày tạo, etc.)
- ❌ **KHÔNG** có quyền xóa hoặc chỉnh sửa files
2. **Lưu Access Token:**
- Google trả về một **access token** (mã truy cập)
- SurfSense lưu token này vào database (được mã hóa)
- Token này cho phép SurfSense truy cập Drive của bạn **thay mặt bạn**
3. **Tạo Connector Record:**
- SurfSense tạo 1 record trong bảng `search_source_connectors`:
```json
{
"id": 123,
"name": "My Google Drive",
"connector_type": "GOOGLE_DRIVE_CONNECTOR",
"user_id": "your-user-id",
"search_space_id": 1,
"config": {
"access_token": "encrypted_token",
"refresh_token": "encrypted_refresh_token"
},
"is_indexable": true,
"periodic_indexing_enabled": true,
"indexing_frequency_minutes": 60
}
```
### Bước 2: Indexing (Lập Chỉ Mục)
Sau khi kết nối thành công, SurfSense bắt đầu **indexing** (lập chỉ mục) dữ liệu:
1. **Fetch Data từ API:**
- SurfSense gọi API của Google Drive (sử dụng access token)
- Lấy danh sách tất cả files: `GET https://www.googleapis.com/drive/v3/files`
- Với mỗi file, lấy:
- Tên file
- Nội dung (text content)
- Metadata (owner, created_at, modified_at, etc.)
2. **Tạo Embeddings:**
- Nội dung file được chuyển thành **vector embeddings** (dùng OpenAI/Gemini)
- Ví dụ: File "Project Plan.docx" → Vector 1536 chiều
- Vector này biểu diễn **ý nghĩa ngữ nghĩa** của nội dung
3. **Lưu vào Database:**
- **PostgreSQL** (bảng `documents`):
```sql
INSERT INTO documents (
title, content, document_type, source_connector_id, user_id
) VALUES (
'Project Plan.docx',
'Full text content...',
'GOOGLE_DRIVE_FILE',
123, -- connector_id
'your-user-id'
);
```
- **Vector Database** (Qdrant):
```json
{
"id": "doc-456",
"vector": [0.123, -0.456, 0.789, ...], // 1536 dimensions
"payload": {
"title": "Project Plan.docx",
"document_id": 456,
"connector_type": "GOOGLE_DRIVE_FILE"
}
}
```
4. **Periodic Re-indexing:**
- Mỗi 60 phút (hoặc theo cấu hình), SurfSense tự động:
- Kiểm tra files mới
- Kiểm tra files đã update
- Re-index nếu có thay đổi
### Bước 3: Search (Tìm Kiếm)
Khi bạn tìm kiếm trong SurfSense:
1. **User Query:**
- Bạn nhập: *"project timeline for Q1"*
2. **Query Embedding:**
- SurfSense chuyển query thành vector: `[0.234, -0.567, ...]`
3. **Vector Search:**
- Tìm kiếm trong Qdrant (similarity search):
```python
results = qdrant_client.search(
collection_name="surfsense",
query_vector=[0.234, -0.567, ...],
limit=10,
filter={
"user_id": "your-user-id",
"connector_type": ["GOOGLE_DRIVE_FILE", "GMAIL", "NOTION"]
}
)
```
4. **Kết Quả:**
- Trả về top 10 documents có vector gần nhất (most similar)
- Ví dụ:
```
1. "Q1 Project Timeline.xlsx" (Google Drive) - 95% match
2. "Email: Q1 Planning Meeting" (Gmail) - 87% match
3. "Notion: Q1 Roadmap" (Notion) - 82% match
```
5. **AI Chat (Optional):**
- Nếu bạn dùng AI Chat, SurfSense sẽ:
- Lấy nội dung của top 10 results
- Gửi cho LLM (GPT-4/Claude/Gemini) kèm theo query
- LLM tổng hợp và trả lời câu hỏi dựa trên context
---
## 🔐 Bảo Mật
### Quyền Truy Cập
- **Read-only:** Connectors chỉ có quyền **ĐỌC**, không thể xóa/sửa dữ liệu
- **User-scoped:** Mỗi user chỉ thấy dữ liệu của chính họ
- **Encrypted:** Access tokens được mã hóa trong database
### Revoke Access (Thu Hồi Quyền)
Bạn có thể ngắt kết nối bất cứ lúc nào:
1. **Trong SurfSense:**
- Vào **Settings** → **Connectors**
- Click **"Disconnect"** bên cạnh connector
- SurfSense sẽ:
- Xóa access token
- Xóa tất cả indexed data từ connector đó
2. **Trong Google/Slack/etc:**
- Vào settings của ứng dụng gốc
- Revoke quyền truy cập của SurfSense
- Ví dụ Google: https://myaccount.google.com/permissions
---
## 📊 Loại Connectors
### 1. Managed OAuth (Composio)
**Ví dụ:** Google Drive, Gmail, Google Calendar
- Sử dụng **Composio** (third-party OAuth provider)
- Ưu điểm:
- Setup nhanh (không cần tạo OAuth app riêng)
- Composio quản lý token refresh tự động
- Nhược điểm:
- Phụ thuộc vào Composio service
**Flow:**
```
User → SurfSense → Composio → Google OAuth → Access Token → SurfSense
```
### 2. Quick Connect (Direct OAuth)
**Ví dụ:** Notion, Slack, Linear, Airtable
- Kết nối trực tiếp với API của ứng dụng
- Ưu điểm:
- Không phụ thuộc third-party
- Full control
- Nhược điểm:
- Cần setup OAuth app riêng cho mỗi service
**Flow:**
```
User → SurfSense → Notion OAuth → Access Token → SurfSense
```
### 3. API Key Based
**Ví dụ:** Elasticsearch, Webcrawler
- Không dùng OAuth, chỉ cần API key
- User nhập API key trực tiếp vào SurfSense
### 4. Self-Hosted Only
**Ví dụ:** Obsidian Connector
- Chỉ hoạt động khi SurfSense chạy self-hosted
- Truy cập trực tiếp vào local file system
### 5. API-Based (No Authentication)
**Ví dụ:** DexScreener Connector
- Không cần OAuth hay API key (public API)
- User chỉ cần cấu hình tokens muốn theo dõi
- Ưu điểm:
- Setup cực kỳ đơn giản (không cần đăng ký API key)
- Miễn phí hoàn toàn
- Real-time data từ public blockchain
- Nhược điểm:
- Bị giới hạn rate limit của public API
- Không có personalized data
**Flow:**
```
User → Nhập token addresses → SurfSense → DexScreener Public API → Token Price Data
```
**Use Case:**
- Theo dõi giá crypto tokens (WETH, USDC, etc.)
- Phân tích trading pairs trên các DEX
- AI có thể trả lời: *"What's the current price of WETH?"*
---
## 🛠️ Cấu Hình Connector
Mỗi connector có các settings:
### Indexing Settings
```json
{
"periodic_indexing_enabled": true,
"indexing_frequency_minutes": 60,
"next_scheduled_at": "2026-01-31T15:00:00Z"
}
```
- **periodic_indexing_enabled:** Bật/tắt auto re-index
- **indexing_frequency_minutes:** Tần suất re-index (phút)
- **next_scheduled_at:** Lần re-index tiếp theo
### Connector-Specific Config
**Google Drive:**
```json
{
"folders": ["folder-id-1", "folder-id-2"], // Chỉ index các folders này
"file_types": ["document", "spreadsheet"], // Chỉ index loại files này
"exclude_shared": false // Index cả shared files
}
```
**Slack:**
```json
{
"channels": ["general", "engineering"], // Chỉ index các channels này
"include_dms": true, // Index direct messages
"date_range_days": 90 // Chỉ index 90 ngày gần nhất
}
```
**DexScreener:**
```json
{
"tokens": [
{
"chain": "ethereum",
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "WETH"
},
{
"chain": "bsc",
"address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
"name": "WBNB"
}
]
}
```
---
## 💡 Use Cases
### 1. Knowledge Worker
**Scenario:** Bạn là Product Manager, cần tìm thông tin về feature request từ khách hàng.
**Trước khi có Connectors:**
- Tìm trong Gmail → Không thấy
- Tìm trong Slack → Không thấy
- Tìm trong Notion → Không thấy
- Tìm trong Linear → Tìm thấy!
- **Tổng thời gian:** 15 phút
**Sau khi có Connectors:**
- Mở SurfSense → Tìm kiếm: *"customer feature request payment"*
- Kết quả:
1. Linear Issue #123
2. Slack message từ customer
3. Email thread với customer
4. Notion doc: Feature Spec
- **Tổng thời gian:** 30 giây
### 2. Developer
**Scenario:** Debug lỗi production, cần tìm code changes liên quan.
**Connectors kết nối:**
- GitHub (code commits)
- Slack (engineering channel)
- Jira (bug tickets)
- Confluence (technical docs)
**Search query:** *"payment API timeout error"*
**Kết quả:**
1. GitHub commit: "Fix payment timeout"
2. Jira ticket: PROD-456
3. Slack discussion về issue
4. Confluence: Payment API Architecture
### 3. Crypto Trader
**Scenario:** Theo dõi giá token và phân tích market trends.
**Connectors kết nối:**
- DexScreener (token prices và trading pairs)
- Twitter/X (crypto news - nếu có connector)
- Notion (trading notes)
**Search query trong AI Chat:** *"What's the current price of WETH and how has it changed in the last 24 hours?"*
**Kết quả:**
- AI trả lời với real-time price data từ DexScreener
- Hiển thị price changes (5m, 1h, 24h)
- Liquidity và volume information
- Citations link đến DexScreener pairs
---
## 🚨 Lưu Ý Quan Trọng
### 1. Research Mode KHÔNG Tồn Tại Trên FE
**Sự thật:**
- Tài liệu trước đó (user-guide.md) đề cập "Research Mode" là **SAI**
- Frontend chỉ có **1 chế độ chat duy nhất**
- Backend có thể có logic khác nhau, nhưng user không thấy toggle nào
**Đã sửa:** Tài liệu sẽ được cập nhật để loại bỏ phần Research Mode.
### 2. Connector ≠ Extension
- **Browser Extension:** Capture nội dung từ trang web bạn đang browse
- **Connectors:** Fetch dữ liệu từ các ứng dụng bên ngoài (Gmail, Drive, etc.)
- Hai tính năng **độc lập** nhưng **bổ sung** cho nhau
### 3. Privacy
- Dữ liệu được index **chỉ dành cho bạn**
- Không ai khác (kể cả admin) có thể thấy nội dung files của bạn
- Trừ khi bạn share chat với visibility = "SEARCH_SPACE"
---
## 📞 Troubleshooting
### Connector Không Hoạt Động
**Triệu chứng:** Sau khi connect, không thấy kết quả khi search.
**Kiểm tra:**
1. **Indexing status:**
```sql
SELECT name, connector_type, last_indexed_at, next_scheduled_at
FROM search_source_connectors
WHERE user_id = 'your-user-id';
```
- Nếu `last_indexed_at` = NULL → Indexing chưa chạy
2. **Backend logs:**
```bash
grep "connector" surfsense_backend/logs/app.log
```
- Tìm lỗi liên quan đến connector
3. **Token expired:**
- Access token có thể hết hạn
- Disconnect và reconnect lại connector
### Kết Quả Không Chính Xác
**Nguyên nhân:**
- Embeddings không capture đúng ý nghĩa
- Cần re-index với model tốt hơn
**Giải pháp:**
- Admin có thể trigger manual re-index:
```bash
python manage.py reindex-connector --connector-id 123
```
---
**Cập nhật:** 2026-01-31 | **Version:** 1.0

View file

@ -0,0 +1,905 @@
# Hướng Dẫn Tạo Custom Connectors cho SurfSense
## Tổng Quan
Bạn **hoàn toàn có thể** tạo custom connectors để kết nối đến các API bên ngoài như DexScreener, DefiLlama để phân tích token crypto. SurfSense có kiến trúc connector rất linh hoạt và dễ mở rộng.
## Kiến Trúc Connector
Mỗi connector trong SurfSense bao gồm 3 phần chính:
### 1. **Connector Class** (`app/connectors/`)
- Xử lý logic kết nối đến API bên ngoài
- Fetch và transform data
- Format data thành markdown để indexing
### 2. **API Routes** (`app/routes/`)
- Endpoint để add/delete/test connector
- Lưu config vào database
- Xác thực user
### 3. **Database Schema** (`app/db.py`)
- Định nghĩa connector type trong `SearchSourceConnectorType` enum
- Lưu trữ config (API keys, settings) trong `SearchSourceConnector` table
## Ví Dụ: Tạo DexScreener Connector
### Bước 1: Tạo Connector Class
Tạo file `/Users/mac_1/Documents/GitHub/SurfSense/surfsense_backend/app/connectors/dexscreener_connector.py`:
```python
"""
DexScreener Connector Module
A module for fetching token data and analytics from DexScreener API.
"""
from typing import Any
import requests
from datetime import datetime
class DexScreenerConnector:
"""Class for retrieving token data from DexScreener."""
def __init__(self, api_key: str | None = None):
"""
Initialize the DexScreenerConnector class.
Args:
api_key: DexScreener API key (optional for public endpoints)
"""
self.api_key = api_key
self.base_url = "https://api.dexscreener.com/latest"
def set_api_key(self, api_key: str) -> None:
"""Set the DexScreener API key."""
self.api_key = api_key
def get_headers(self) -> dict[str, str]:
"""Get headers for DexScreener API requests."""
headers = {"Content-Type": "application/json"}
if self.api_key:
headers["Authorization"] = f"Bearer {self.api_key}"
return headers
def search_pairs(
self, query: str
) -> tuple[list[dict[str, Any]], str | None]:
"""
Search for trading pairs by token address or symbol.
Args:
query: Token address or symbol to search
Returns:
Tuple containing (pairs list, error message or None)
"""
try:
url = f"{self.base_url}/dex/search"
params = {"q": query}
response = requests.get(
url,
headers=self.get_headers(),
params=params,
timeout=10
)
if response.status_code == 200:
data = response.json()
pairs = data.get("pairs", [])
return pairs, None
else:
return [], f"API request failed with status {response.status_code}"
except Exception as e:
return [], f"Error searching pairs: {str(e)}"
def get_token_pairs(
self, token_address: str
) -> tuple[list[dict[str, Any]], str | None]:
"""
Get all pairs for a specific token address.
Args:
token_address: Token contract address
Returns:
Tuple containing (pairs list, error message or None)
"""
try:
url = f"{self.base_url}/dex/tokens/{token_address}"
response = requests.get(
url,
headers=self.get_headers(),
timeout=10
)
if response.status_code == 200:
data = response.json()
pairs = data.get("pairs", [])
return pairs, None
else:
return [], f"API request failed with status {response.status_code}"
except Exception as e:
return [], f"Error fetching token pairs: {str(e)}"
def get_pair_by_address(
self, pair_address: str
) -> tuple[dict[str, Any] | None, str | None]:
"""
Get detailed information about a specific pair.
Args:
pair_address: Pair contract address
Returns:
Tuple containing (pair data dict, error message or None)
"""
try:
url = f"{self.base_url}/dex/pairs/{pair_address}"
response = requests.get(
url,
headers=self.get_headers(),
timeout=10
)
if response.status_code == 200:
data = response.json()
pair = data.get("pair")
return pair, None
else:
return None, f"API request failed with status {response.status_code}"
except Exception as e:
return None, f"Error fetching pair: {str(e)}"
def format_pair_to_markdown(self, pair: dict[str, Any]) -> str:
"""
Convert a trading pair to markdown format for indexing.
Args:
pair: The pair object from DexScreener API
Returns:
Markdown string representation of the pair
"""
# Extract basic info
chain_id = pair.get("chainId", "Unknown")
dex_id = pair.get("dexId", "Unknown")
pair_address = pair.get("pairAddress", "")
# Token info
base_token = pair.get("baseToken", {})
quote_token = pair.get("quoteToken", {})
base_name = base_token.get("name", "Unknown")
base_symbol = base_token.get("symbol", "Unknown")
quote_name = quote_token.get("name", "Unknown")
quote_symbol = quote_token.get("symbol", "Unknown")
# Price and volume
price_native = pair.get("priceNative", "N/A")
price_usd = pair.get("priceUsd", "N/A")
volume_24h = pair.get("volume", {}).get("h24", "N/A")
liquidity_usd = pair.get("liquidity", {}).get("usd", "N/A")
# Price changes
price_change_5m = pair.get("priceChange", {}).get("m5", "N/A")
price_change_1h = pair.get("priceChange", {}).get("h1", "N/A")
price_change_24h = pair.get("priceChange", {}).get("h24", "N/A")
# Build markdown
markdown = f"# {base_symbol}/{quote_symbol} Trading Pair\n\n"
markdown += f"**Chain:** {chain_id}\n"
markdown += f"**DEX:** {dex_id}\n"
markdown += f"**Pair Address:** `{pair_address}`\n\n"
markdown += "## Token Information\n\n"
markdown += f"### Base Token: {base_name} ({base_symbol})\n"
markdown += f"- **Address:** `{base_token.get('address', 'N/A')}`\n\n"
markdown += f"### Quote Token: {quote_name} ({quote_symbol})\n"
markdown += f"- **Address:** `{quote_token.get('address', 'N/A')}`\n\n"
markdown += "## Market Data\n\n"
markdown += f"- **Price (Native):** {price_native}\n"
markdown += f"- **Price (USD):** ${price_usd}\n"
markdown += f"- **24h Volume:** ${volume_24h}\n"
markdown += f"- **Liquidity (USD):** ${liquidity_usd}\n\n"
markdown += "## Price Changes\n\n"
markdown += f"- **5 minutes:** {price_change_5m}%\n"
markdown += f"- **1 hour:** {price_change_1h}%\n"
markdown += f"- **24 hours:** {price_change_24h}%\n\n"
# Add URL if available
url = pair.get("url")
if url:
markdown += f"**DexScreener URL:** {url}\n\n"
# Add timestamp
markdown += f"*Data fetched at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n"
return markdown
def get_all_token_data(
self, token_addresses: list[str]
) -> tuple[list[str], str | None]:
"""
Fetch and format data for multiple tokens.
Args:
token_addresses: List of token contract addresses
Returns:
Tuple containing (list of markdown documents, error message or None)
"""
documents = []
errors = []
for address in token_addresses:
pairs, error = self.get_token_pairs(address)
if error:
errors.append(f"Error for {address}: {error}")
continue
for pair in pairs:
markdown_doc = self.format_pair_to_markdown(pair)
documents.append(markdown_doc)
error_msg = "; ".join(errors) if errors else None
return documents, error_msg
```
### Bước 2: Thêm Connector Type vào Database
Sửa file `/Users/mac_1/Documents/GitHub/SurfSense/surfsense_backend/app/db.py`:
```python
class SearchSourceConnectorType(str, Enum):
# ... existing connectors ...
DEXSCREENER_CONNECTOR = "DEXSCREENER_CONNECTOR"
DEFILLAMA_CONNECTOR = "DEFILLAMA_CONNECTOR"
```
### Bước 3: Tạo API Routes
Tạo file `/Users/mac_1/Documents/GitHub/SurfSense/surfsense_backend/app/routes/dexscreener_add_connector_route.py`:
```python
import logging
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel, Field
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.future import select
from app.db import (
SearchSourceConnector,
SearchSourceConnectorType,
User,
get_async_session,
)
from app.users import current_active_user
logger = logging.getLogger(__name__)
router = APIRouter()
class AddDexScreenerConnectorRequest(BaseModel):
"""Request model for adding a DexScreener connector."""
api_key: str | None = Field(None, description="DexScreener API key (optional)")
space_id: int = Field(..., description="Search space ID")
token_addresses: list[str] = Field(
default_factory=list,
description="List of token addresses to track"
)
@router.post("/connectors/dexscreener/add")
async def add_dexscreener_connector(
request: AddDexScreenerConnectorRequest,
user: User = Depends(current_active_user),
session: AsyncSession = Depends(get_async_session),
):
"""
Add a new DexScreener connector for the authenticated user.
Args:
request: The request containing DexScreener config and space_id
user: Current authenticated user
session: Database session
Returns:
Success message and connector details
Raises:
HTTPException: If connector already exists or validation fails
"""
try:
# Check if a DexScreener connector already exists
result = await session.execute(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == request.space_id,
SearchSourceConnector.user_id == user.id,
SearchSourceConnector.connector_type
== SearchSourceConnectorType.DEXSCREENER_CONNECTOR,
)
)
existing_connector = result.scalars().first()
config = {
"token_addresses": request.token_addresses,
}
if request.api_key:
config["api_key"] = request.api_key
if existing_connector:
# Update existing connector
existing_connector.config = config
existing_connector.is_indexable = True
await session.commit()
await session.refresh(existing_connector)
logger.info(
f"Updated existing DexScreener connector for user {user.id}"
)
return {
"message": "DexScreener connector updated successfully",
"connector_id": existing_connector.id,
"connector_type": "DEXSCREENER_CONNECTOR",
}
# Create new DexScreener connector
db_connector = SearchSourceConnector(
name="DexScreener Token Tracker",
connector_type=SearchSourceConnectorType.DEXSCREENER_CONNECTOR,
config=config,
search_space_id=request.space_id,
user_id=user.id,
is_indexable=True,
)
session.add(db_connector)
await session.commit()
await session.refresh(db_connector)
logger.info(
f"Successfully created DexScreener connector for user {user.id}"
)
return {
"message": "DexScreener connector added successfully",
"connector_id": db_connector.id,
"connector_type": "DEXSCREENER_CONNECTOR",
}
except IntegrityError as e:
await session.rollback()
logger.error(f"Database integrity error: {str(e)}")
raise HTTPException(
status_code=409,
detail="A DexScreener connector already exists for this user.",
) from e
except Exception as e:
await session.rollback()
logger.error(f"Unexpected error: {str(e)}", exc_info=True)
raise HTTPException(
status_code=500,
detail=f"Failed to add DexScreener connector: {str(e)}",
) from e
@router.delete("/connectors/dexscreener")
async def delete_dexscreener_connector(
space_id: int,
user: User = Depends(current_active_user),
session: AsyncSession = Depends(get_async_session),
):
"""Delete the DexScreener connector."""
try:
result = await session.execute(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == space_id,
SearchSourceConnector.user_id == user.id,
SearchSourceConnector.connector_type
== SearchSourceConnectorType.DEXSCREENER_CONNECTOR,
)
)
connector = result.scalars().first()
if not connector:
raise HTTPException(
status_code=404,
detail="DexScreener connector not found.",
)
await session.delete(connector)
await session.commit()
return {"message": "DexScreener connector deleted successfully"}
except HTTPException:
raise
except Exception as e:
await session.rollback()
logger.error(f"Unexpected error: {str(e)}", exc_info=True)
raise HTTPException(
status_code=500,
detail=f"Failed to delete DexScreener connector: {str(e)}",
) from e
@router.get("/connectors/dexscreener/test")
async def test_dexscreener_connector(
space_id: int,
user: User = Depends(current_active_user),
session: AsyncSession = Depends(get_async_session),
):
"""Test the DexScreener connector."""
try:
# Get the connector
result = await session.execute(
select(SearchSourceConnector).filter(
SearchSourceConnector.search_space_id == space_id,
SearchSourceConnector.user_id == user.id,
SearchSourceConnector.connector_type
== SearchSourceConnectorType.DEXSCREENER_CONNECTOR,
)
)
connector = result.scalars().first()
if not connector:
raise HTTPException(
status_code=404,
detail="DexScreener connector not found.",
)
# Import and test
from app.connectors.dexscreener_connector import DexScreenerConnector
api_key = connector.config.get("api_key")
dex = DexScreenerConnector(api_key=api_key)
# Test with a sample search
pairs, error = dex.search_pairs("WETH")
if error:
raise HTTPException(
status_code=400,
detail=f"Failed to connect to DexScreener: {error}",
)
return {
"message": "DexScreener connector is working correctly",
"sample_pairs_count": len(pairs),
"tracked_tokens": connector.config.get("token_addresses", []),
}
except HTTPException:
raise
except Exception as e:
logger.error(f"Unexpected error: {str(e)}", exc_info=True)
raise HTTPException(
status_code=500,
detail=f"Failed to test DexScreener connector: {str(e)}",
) from e
```
### Bước 4: Đăng Ký Routes
Sửa file `/Users/mac_1/Documents/GitHub/SurfSense/surfsense_backend/app/main.py`:
```python
# Import route
from app.routes import dexscreener_add_connector_route
# Add to app
app.include_router(
dexscreener_add_connector_route.router,
prefix="/api",
tags=["connectors"]
)
```
### Bước 5: Tạo Indexing Logic
Tạo file để xử lý indexing tự động:
```python
# app/connectors/dexscreener_indexer.py
from app.connectors.dexscreener_connector import DexScreenerConnector
from app.db import SearchSourceConnector
import logging
logger = logging.getLogger(__name__)
async def index_dexscreener_data(connector: SearchSourceConnector):
"""
Index data from DexScreener connector.
This function will be called periodically by the indexing service.
"""
try:
config = connector.config
api_key = config.get("api_key")
token_addresses = config.get("token_addresses", [])
if not token_addresses:
logger.warning(f"No token addresses configured for connector {connector.id}")
return []
# Initialize connector
dex = DexScreenerConnector(api_key=api_key)
# Fetch data for all tracked tokens
documents, error = dex.get_all_token_data(token_addresses)
if error:
logger.error(f"Error indexing DexScreener data: {error}")
return []
logger.info(f"Successfully indexed {len(documents)} documents from DexScreener")
return documents
except Exception as e:
logger.error(f"Error in DexScreener indexing: {str(e)}", exc_info=True)
return []
```
## Ví Dụ: DefiLlama Connector
Tương tự, bạn có thể tạo DefiLlama connector:
```python
# app/connectors/defillama_connector.py
"""
DefiLlama Connector Module
A module for fetching DeFi protocol data and TVL analytics from DefiLlama API.
"""
from typing import Any
import requests
from datetime import datetime
class DefiLlamaConnector:
"""Class for retrieving DeFi data from DefiLlama."""
def __init__(self):
"""Initialize the DefiLlamaConnector class."""
self.base_url = "https://api.llama.fi"
def get_protocol(
self, protocol_slug: str
) -> tuple[dict[str, Any] | None, str | None]:
"""
Get detailed information about a specific protocol.
Args:
protocol_slug: Protocol slug (e.g., "uniswap", "aave")
Returns:
Tuple containing (protocol data dict, error message or None)
"""
try:
url = f"{self.base_url}/protocol/{protocol_slug}"
response = requests.get(url, timeout=10)
if response.status_code == 200:
return response.json(), None
else:
return None, f"API request failed with status {response.status_code}"
except Exception as e:
return None, f"Error fetching protocol: {str(e)}"
def get_tvl_history(
self, protocol_slug: str
) -> tuple[list[dict[str, Any]], str | None]:
"""
Get TVL history for a protocol.
Args:
protocol_slug: Protocol slug
Returns:
Tuple containing (TVL history list, error message or None)
"""
protocol_data, error = self.get_protocol(protocol_slug)
if error:
return [], error
tvl_history = protocol_data.get("tvl", [])
return tvl_history, None
def get_all_protocols(self) -> tuple[list[dict[str, Any]], str | None]:
"""
Get list of all protocols with basic info.
Returns:
Tuple containing (protocols list, error message or None)
"""
try:
url = f"{self.base_url}/protocols"
response = requests.get(url, timeout=10)
if response.status_code == 200:
return response.json(), None
else:
return [], f"API request failed with status {response.status_code}"
except Exception as e:
return [], f"Error fetching protocols: {str(e)}"
def get_chain_tvl(
self, chain: str
) -> tuple[dict[str, Any] | None, str | None]:
"""
Get TVL for a specific chain.
Args:
chain: Chain name (e.g., "Ethereum", "BSC")
Returns:
Tuple containing (chain TVL data, error message or None)
"""
try:
url = f"{self.base_url}/tvl/{chain}"
response = requests.get(url, timeout=10)
if response.status_code == 200:
return response.json(), None
else:
return None, f"API request failed with status {response.status_code}"
except Exception as e:
return None, f"Error fetching chain TVL: {str(e)}"
def format_protocol_to_markdown(self, protocol: dict[str, Any]) -> str:
"""
Convert protocol data to markdown format.
Args:
protocol: Protocol data from DefiLlama API
Returns:
Markdown string representation
"""
name = protocol.get("name", "Unknown Protocol")
slug = protocol.get("slug", "")
symbol = protocol.get("symbol", "N/A")
# TVL data
tvl = protocol.get("tvl", 0)
chain_tvls = protocol.get("chainTvls", {})
# Categories and chains
category = protocol.get("category", "N/A")
chains = protocol.get("chains", [])
# Build markdown
markdown = f"# {name}\n\n"
if symbol != "N/A":
markdown += f"**Symbol:** {symbol}\n"
markdown += f"**Category:** {category}\n"
markdown += f"**Slug:** `{slug}`\n\n"
markdown += "## Total Value Locked (TVL)\n\n"
markdown += f"**Current TVL:** ${tvl:,.2f}\n\n"
if chains:
markdown += "### TVL by Chain\n\n"
for chain in chains:
chain_tvl = chain_tvls.get(chain, 0)
markdown += f"- **{chain}:** ${chain_tvl:,.2f}\n"
markdown += "\n"
# Description
description = protocol.get("description")
if description:
markdown += f"## Description\n\n{description}\n\n"
# Links
url = protocol.get("url")
twitter = protocol.get("twitter")
if url or twitter:
markdown += "## Links\n\n"
if url:
markdown += f"- **Website:** {url}\n"
if twitter:
markdown += f"- **Twitter:** https://twitter.com/{twitter}\n"
markdown += "\n"
markdown += f"*Data fetched at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n"
return markdown
```
## Cách Sử Dụng
### 1. Thêm Connector qua API
```bash
# Add DexScreener connector
curl -X POST "http://localhost:8000/api/connectors/dexscreener/add" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"space_id": 1,
"token_addresses": [
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
],
"api_key": "optional_api_key"
}'
```
### 2. Test Connector
```bash
curl -X GET "http://localhost:8000/api/connectors/dexscreener/test?space_id=1" \
-H "Authorization: Bearer YOUR_TOKEN"
```
### 3. Xóa Connector
```bash
curl -X DELETE "http://localhost:8000/api/connectors/dexscreener?space_id=1" \
-H "Authorization: Bearer YOUR_TOKEN"
```
## Tích Hợp vào Indexing Pipeline
Để connector tự động index data định kỳ, bạn cần:
1. **Thêm vào Connector Service** (`app/services/connector_service.py`)
2. **Đăng ký indexing task** trong background job scheduler
3. **Cấu hình re-indexing interval** (mặc định 60 phút)
Ví dụ:
```python
# app/services/connector_service.py
async def index_connector_data(connector: SearchSourceConnector):
"""Index data from any connector type."""
if connector.connector_type == SearchSourceConnectorType.DEXSCREENER_CONNECTOR:
from app.connectors.dexscreener_indexer import index_dexscreener_data
return await index_dexscreener_data(connector)
elif connector.connector_type == SearchSourceConnectorType.DEFILLAMA_CONNECTOR:
from app.connectors.defillama_indexer import index_defillama_data
return await index_defillama_data(connector)
# ... other connector types
```
---
## ⚠️ CRITICAL: Enable RAG Retrieval
**This is the most commonly missed step when adding new connectors!**
### The Problem
Even if your connector successfully:
1. ✅ Stores data in the database
2. ✅ Indexes data into vector store
3. ✅ Shows up in the UI
The LLM **WILL NOT** be able to retrieve this data unless you add the connector to the RAG mapping.
### The Fix
**File:** `surfsense_backend/app/agents/new_chat/chat_deepagent.py`
**Add your connector to `_CONNECTOR_TYPE_TO_SEARCHABLE`:**
```python
_CONNECTOR_TYPE_TO_SEARCHABLE = {
"GMAIL": "GMAIL",
"GOOGLE_DRIVE_CONNECTOR": "GOOGLE_DRIVE",
"SLACK_CONNECTOR": "SLACK",
"NOTION_CONNECTOR": "NOTION",
# ... other connectors ...
# ✅ ADD YOUR NEW CONNECTOR HERE
"DEXSCREENER_CONNECTOR": "DEXSCREENER_CONNECTOR",
"YOUR_CONNECTOR": "YOUR_CONNECTOR", # Example
}
```
### Why This Matters
This mapping is used by `_map_connectors_to_searchable_types()` to:
1. Build the list of available search spaces for the LLM
2. Include connector types in the tool description
3. Enable the LLM to search your connector's data
**Without this mapping:**
- LLM won't know your connector exists
- LLM can't search your indexed data
- Users will get "I don't have access to that data" responses
### Verification
After adding the mapping, test with a user query:
```bash
# Example for DexScreener
curl -X POST http://localhost:8000/api/chat \
-H "Authorization: Bearer $TOKEN" \
-d '{
"message": "What is the current price of WETH?",
"space_id": 7
}'
```
**Expected:** LLM retrieves data and provides answer with citations.
**If failed:** Check that:
1. Connector is in `_CONNECTOR_TYPE_TO_SEARCHABLE`
2. Connector type matches exactly (case-sensitive)
3. Data is indexed in the correct `search_space_id`
---
## Best Practices
### 1. **Error Handling**
- Luôn return tuple `(data, error)` để dễ xử lý
- Log errors chi tiết để debug
- Graceful degradation khi API fail
### 2. **Rate Limiting**
- Respect API rate limits
- Implement exponential backoff
- Cache data khi có thể
### 3. **Data Formatting**
- Format data thành markdown rõ ràng
- Include metadata (timestamps, sources)
- Structured format để vector search hiệu quả
### 4. **Security**
- Encrypt API keys trong database
- Validate user input
- Implement proper authentication
### 5. **Performance**
- Async/await cho I/O operations
- Batch requests khi có thể
- Optimize indexing frequency
## Kết Luận
Với kiến trúc connector linh hoạt của SurfSense, bạn có thể:
✅ Kết nối đến **bất kỳ API nào** (DexScreener, DefiLlama, CoinGecko, etc.)
✅ Tự động **index và search** data từ nhiều nguồn
**Customize** logic fetch và format data
**Scale** dễ dàng với nhiều connectors
Connector system cho phép bạn biến SurfSense thành một **unified search platform** cho mọi loại data - từ emails, documents đến crypto analytics!

View file

@ -0,0 +1,68 @@
# Mô Hình Dữ Liệu (Backend)
Tài liệu này mô tả schema cơ sở dữ liệu Postgres, được quản lý bởi SQLAlchemy và Alembic.
## Các Thực Thể Chính (Core Entities)
### `User`
Đại diện cho người dùng hệ thống.
- **`id`**: `Integer` (Primary Key)
- **`email`**: `String` (Unique)
- **`hashed_password`**: `String`
- **`is_active`**: `Boolean`
- **`created_at`**: `DateTime`
### `Usage`
Theo dõi hạn ngạch sử dụng (quota) của người dùng.
- **`id`**: `Integer`
- **`user_id`**: `ForeignKey -> User`
- **`request_count`**: `Integer` (Số request API đã gọi)
- **`token_consumed`**: `Integer` (Số token LLM đã dùng)
### `Document`
Đơn vị kiến thức cơ bản. Một tài liệu có thể là một file PDF, một trang web, hoặc một ghi chú Notion.
- **`id`**: `Integer`
- **`title`**: `String`
- **`content`**: `Text` (Nội dung thô, nếu có)
- **`url`**: `String` (Nguồn gốc)
- **`source_type`**: `Enum` (PDF, WEB, NOTION, SLACK...)
- **`owner_id`**: `ForeignKey -> User`
- **`embedding_status`**: `Enum` (PENDING, INDEXED, FAILED)
### `Chunk`
Phần nhỏ của tài liệu dùng cho Vector Search.
- **`id`**: `Integer`
- **`document_id`**: `ForeignKey -> Document`
- **`content`**: `Text` (Nội dung của đoạn chunk)
- **`embedding`**: `Vector(1536)` (Vector đại diện, dùng cho pgvector)
- **`metadata`**: `JSONB` (Thông tin bổ sung)
### `ChatThread`
Đại diện cho một cuộc hội thoại.
- **`id`**: `Integer`
- **`user_id`**: `ForeignKey -> User`
- **`title`**: `String`
- **`created_at`**: `DateTime`
### `ChatMessage`
Một tin nhắn trong cuộc hội thoại.
- **`id`**: `Integer`
- **`thread_id`**: `ForeignKey -> ChatThread`
- **`role`**: `Enum` (USER, ASSISTANT, SYSTEM)
- **`content`**: `Text`
- **`tool_calls`**: `JSONB` (Lưu trữ các function calls nếu có)
### `ConnectorCredential`
Lưu trữ token xác thực cho các ứng dụng bên ngoài.
- **`id`**: `Integer`
- **`user_id`**: `ForeignKey -> User`
- **`connector_type`**: `String` (ví dụ: "google_drive")
- **`encrypted_token`**: `String` (Token đã mã hóa)
- **`refresh_token`**: `String`
## Mối Quan Hệ ERD (Tóm tắt)
- `User` **1 -- n** `Document`
- `Document` **1 -- n** `Chunk`
- `User` **1 -- n** `ChatThread`
- `ChatThread` **1 -- n** `ChatMessage`
- `User` **1 -- 1** `Usage`

View file

@ -0,0 +1,444 @@
# Hướng Dẫn Developer SurfSense
**Dành cho Nhà Phát Triển**
---
## 📖 Giới Thiệu
Tài liệu này hướng dẫn developers cách setup, develop, và extend hệ thống SurfSense.
---
## 🏗️ Kiến Trúc Tổng Quan
SurfSense bao gồm 3 components chính:
1. **Backend** (`surfsense_backend`) - Python/FastAPI
2. **Web** (`surfsense_web`) - Next.js 16
3. **Extension** (`surfsense_browser_extension`) - Plasmo/React
Xem chi tiết:
- [Kiến Trúc Backend](./architecture-backend.md)
- [Kiến Trúc Web](./architecture-web.md)
- [Kiến Trúc Extension](./architecture-extension.md)
- [Kiến Trúc Tích Hợp](./integration-architecture.md)
---
## 🚀 Setup Development Environment
### Prerequisites
- Python 3.11+
- Node.js 18+
- PostgreSQL 15+
- Redis
- Git
### Clone Repository
```bash
git clone https://github.com/your-org/surfsense.git
cd surfsense
```
### Backend Setup
```bash
cd surfsense_backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env với database credentials, API keys
# Run migrations
alembic upgrade head
# Start server
uvicorn app.main:app --reload
```
**Backend chạy tại:** `http://localhost:8000`
### Web Setup
```bash
cd surfsense_web
# Install dependencies
npm install
# Setup environment
cp .env.example .env.local
# Edit NEXT_PUBLIC_API_URL=http://localhost:8000
# Start dev server
npm run dev
```
**Web chạy tại:** `http://localhost:3000`
### Extension Setup
```bash
cd surfsense_browser_extension
# Install dependencies
npm install
# Build extension
npm run dev
# Load extension trong Chrome:
# 1. Vào chrome://extensions/
# 2. Enable "Developer mode"
# 3. Click "Load unpacked"
# 4. Chọn folder build/chrome-mv3-dev
```
---
## 🗂️ Cấu Trúc Dự Án
### Backend Structure
```
surfsense_backend/
├── app/
│ ├── api/ # API routes
│ ├── core/ # Core logic (auth, config)
│ ├── db/ # Database models
│ ├── services/ # Business logic
│ └── main.py # FastAPI app
├── alembic/ # Database migrations
├── tests/ # Unit tests
└── requirements.txt
```
### Web Structure
```
surfsense_web/
├── app/ # Next.js App Router
│ ├── (auth)/ # Auth pages
│ ├── (dashboard)/ # Dashboard pages
│ └── api/ # API routes
├── components/ # React components
├── lib/ # Utilities
└── public/ # Static assets
```
### Extension Structure
```
surfsense_browser_extension/
├── src/
│ ├── background/ # Background service
│ ├── popup/ # Popup UI
│ ├── content/ # Content scripts
│ └── components/ # Shared components
└── manifest.json # Extension manifest
```
---
## 🔌 API Reference
### Authentication
**Login:**
```bash
POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
# Response:
{
"access_token": "eyJ...",
"token_type": "bearer"
}
```
**Sử dụng token:**
```bash
GET /api/content
Authorization: Bearer eyJ...
```
### Content Management
**Capture content:**
```bash
POST /api/content
Authorization: Bearer <token>
Content-Type: application/json
{
"url": "https://example.com",
"title": "Example Page",
"body": "Content text...",
"tags": ["research", "ai"]
}
```
**Search:**
```bash
GET /api/search?q=machine+learning&limit=10
Authorization: Bearer <token>
```
### AI Chat
**Send message:**
```bash
POST /api/ai/chat
Authorization: Bearer <token>
Content-Type: application/json
{
"message": "Summarize my AI research",
"mode": "research" # "chat" | "research"
}
```
Xem chi tiết: [API Contracts](./api-contracts-backend.md)
---
## 🗄️ Database Schema
### Core Tables
**users:**
- `id` (UUID, PK)
- `email` (unique)
- `hashed_password`
- `role` (user | admin | superadmin)
- `plan` (free | pro | enterprise)
**content:**
- `id` (UUID, PK)
- `user_id` (FK → users)
- `url`, `title`, `body`
- `tags` (JSONB)
- `created_at`
**collections:**
- `id` (UUID, PK)
- `user_id` (FK → users)
- `name`, `description`
Xem chi tiết: [Data Models](./data-models-backend.md)
---
## 🧪 Testing
### Backend Tests
```bash
cd surfsense_backend
# Run all tests
pytest
# Run specific test
pytest tests/test_auth.py
# With coverage
pytest --cov=app tests/
```
### Web Tests
```bash
cd surfsense_web
# Run unit tests
npm test
# Run E2E tests
npm run test:e2e
```
### Extension Tests
```bash
cd surfsense_browser_extension
# Run tests
npm test
```
---
## 🔧 Common Development Tasks
### Tạo API Endpoint Mới
**1. Tạo route (`app/api/routes/example.py`):**
```python
from fastapi import APIRouter, Depends
from app.core.auth import get_current_user
router = APIRouter()
@router.get("/example")
async def get_example(user = Depends(get_current_user)):
return {"message": "Hello", "user_id": user.id}
```
**2. Register route (`app/api/__init__.py`):**
```python
from app.api.routes import example
api_router.include_router(example.router, prefix="/example", tags=["example"])
```
### Tạo Database Migration
```bash
cd surfsense_backend
# Auto-generate migration
alembic revision --autogenerate -m "Add new_column to users"
# Review migration file in alembic/versions/
# Apply migration
alembic upgrade head
```
### Thêm React Component Mới
**1. Tạo component (`components/MyComponent.tsx`):**
```tsx
export function MyComponent({ title }: { title: string }) {
return <div>{title}</div>
}
```
**2. Sử dụng:**
```tsx
import { MyComponent } from '@/components/MyComponent'
export default function Page() {
return <MyComponent title="Hello" />
}
```
---
## 🚢 Deployment
### Build Production
**Backend:**
```bash
cd surfsense_backend
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
```
**Web:**
```bash
cd surfsense_web
npm run build
npm start
```
**Extension:**
```bash
cd surfsense_browser_extension
npm run build
# Upload build/chrome-mv3-prod to Chrome Web Store
```
### Docker Deployment
```bash
docker-compose up -d
```
Xem chi tiết deployment trong [Admin Guide](./admin-guide.md).
---
## 🐛 Debugging
### Backend Debugging
**Enable debug logs:**
```bash
# .env
LOG_LEVEL=DEBUG
```
**Use debugger:**
```python
import pdb; pdb.set_trace()
```
### Web Debugging
**Next.js debug mode:**
```bash
NODE_OPTIONS='--inspect' npm run dev
```
**React DevTools:** Install extension
### Extension Debugging
1. Vào `chrome://extensions/`
2. Click **"Inspect views: background page"**
3. Sử dụng Chrome DevTools
---
## 📚 Tài Nguyên Bổ Sung
### Documentation
- [FastAPI Docs](https://fastapi.tiangolo.com/)
- [Next.js Docs](https://nextjs.org/docs)
- [Plasmo Docs](https://docs.plasmo.com/)
### Code Style
- Backend: PEP 8, Black formatter
- Web/Extension: ESLint, Prettier
### Git Workflow
- Branch naming: `feature/`, `bugfix/`, `hotfix/`
- Commit messages: Conventional Commits
- PR template: Mô tả changes, testing done
---
**Cập nhật:** 2026-01-31 | **Version:** 1.0

View file

@ -0,0 +1,473 @@
# DexScreener Connector - Implementation Plan
## 📋 Tổng Quan
Sau khi research kỹ [DexScreener API Documentation](https://docs.dexscreener.com/api/reference) và phân tích source code SurfSense, đây là phương án implementation chính xác nhất cho DexScreener Connector.
## 🔍 DexScreener API Research Findings
### Base Information
- **Base URL**: `https://api.dexscreener.com`
- **Authentication**: KHÔNG cần API key (public API)
- **Rate Limits**:
- Profile/Ads endpoints: 60 requests/minute
- Pair/Token endpoints: **300 requests/minute**
- **Max Results**: Search endpoint trả về tối đa 30 pairs
### Core Endpoints
#### 1. Search Pairs
```
GET /latest/dex/search?q={query}
Rate Limit: 300 req/min
Max Results: 30 pairs
```
**Use Case**: Tìm kiếm trading pairs theo token name, symbol, hoặc address
**Response Structure**:
```json
{
"schemaVersion": "1.0.0",
"pairs": [
{
"chainId": "solana",
"dexId": "raydium",
"url": "https://dexscreener.com/solana/...",
"pairAddress": "...",
"baseToken": {
"address": "...",
"name": "Token Name",
"symbol": "TKN"
},
"quoteToken": {
"address": "...",
"name": "USD Coin",
"symbol": "USDC"
},
"priceNative": "0.00123",
"priceUsd": "1.23",
"txns": {
"m5": { "buys": 10, "sells": 5 },
"h1": { "buys": 100, "sells": 50 },
"h6": { "buys": 500, "sells": 250 },
"h24": { "buys": 2000, "sells": 1000 }
},
"volume": {
"h24": 1000000,
"h6": 250000,
"h1": 50000,
"m5": 5000
},
"priceChange": {
"m5": 1.5,
"h1": 5.2,
"h6": 10.5,
"h24": 25.3
},
"liquidity": {
"usd": 500000,
"base": 1000000,
"quote": 500000
},
"fdv": 10000000,
"marketCap": 5000000,
"pairCreatedAt": 1640000000000
}
]
}
```
#### 2. Get Token Pairs
```
GET /latest/dex/tokens/{chainId}/{tokenAddress}
Rate Limit: 300 req/min
```
**Use Case**: Lấy tất cả pools/pairs của một token cụ thể
#### 3. Get Specific Pair
```
GET /latest/dex/pairs/{chainId}/{pairAddress}
Rate Limit: 300 req/min
```
**Use Case**: Lấy thông tin chi tiết của một pair cụ thể
#### 4. Get Multiple Tokens
```
GET /tokens/v1/{chainId}/{tokenAddresses}
Rate Limit: 300 req/min
Max: 30 addresses (comma-separated)
```
**Use Case**: Batch query nhiều tokens cùng lúc
## 🏗️ SurfSense Architecture Analysis
### Pattern Đã Xác Định
#### 1. Connector Class Pattern
**File**: `app/connectors/{name}_connector.py`
**Responsibilities**:
- Initialize với API credentials (nếu cần)
- Methods để fetch data từ external API
- Methods để format data sang markdown
- Error handling cho API calls
**Example từ LumaConnector**:
```python
class LumaConnector:
def __init__(self, api_key: str | None = None):
self.api_key = api_key
self.base_url = "https://api.lu.ma"
def make_request(self, endpoint: str, params: dict | None = None):
# Handle API calls with error handling
def get_events_by_date_range(self, start_date: str, end_date: str):
# Fetch data from API
def format_event_to_markdown(self, event: dict) -> str:
# Convert to markdown for indexing
```
#### 2. Indexer Pattern
**File**: `app/tasks/connector_indexers/{name}_indexer.py`
**Responsibilities**:
- Async function `index_{name}()`
- Get connector từ database
- Extract config (API keys, etc.)
- Initialize connector class
- Fetch data từ API
- Loop qua items:
- Generate `unique_identifier_hash` (để track duplicates)
- Generate `content_hash` (để detect content changes)
- Check existing documents
- Create/Update `Document` objects với:
- `chunks` (text chunks cho vector search)
- `embedding` (vector embedding)
- `metadata` (structured data)
- Batch commit to database
- Update `last_indexed_at` timestamp
**Key Functions Used**:
```python
from app.utils.document_converters import (
create_document_chunks,
generate_content_hash,
generate_document_summary,
generate_unique_identifier_hash,
)
```
#### 3. Routes Pattern
**File**: `app/routes/{name}_add_connector_route.py`
**Endpoints**:
- `POST /connectors/{name}/add` - Add/Update connector
- `DELETE /connectors/{name}` - Delete connector
- `GET /connectors/{name}/test` - Test connection
**Example từ luma_add_connector_route.py**:
```python
@router.post("/connectors/luma/add")
async def add_luma_connector(
request: AddLumaConnectorRequest,
user: User = Depends(current_active_user),
session: AsyncSession = Depends(get_async_session),
):
# Check existing connector
# Create or update SearchSourceConnector
# Store config in connector.config JSON field
```
#### 4. Database Schema
**File**: `app/db.py`
**SearchSourceConnectorType Enum**:
```python
class SearchSourceConnectorType(str, Enum):
LUMA_CONNECTOR = "LUMA_CONNECTOR"
SLACK_CONNECTOR = "SLACK_CONNECTOR"
# ... thêm DEXSCREENER_CONNECTOR
```
**SearchSourceConnector Model**:
```python
class SearchSourceConnector(Base):
id: int
name: str
connector_type: SearchSourceConnectorType
config: dict # JSON field để store API keys, settings
search_space_id: int
user_id: UUID
is_indexable: bool
last_indexed_at: datetime
```
#### 5. Celery Tasks
**File**: `app/tasks/celery_tasks/connector_tasks.py`
**Pattern**:
```python
@celery_app.task(name="index_luma_events", bind=True)
def index_luma_events_task(
self,
connector_id: int,
search_space_id: int,
user_id: str,
start_date: str | None = None,
end_date: str | None = None,
):
# Wrapper cho async indexer function
return asyncio.run(_index_luma_events(...))
```
#### 6. Periodic Scheduler
**File**: `app/utils/periodic_scheduler.py`
**Mapping**:
```python
CONNECTOR_TYPE_TO_TASK_NAME = {
SearchSourceConnectorType.LUMA_CONNECTOR: "index_luma_events",
# ... thêm mapping cho DexScreener
}
CONNECTOR_TYPE_TO_TASK = {
SearchSourceConnectorType.LUMA_CONNECTOR: index_luma_events_task,
# ... thêm task cho DexScreener
}
```
## 📝 Implementation Plan
### Phase 1: Core Components
#### 1.1. Database Schema Update
**File**: `app/db.py`
**Changes**:
```python
class SearchSourceConnectorType(str, Enum):
# ... existing types
DEXSCREENER_CONNECTOR = "DEXSCREENER_CONNECTOR"
class DocumentType(str, Enum):
# ... existing types
DEXSCREENER_CONNECTOR = "DEXSCREENER_CONNECTOR"
```
#### 1.2. Connector Class
**File**: `app/connectors/dexscreener_connector.py`
Xem full implementation trong artifacts.
#### 1.3. Indexer
**File**: `app/tasks/connector_indexers/dexscreener_indexer.py`
Xem full implementation trong artifacts.
### Phase 2: API Routes & Integration
#### 2.1. Routes
**File**: `app/routes/dexscreener_add_connector_route.py`
Xem full implementation trong artifacts.
#### 2.2. Celery Task
**File**: `app/tasks/celery_tasks/connector_tasks.py`
**Add to existing file**:
```python
# Add import
from app.tasks.connector_indexers import index_dexscreener_pairs
# Add task
@celery_app.task(name="index_dexscreener_pairs", bind=True)
def index_dexscreener_pairs_task(
self,
connector_id: int,
search_space_id: int,
user_id: str,
):
"""Celery task for indexing DexScreener pairs."""
try:
return asyncio.run(
_index_dexscreener_pairs(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
except Exception as e:
logger.error(f"DexScreener indexing task failed: {str(e)}", exc_info=True)
raise
async def _index_dexscreener_pairs(
connector_id: int,
search_space_id: int,
user_id: str,
):
"""Async wrapper for DexScreener indexing."""
async with get_async_session_context() as session:
return await index_dexscreener_pairs(
session=session,
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
```
#### 2.3. Periodic Scheduler
**File**: `app/utils/periodic_scheduler.py`
**Add to existing mappings**:
```python
# Add to CONNECTOR_TYPE_TO_TASK_NAME
CONNECTOR_TYPE_TO_TASK_NAME = {
# ... existing mappings
SearchSourceConnectorType.DEXSCREENER_CONNECTOR: "index_dexscreener_pairs",
}
# Add import
from app.tasks.celery_tasks.connector_tasks import index_dexscreener_pairs_task
# Add to CONNECTOR_TYPE_TO_TASK
CONNECTOR_TYPE_TO_TASK = {
# ... existing mappings
SearchSourceConnectorType.DEXSCREENER_CONNECTOR: index_dexscreener_pairs_task,
}
```
#### 2.4. Routes Registration
**File**: `app/routes/__init__.py`
**Add**:
```python
# Add import
from app.routes.dexscreener_add_connector_route import router as dexscreener_add_connector_router
# Add to router includes (after other connector routes)
router.include_router(dexscreener_add_connector_router)
```
#### 2.5. Indexer Export
**File**: `app/tasks/connector_indexers/__init__.py`
**Add**:
```python
# Add import
from .dexscreener_indexer import index_dexscreener_pairs
# Add to __all__
__all__ = [
# ... existing exports
"index_dexscreener_pairs",
]
```
## 🔄 Usage Flow
### 1. Add Connector via API
```bash
curl -X POST "http://localhost:8000/api/connectors/dexscreener/add" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"space_id": 1,
"tokens": [
{
"chain": "solana",
"address": "So11111111111111111111111111111111111111112",
"name": "Wrapped SOL"
},
{
"chain": "ethereum",
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "Wrapped ETH"
}
]
}'
```
### 2. Test Connection
```bash
curl -X GET "http://localhost:8000/api/connectors/dexscreener/test?chain=solana&token_address=So11111111111111111111111111111111111111112" \
-H "Authorization: Bearer YOUR_TOKEN"
```
### 3. Trigger Manual Indexing
Indexing sẽ được trigger tự động qua:
- **Periodic scheduler**: Mỗi 60 phút (configurable)
- **Manual trigger**: Qua search_source_connectors_routes.py endpoint
### 4. Search Indexed Data
Data được index sẽ tự động available trong:
- AI Chat với context từ DexScreener
- Search results
- Document retrieval
## ⚠️ Important Considerations
### Rate Limiting
- DexScreener API: 300 requests/minute
- Với 50 tokens tracked, mỗi lần index = 50 requests
- Recommended indexing interval: **60 minutes**
- Implement exponential backoff nếu hit rate limit
### Data Freshness
- Crypto market data thay đổi nhanh
- Consider shorter intervals (15-30 min) cho high-priority tokens
- Implement priority queue cho important tokens
### Storage Optimization
- Mỗi pair = 1 document với chunks
- 50 tokens × 5 pairs average = 250 documents
- Monitor storage usage và implement cleanup cho old data
### Error Handling
- Network failures: Retry với exponential backoff
- API errors: Log và skip, không block toàn bộ indexing
- Invalid data: Validate trước khi index
## 🎯 Next Steps
1. **Implement Phase 1**: Core components (connector, indexer, DB schema)
2. **Test locally**: Verify API calls và data formatting
3. **Implement Phase 2**: Routes và integration
4. **Test end-to-end**: Add connector → Index → Search
5. **Deploy**: Monitor performance và adjust intervals
6. **Optimize**: Based on usage patterns và feedback
## 📊 Success Metrics
- ✅ Connector successfully fetches data from DexScreener API
- ✅ Data được format chính xác sang markdown
- ✅ Documents được index với proper chunks và embeddings
- ✅ Search results include DexScreener data
- ✅ AI Chat có context từ crypto market data
- ✅ Periodic indexing runs without errors
- ✅ Rate limits được respect
---
**Note**: Implementation này dựa trên:
- Official DexScreener API Documentation
- Existing SurfSense connector patterns (Luma, Slack, etc.)
- Best practices từ production connectors

View file

@ -0,0 +1,229 @@
# Story 1.0: Hệ thống Xác thực (Authentication System)
Status: ready-for-dev
## Story
**Là một** SurfSense user,
**Tôi muốn** đăng nhập vào extension với tài khoản SurfSense của tôi,
**Để** extension có thể đồng bộ settings, lịch sử chat, và truy cập backend APIs.
## Acceptance Criteria
### AC 1.0.1: User Login Flow
- **Given** user chưa đăng nhập vào extension
- **When** user click nút "Login" trong side panel header
- **Then** Chrome Identity API popup mở ra với tùy chọn Google OAuth
- **And** user hoàn tất quy trình OAuth
- **Then** extension nhận JWT token từ backend
- **And** extension chuyển hướng về side panel
- **And** avatar/email của user hiển thị trong header
**Error Scenario:**
- **Given** user đang trong quy trình OAuth
- **When** OAuth thất bại (user hủy hoặc lỗi mạng)
- **Then** extension hiển thị error toast "Login failed. Please try again."
- **And** user vẫn ở trạng thái chưa xác thực
### AC 1.0.2: JWT Token Management
- **Given** backend trả về JWT token (hết hạn sau 24 giờ - theo config hiện tại)
- **When** extension nhận được token
- **Then** extension lưu encrypted JWT trong Plasmo Storage
- **And** thời gian hết hạn của token được lưu
**Auto-Refresh:**
- **Given** JWT token còn < 1 giờ hết hạn
- **When** extension kiểm tra token expiry (mỗi 30 phút)
- **Then** extension gọi API `/auth/jwt/refresh`
- **And** extension cập nhật token đã lưu
**Logout:**
- **Given** user click "Logout" trong settings dropdown
- **When** hành động logout được kích hoạt
- **Then** extension xóa JWT khỏi Plasmo Storage
- **And** user chuyển hướng về màn hình welcome/login
### AC 1.0.3: Authenticated API Requests
- **Given** user đã đăng nhập (JWT đã lưu)
- **When** extension thực hiện API request
- **Then** request bao gồm header `Authorization: Bearer {JWT}`
- **And** backend xác thực JWT
- **And** request thành công với status 200
**Expired Token:**
- **Given** JWT token đã hết hạn
- **When** extension thực hiện API request
- **Then** backend trả về lỗi 401 Unauthorized
- **And** extension cố gắng auto-refresh
- **And** nếu refresh thành công, thử lại request ban đầu
- **And** nếu refresh thất bại, chuyển hướng user đến trang login
### AC 1.0.4: Offline Handling
- **Given** user đã đăng nhập trước đó
- **And** user mất kết nối internet
- **When** extension cố gắng kết nối backend
- **Then** extension hiển thị chỉ báo "Offline" trong header
- **And** extension cache trạng thái auth gần nhất
## Tasks / Subtasks
- [ ] Task 1: Chrome Identity API Integration (AC: 1.0.1)
- [ ] 1.1 Tạo `lib/auth/chrome-identity.ts` - wrapper cho Chrome Identity API
- [ ] 1.2 Implement `launchWebAuthFlow` với backend OAuth URL
- [ ] 1.3 Handle OAuth callback và extract JWT từ redirect URL
- [ ] 1.4 Xử lý các error cases (user cancel, network error)
- [ ] Task 2: JWT Token Manager (AC: 1.0.2)
- [ ] 2.1 Tạo `lib/auth/jwt-manager.ts` - quản lý JWT storage
- [ ] 2.2 Implement token encryption/decryption với Plasmo Storage
- [ ] 2.3 Implement token expiry checking và auto-refresh logic
- [ ] 2.4 Implement logout và clear token
- [ ] Task 3: Authenticated API Client (AC: 1.0.3)
- [ ] 3.1 Tạo `lib/auth/api-client.ts` - HTTP client với auth headers
- [ ] 3.2 Implement request interceptor để inject Bearer token
- [ ] 3.3 Implement 401 response handler với auto-retry
- [ ] 3.4 Implement offline detection và caching
- [ ] Task 4: Auth UI Components (AC: 1.0.1, 1.0.4)
- [ ] 4.1 Tạo `sidepanel/auth/LoginButton.tsx` - nút đăng nhập
- [ ] 4.2 Tạo `sidepanel/auth/UserProfile.tsx` - hiển thị avatar/email
- [ ] 4.3 Tạo `sidepanel/auth/AuthProvider.tsx` - React context cho auth state
- [ ] 4.4 Update `sidepanel/chat/ChatHeader.tsx` để integrate auth UI
- [ ] Task 5: Integration Testing
- [ ] 5.1 Test OAuth flow end-to-end
- [ ] 5.2 Test token refresh mechanism
- [ ] 5.3 Test offline mode behavior
- [ ] 5.4 Test logout flow
## Dev Notes
### Backend Authentication (ALREADY EXISTS)
Backend đã có đầy đủ authentication system sử dụng `fastapi-users`:
**Existing Endpoints:**
```
POST /auth/jwt/login - Email/password login
POST /auth/jwt/logout - Logout
GET /auth/google/authorize - Google OAuth initiation
GET /auth/google/callback - Google OAuth callback
POST /auth/register - User registration
GET /verify-token - Verify JWT validity
GET /users/me - Get current user info
```
**JWT Configuration (từ `surfsense_backend/app/users.py`):**
- Secret: `config.SECRET_KEY`
- Lifetime: 24 giờ (`3600 * 24` seconds)
- Transport: Bearer token
- OAuth redirect: `{NEXT_FRONTEND_URL}/auth/callback?token={token}`
### Extension Architecture Pattern
**Plasmo Storage (đã có trong project):**
```typescript
import { Storage } from "@plasmohq/storage";
const storage = new Storage({ area: "local" });
```
**Chrome Identity API:**
```typescript
chrome.identity.launchWebAuthFlow({
url: `${BACKEND_URL}/auth/google/authorize`,
interactive: true,
}, (redirectUrl) => {
// Extract JWT from redirect URL
const url = new URL(redirectUrl);
const token = url.searchParams.get('token');
});
```
### Critical Implementation Details
**1. OAuth Flow cho Extension:**
- Backend hiện redirect về `{NEXT_FRONTEND_URL}/auth/callback?token={token}`
- Extension cần sử dụng Chrome Identity API với custom redirect
- Có thể cần thêm endpoint mới hoặc config cho extension redirect
**2. Token Storage Security:**
- KHÔNG lưu plaintext JWT
- Sử dụng encryption trước khi lưu vào Plasmo Storage
- Xem xét sử dụng `chrome.storage.session` cho sensitive data
**3. CORS Configuration:**
Backend đã có CORS cho localhost, cần thêm extension origin:
```python
# surfsense_backend/app/app.py - line 74-81
allowed_origins.extend([
"chrome-extension://*", # Cần thêm
])
```
### Project Structure Notes
**Files cần tạo mới:**
```
surfsense_browser_extension/
├── lib/
│ └── auth/
│ ├── chrome-identity.ts # Chrome Identity API wrapper
│ ├── jwt-manager.ts # JWT storage & refresh
│ └── api-client.ts # Authenticated HTTP client
└── sidepanel/
└── auth/
├── LoginButton.tsx # Login UI component
├── UserProfile.tsx # User avatar/menu
└── AuthProvider.tsx # Auth context provider
```
**Files cần modify:**
- `sidepanel/chat/ChatHeader.tsx` - Thêm auth UI
- `sidepanel/index.tsx` - Wrap với AuthProvider
- `background/index.ts` - Handle auth messages (nếu cần)
### Dependencies
**Existing (không cần cài thêm):**
- `@plasmohq/storage` - Đã có
- `react`, `react-dom` - Đã có
- `lucide-react` - Đã có (cho icons)
**Backend Dependencies (đã có):**
- `fastapi-users` - Authentication framework
- `httpx-oauth` - Google OAuth client
- `python-jose` - JWT handling
### Security Considerations
1. **KHÔNG** lưu API keys trong extension code
2. Mã hóa JWT trước khi lưu vào storage
3. Sử dụng HTTPS cho tất cả API calls
4. Validate JWT signature trên backend (đã có)
5. Implement CSRF protection cho OAuth flow
### References
- [Source: surfsense_backend/app/users.py] - JWT strategy, OAuth config
- [Source: surfsense_backend/app/app.py#L91-160] - Auth routes registration
- [Source: _bmad-epics/epic-1-ai-powered-crypto-assistant.md#Story-1.0] - Full requirements
- [Source: _bmad-output/architecture-extension.md] - Extension architecture
- [Source: _bmad-output/architecture-backend.md] - Backend auth flow
## Dev Agent Record
### Agent Model Used
{{agent_model_name_version}}
### Completion Notes List
- Story created: 2026-02-04
- Backend auth system already exists and is fully functional
- Extension needs new auth layer to integrate with existing backend
- P0 BLOCKER - This story blocks all sync features (Settings, Chat, Capture)
### Debug Log References
(To be filled during implementation)
### File List
(To be filled during implementation)

View file

@ -0,0 +1,328 @@
# Story 1.6: Đồng bộ Cài đặt (Settings Sync) với Frontend
Status: ready-for-dev
## Story
**Là một** SurfSense user,
**Tôi muốn** extension sử dụng cùng model và search space như web dashboard,
**Để** tôi không phải cấu hình lại.
## Dependencies
- **REQUIRES:** Story 1.0 (Authentication System) - Must be completed first
- Extension must have valid JWT token to call backend APIs
## Acceptance Criteria
### AC 1.6.1: Hiển thị Dropdown Cài đặt
- **Given** user đã đăng nhập
- **When** user click icon ⚙️ trong header
- **Then** settings dropdown mở ra
- **And** dropdown hiển thị:
- Current model: "GPT-4 Turbo" (chỉ xem, bị mờ)
- Current search space: "Crypto Research" (chỉ xem, bị mờ)
- Links đến web dashboard:
- "🔗 Manage Connectors"
- "💬 View All Chats"
- "⚙️ Full Settings"
- Nút "🚪 Logout"
### AC 1.6.2: Đồng bộ Cài đặt khi Đăng nhập
- **Given** user hoàn tất đăng nhập
- **When** nhận được JWT token
- **Then** extension gọi `GET /api/v1/searchspaces` để lấy danh sách search spaces
- **And** extension gọi `GET /api/v1/search-spaces/{id}/llm-preferences` để lấy LLM config
- **And** settings được lưu trong Plasmo Storage
- **And** settings hiển thị trong dropdown
**Response Format (từ backend):**
```json
// GET /api/v1/searchspaces
[
{
"id": 1,
"name": "Crypto Research",
"description": "...",
"agent_llm_id": 0,
"document_summary_llm_id": 0
}
]
// GET /api/v1/search-spaces/{id}/llm-preferences
{
"agent_llm_id": 0,
"document_summary_llm_id": 0,
"agent_llm": {
"id": 0,
"name": "Auto (Load Balanced)",
"provider": "AUTO",
"model_name": "auto"
}
}
```
### AC 1.6.3: Tự động cập nhật Cài đặt
- **Given** user thay đổi model trên web dashboard
- **When** extension phát hiện thay đổi (qua polling)
- **Then** extension lấy settings đã cập nhật
- **And** dropdown phản ánh model mới
- **And** các cuộc chat tiếp theo sử dụng model mới
**Polling:**
- **Given** extension đang hoạt động
- **When** mỗi 5 phút
- **Then** extension polls `GET /api/v1/searchspaces` và LLM preferences
### AC 1.6.4: Search Space Selector
- **Given** user có nhiều search spaces
- **When** user click vào search space selector trong header
- **Then** dropdown hiển thị tất cả search spaces của user
- **And** user có thể chọn search space khác
- **And** extension lưu selection vào Plasmo Storage
- **And** các API calls tiếp theo sử dụng search_space_id mới
### AC 1.6.5: Offline Handling
- **Given** user đã đăng nhập và có settings đã cache
- **When** user mất kết nối internet
- **Then** extension sử dụng settings đã cache
- **And** hiển thị indicator "Using cached settings"
- **When** kết nối được khôi phục
- **Then** extension sync settings mới từ backend
## Tasks / Subtasks
- [ ] Task 1: Settings Service (AC: 1.6.2, 1.6.3)
- [ ] 1.1 Tạo `lib/settings/settings-service.ts` - API calls cho settings
- [ ] 1.2 Implement `fetchSearchSpaces()` - GET /api/v1/searchspaces
- [ ] 1.3 Implement `fetchLLMPreferences(spaceId)` - GET LLM config
- [ ] 1.4 Implement polling mechanism (5 phút interval)
- [ ] 1.5 Implement settings caching trong Plasmo Storage
- [ ] Task 2: Settings State Management (AC: 1.6.1, 1.6.4)
- [ ] 2.1 Tạo `lib/settings/settings-store.ts` - Zustand/Context store
- [ ] 2.2 Define settings types và interfaces
- [ ] 2.3 Implement search space selection logic
- [ ] 2.4 Implement settings sync on login
- [ ] Task 3: Settings UI Components (AC: 1.6.1, 1.6.4)
- [ ] 3.1 Update `sidepanel/chat/ChatHeader.tsx` - Integrate real settings
- [ ] 3.2 Tạo `sidepanel/settings/SettingsDropdown.tsx` - Enhanced dropdown
- [ ] 3.3 Tạo `sidepanel/settings/SearchSpaceSelector.tsx` - Space picker
- [ ] 3.4 Tạo `sidepanel/settings/ModelDisplay.tsx` - Read-only model info
- [ ] Task 4: Integration với Auth (AC: 1.6.2, 1.6.5)
- [ ] 4.1 Hook settings fetch vào auth flow (sau login thành công)
- [ ] 4.2 Implement offline detection và fallback
- [ ] 4.3 Clear settings on logout
- [ ] 4.4 Handle 401 errors (redirect to login)
- [ ] Task 5: Testing
- [ ] 5.1 Test settings sync sau login
- [ ] 5.2 Test polling mechanism
- [ ] 5.3 Test search space switching
- [ ] 5.4 Test offline mode với cached settings
## Dev Notes
### Backend APIs (ALREADY EXISTS)
Backend đã có đầy đủ APIs cho settings:
**Search Spaces:**
```
GET /api/v1/searchspaces - List all user's search spaces
POST /api/v1/searchspaces - Create new search space
GET /api/v1/searchspaces/{id} - Get single search space
PUT /api/v1/searchspaces/{id} - Update search space
DELETE /api/v1/searchspaces/{id} - Delete search space
```
**LLM Preferences:**
```
GET /api/v1/search-spaces/{id}/llm-preferences - Get LLM config for space
PUT /api/v1/search-spaces/{id}/llm-preferences - Update LLM config
```
**Global LLM Configs:**
```
GET /api/v1/global-new-llm-configs - List available LLM models
```
### Existing Extension Code
**ChatHeader.tsx (đã có UI cơ bản):**
- Search space selector dropdown (hardcoded data)
- Settings dropdown với menu items
- User avatar với logout
- Token search bar
**Cần update:**
- Replace hardcoded search spaces với real data từ API
- Add model display trong settings dropdown
- Connect logout button với auth service
### Data Types
**SearchSpace (từ backend):**
```typescript
interface SearchSpace {
id: number;
name: string;
description?: string;
user_id: string;
agent_llm_id: number;
document_summary_llm_id: number;
created_at: string;
}
```
**LLMPreferences (từ backend):**
```typescript
interface LLMPreferences {
agent_llm_id: number;
document_summary_llm_id: number;
agent_llm?: LLMConfig;
document_summary_llm?: LLMConfig;
}
interface LLMConfig {
id: number;
name: string;
provider: string;
model_name: string;
is_global?: boolean;
is_auto_mode?: boolean;
}
```
### Project Structure Notes
**Files cần tạo mới:**
```
surfsense_browser_extension/
├── lib/
│ └── settings/
│ ├── settings-service.ts # API calls
│ ├── settings-store.ts # State management
│ └── types.ts # TypeScript interfaces
└── sidepanel/
└── settings/
├── SettingsDropdown.tsx # Enhanced dropdown
├── SearchSpaceSelector.tsx # Space picker
└── ModelDisplay.tsx # Read-only model info
```
**Files cần modify:**
- `sidepanel/chat/ChatHeader.tsx` - Integrate real settings data
- `sidepanel/index.tsx` - Add SettingsProvider
- `lib/auth/api-client.ts` - Add settings endpoints (từ Story 1.0)
### Implementation Pattern
**Settings Service:**
```typescript
// lib/settings/settings-service.ts
import { apiClient } from '../auth/api-client';
export const settingsService = {
async fetchSearchSpaces(): Promise<SearchSpace[]> {
return apiClient.get('/api/v1/searchspaces');
},
async fetchLLMPreferences(spaceId: number): Promise<LLMPreferences> {
return apiClient.get(`/api/v1/search-spaces/${spaceId}/llm-preferences`);
},
async fetchGlobalLLMConfigs(): Promise<LLMConfig[]> {
return apiClient.get('/api/v1/global-new-llm-configs');
}
};
```
**Settings Store (Plasmo Storage):**
```typescript
// lib/settings/settings-store.ts
import { Storage } from "@plasmohq/storage";
const storage = new Storage({ area: "local" });
export const settingsStore = {
async saveSearchSpaces(spaces: SearchSpace[]) {
await storage.set('searchSpaces', spaces);
},
async getSearchSpaces(): Promise<SearchSpace[] | null> {
return storage.get('searchSpaces');
},
async saveSelectedSpaceId(id: number) {
await storage.set('selectedSearchSpaceId', id);
},
async getSelectedSpaceId(): Promise<number | null> {
return storage.get('selectedSearchSpaceId');
}
};
```
### Polling Implementation
```typescript
// Polling every 5 minutes
const POLLING_INTERVAL = 5 * 60 * 1000; // 5 minutes
useEffect(() => {
const pollSettings = async () => {
try {
const spaces = await settingsService.fetchSearchSpaces();
await settingsStore.saveSearchSpaces(spaces);
const selectedId = await settingsStore.getSelectedSpaceId();
if (selectedId) {
const prefs = await settingsService.fetchLLMPreferences(selectedId);
await settingsStore.saveLLMPreferences(prefs);
}
} catch (error) {
console.error('Settings poll failed:', error);
}
};
const interval = setInterval(pollSettings, POLLING_INTERVAL);
return () => clearInterval(interval);
}, []);
```
### Security Considerations
1. Settings API calls require valid JWT (handled by api-client)
2. Cache settings locally for offline access
3. Clear cached settings on logout
4. Handle 401 errors gracefully (redirect to login)
### References
- [Source: surfsense_backend/app/routes/search_spaces_routes.py] - Search space APIs
- [Source: surfsense_backend/app/routes/new_llm_config_routes.py] - LLM config APIs
- [Source: surfsense_browser_extension/sidepanel/chat/ChatHeader.tsx] - Existing UI
- [Source: _bmad-epics/epic-1-ai-powered-crypto-assistant.md#Story-1.6] - Full requirements
- [Source: _bmad-output/implementation-artifacts/1-0-authentication-system.md] - Auth dependency
## Dev Agent Record
### Agent Model Used
{{agent_model_name_version}}
### Completion Notes List
- Story created: 2026-02-04
- Backend APIs already exist and are fully functional
- Extension UI partially exists (ChatHeader.tsx has basic structure)
- DEPENDS ON Story 1.0 (Authentication) - must complete auth first
- Settings are read-only in extension (changes made via web dashboard)
### Debug Log References
(To be filled during implementation)
### File List
(To be filled during implementation)

33
_bmad-output/index.md Normal file
View file

@ -0,0 +1,33 @@
# Mục Lục Tài Liệu Tổng Hợp (Master Index)
Chào mừng đến với tài liệu kỹ thuật của SurfSense. Đây là một nền tảng tìm kiếm và kiến thức AI đa thành phần.
## 🧭 Bắt Đầu
- **[Tổng Quan Dự Án](./project-overview.md)** - Tóm tắt cấp cao về hệ thống.
- **[Phân Tích Cây Mã Nguồn](./source-tree-analysis.md)** - Bản đồ các thư mục và tệp tin.
- **[Kiến Trúc Tích Hợp](./integration-architecture.md)** - Cách các thành phần giao tiếp với nhau.
## 📚 Hướng Dẫn Sử Dụng
- **[Hướng Dẫn Người Dùng](./user-guide.md)** - Cài đặt, sử dụng tính năng, troubleshooting.
- **[Hướng Dẫn Quản Trị](./admin-guide.md)** - Quản lý users, cấu hình hệ thống, monitoring.
- **[Hướng Dẫn Developer](./developer-guide.md)** - Setup môi trường, API reference, deployment.
## 🏗️ Tài Liệu Thành Phần
### 🐍 Backend (`surfsense_backend`)
Bộ não của hệ thống. Python/FastAPI microservice.
- **[Kiến Trúc](./architecture-backend.md)** - DeepAgents, LangGraph, và RAG.
- **[Hợp Đồng API](./api-contracts-backend.md)** - Các REST Endpoints và Auth.
- **[Mô Hình Dữ Liệu](./data-models-backend.md)** - Database Schema & Thực thể.
### 💻 Web Dashboard (`surfsense_web`)
Giao diện người dùng. Next.js 16 Web App.
- **[Kiến Trúc](./architecture-web.md)** - App Router, Server Actions, ElectricSQL.
- **[Inventory Component](./component-inventory-web.md)** - Phân tích thư viện UI.
### 🧩 Browser Extension (`surfsense_browser_extension`)
Bộ thu thập dữ liệu. Plasmo/React Extension.
- **[Kiến Trúc](./architecture-extension.md)** - Popup, Background Services, Manifest V3.
## 📊 Báo Cáo
- **[Báo Cáo Quét Dự Án](./project-scan-report.json)** - Dữ liệu quét dạng máy đọc (machine-readable).

View file

@ -0,0 +1,73 @@
# Kiến Trúc Tích Hợp
Tài liệu này phác thảo cách ba thành phần của SurfSense (Backend, Web, Extension) giao tiếp và chia sẻ dữ liệu.
## Sơ Đồ Hệ Thống
```mermaid
graph TD
User[User]
subgraph Client Layer
Web[Web Dashboard]
Ext[Browser Extension]
end
subgraph Service Layer
API[Backend API]
Worker[Celery Workers]
Redis[(Redis Queue)]
end
subgraph Data Layer
DB[(Postgres DB)]
Vector[(Vector Store)]
Sync[(ElectricSQL/Sync)]
end
subgraph External
LLM[LLM Providers]
Apps[External Apps]
end
User --> Web
User --> Ext
Web -- REST/Streaming --> API
Ext -- REST --> API
API -- Read/Write --> DB
API -- Vector Search --> Vector
API -- Jobs --> Redis
Redis -- Polls --> Worker
Worker -- Ingest --> Apps
Worker -- Inference --> LLM
API -- Inference --> LLM
Web -- Sync --> Sync
Sync -- Data --> DB
```
## Các Điểm Tích Hợp (Integration Points)
### 1. Web tới Backend
- **Giao thức**: HTTP/REST + Server-Sent Events (SSE) cho Streaming
- **Xác thực**: OAuth / Bearer Token
- **Trao đổi chính**:
- **Chat**: Web gửi prompts -> Backend stream tokens + tool updates.
- **Config**: Web gửi cài đặt connector -> Backend xác thực & lưu trữ.
- **Search**: Web yêu cầu tìm kiếm -> Backend chạy RAG pipeline -> Trả về kết quả.
### 2. Extension tới Backend
- **Giao thức**: HTTP/REST
- **Mục đích**: Data ingestion (Lịch sử, Ngữ cảnh)
- **Luồng (Flow)**: Extension thu thập hoạt động duyệt web -> Đóng gói dữ liệu (Batching) -> Đẩy (Push) tới các endpoint `/ingest` của Backend.
### 3. Đồng bộ Dữ liệu (ElectricSQL)
- **Thành phần**: Web <-> Database
- **Mục đích**: Đồng bộ trạng thái thời gian thực (Real-time state synchronization) cho các tính năng cộng tác (như trạng thái chat chia sẻ) hoặc giữ cho giao diện frontend (optimistic UI) đồng bộ mà không cần refetch thủ công.
### 4. Backend tới AI Connectors
- **Giao thức**: Các API khác nhau (Slack API, Notion API, v.v.)
- **Luồng (Flow)**: Celery Workers thực thi các tác vụ nền (background jobs) để crawl/tải dữ liệu từ ứng dụng được kết nối của người dùng -> Xử lý/Phân mảnh (Process/Chunk) -> Lưu vào Vector DB.

View file

@ -0,0 +1,36 @@
# Tổng Quan Dự Án SurfSense
## Tóm Tắt Điều Hành
SurfSense là một nền tảng tìm kiếm và quản lý kiến thức toàn diện được hỗ trợ bởi AI. Hệ thống bao gồm một Browser Extension chuyên dụng để thu thập dữ liệu, một Python Backend hiệu năng cao để xử lý AI và RAG (Retrieval-Augmented Generation), và một Web Dashboard hiện đại xây dựng trên Next.js để tương tác người dùng. Hệ thống tận dụng framework DeepAgents và LangGraph cho các quy trình agentic (agentic workflows) tiên tiến.
## Cấu Trúc Dự Án
Dự án được tổ chức dưới dạng kho lưu trữ đa phần (multi-part repository) chứa ba thành phần riêng biệt:
| Thành phần | Thư mục | Loại | Công nghệ chính |
|------------|---------|------|-----------------|
| **Backend** | `surfsense_backend/` | Microservice | Python, FastAPI, LangGraph, DeepAgents, Postgres, Redis |
| **Web Frontend** | `surfsense_web/` | Web App | Next.js 16, React 19, Tailwind v4, Drizzle ORM |
| **Browser Extension** | `surfsense_browser_extension/` | Extension | Plasmo, React 18, Tailwind |
## Loại Kiến Trúc
**Layered Microservice Architecture** (Kiến trúc Microservice phân lớp) kết hợp với **Distributed Client System** (Hệ thống Client phân tán).
- **Data Layer**: Postgres (Vector + Relational)
- **Service Layer**: Python FastAPI với khả năng Agentic
- **Client Layer**: Lai (Web Dashboard + Browser Extension)
## Tính Năng Chính
- **Deep Search**: Pipeline RAG nâng cao để tìm kiếm trên các ứng dụng kết nối (Slack, Notion, v.v.).
- **Agentic AI**: Sử dụng LangGraph/DeepAgents cho các tác vụ suy luận phức tạp, nhiều bước.
- **Data Connectors**: Thư viện kết nối đồ sộ (30+) cho các nền tảng bên ngoài.
- **Sync Engine**: Browser extension thu thập lịch sử/ngữ cảnh để cá nhân hóa tìm kiếm.
- **Local/Cloud Hybrid**: Hỗ trợ Local LLMs và các nhà cung cấp cloud thông qua LiteLLM.
## Điều Hướng Tài Liệu
- [Master Index](./index.md) - **Bắt đầu tại đây**
- [Phân Tích Cây Mã Nguồn](./source-tree-analysis.md)
- [Kiến Trúc Tích Hợp](./integration-architecture.md)
### Tài Liệu Thành Phần Chi Tiết
- **Backend**: [Kiến Trúc](./architecture-backend.md) | [Hợp Đồng API](./api-contracts-backend.md) | [Mô Hình Dữ Liệu](./data-models-backend.md)
- **Web**: [Kiến Trúc](./architecture-web.md) | [Inventory Component](./component-inventory-web.md)
- **Extension**: [Kiến Trúc](./architecture-extension.md)

View file

@ -0,0 +1,83 @@
{
"workflow_version": "1.2.0",
"timestamps": {
"started": "2026-01-31T12:46:00+07:00",
"completed": "2026-01-31T12:55:00+07:00"
},
"mode": "initial_scan",
"scan_level": "exhaustive",
"project_root": "/Users/mac_1/Documents/GitHub/SurfSense",
"output_folder": "/Users/mac_1/Documents/GitHub/SurfSense/_bmad-output",
"repository_type": "multi-part",
"parts_count": 3,
"project_parts": [
{
"part_id": "backend",
"root_path": "surfsense_backend",
"project_type_id": "backend",
"display_name": "SurfSense Backend",
"tech_stack": {
"framework": "FastAPI",
"language": "Python 3.12",
"database": "Postgres (asyncpg), Redis",
"key_libs": "LangGraph, DeepAgents, Alembic"
},
"architecture_pattern": "Service-centric / Microservice"
},
{
"part_id": "web",
"root_path": "surfsense_web",
"project_type_id": "web_app",
"display_name": "SurfSense Web",
"tech_stack": {
"framework": "Next.js 16",
"language": "TypeScript",
"ui": "React 19, Tailwind v4",
"state": "ElectricSQL"
},
"architecture_pattern": "App Router / Server Actions"
},
{
"part_id": "extension",
"root_path": "surfsense_browser_extension",
"project_type_id": "browser_extension",
"display_name": "SurfSense Extension",
"tech_stack": {
"framework": "Plasmo",
"language": "TypeScript",
"ui": "React 18"
},
"architecture_pattern": "Manifest V3 / Popup + Background"
}
],
"completed_steps": [
"step_1_init",
"step_2_classify",
"step_3_tech_stack",
"step_4_analysis",
"step_5_backend_docs",
"step_6_web_docs",
"step_7_extension_docs",
"step_10_master_index"
],
"current_step": "complete",
"findings": {
"project_classification": "Multi-part project with Backend (Python/FastAPI), Extension (Plasmo/React), and Web (Next.js/React).",
"technology_stack": "Comprehensive stack detected. High complexity in AI/Agentic workflows.",
"documentation_status": "Generated comprehensive documentation suite."
},
"outputs_generated": [
"project-scan-report.json",
"project-overview.md",
"source-tree-analysis.md",
"integration-architecture.md",
"architecture-backend.md",
"data-models-backend.md",
"api-contracts-backend.md",
"architecture-web.md",
"component-inventory-web.md",
"architecture-extension.md",
"index.md"
],
"resume_instructions": "Documentation complete. User can review files in _bmad-output/."
}

View file

@ -0,0 +1,74 @@
# Phân Tích Cây Mã Nguồn
Tài liệu này ánh xạ các thư mục và tệp tin quan trọng trong dự án đa phần (multi-part) SurfSense.
## Sơ Đồ Thư Mục
```
/Users/mac_1/Documents/GitHub/SurfSense/
├── docs/ # Tài liệu cấp dự án
│ └── chinese-llm-setup.md # Hướng dẫn cài đặt chuyên biệt
├── docker-compose.yml # File điều phối chính
├── .env.example # Mẫu biến môi trường toàn cục (Global environment)
├── surfsense_backend/ # [PART: Backend]
│ ├── app/
│ │ ├── api/ # Các tiện ích API
│ │ ├── config/ # Cấu hình & Cài đặt
│ │ ├── connectors/ # Connectors ứng dụng ngoài (Slack, Jira...)
│ │ ├── prompts/ # System Prompts cho Agents
│ │ ├── retriever/ # Logic RAG & Search
│ │ ├── routes/ # API Route Controllers (Endpoints)
│ │ ├── schemas/ # Pydantic Data Models
│ │ ├── services/ # Business Logic Services
│ │ ├── tasks/ # Celery Background Tasks
│ │ ├── app.py # Điểm nhập (Entry Point) của FastAPI
│ │ ├── celery_app.py # Điểm nhập của Worker
│ │ └── db.py # Database ORM (SQLAlchemy) & Models
│ ├── alembic/ # Database Migrations
│ ├── pyproject.toml # Dependencies (kiểu uv/poetry)
│ └── Dockerfile # Cấu hình container Backend
├── surfsense_web/ # [PART: Web]
│ ├── app/ # Next.js App Router (Pages & API)
│ │ ├── (home)/ # Marketing/Landing Pages
│ │ ├── dashboard/ # Ứng dụng người dùng (đã xác thực)
│ │ ├── api/ # Next.js API Routes (BFF/Proxy)
│ │ └── docs/ # Documentation Routes
│ ├── components/ # React Components
│ │ ├── ui/ # Base UI Kit (giống Shadcn)
│ │ ├── layout/ # Components cấu trúc (Structural)
│ │ └── assistant-ui/ # Components giao diện Chat/AI
│ ├── lib/ # Utilities & Logic chia sẻ
│ │ ├── apis/ # Client-side API Wrappers
│ │ └── electric/ # Cấu hình ElectricSQL Sync
│ ├── content/ # Nội dung MDX (Docs)
│ ├── contracts/ # Shared Types/Contracts
│ ├── public/ # Static Assets
│ ├── package.json # Dependencies (pnpm)
│ └── next.config.ts # Cấu hình Next.js
└── surfsense_browser_extension/ # [PART: Extension]
├── background/ # Service Workers
│ └── index.ts # Điểm nhập Background
├── routes/ # Extension UI Routes
├── assets/ # Icons & Static Files
├── popup.tsx # Điểm nhập Popup (React)
├── manifest.json # Extension Manifest (tạo bởi Plasmo)
└── package.json # Dependencies
```
## Phân Tích Các Thư Mục Quan Trọng
### Backend (`surfsense_backend`)
- **`app/routes/`**: Chứa tất cả REST API endpoints. Mỗi file thường tương ứng với một miền tính năng (ví dụ: `discord_add_connector_route.py`).
- **`app/connectors/`**: Logic tích hợp cốt lõi cho hơn 30 dịch vụ bên ngoài. Đây là nơi quá trình data ingestion diễn ra.
- **`app/db.py`**: Hệ thống thần kinh trung ương để lưu trữ dữ liệu. Định nghĩa tất cả các SQLAlchemy models và kết nối database.
### Web (`surfsense_web`)
- **`app/dashboard/`**: Giao diện ứng dụng chính mà người dùng tương tác. Được bảo vệ bởi xác thực (auth).
- **`components/assistant-ui/`**: Các components chuyên biệt cho giao diện AI chat, xử lý streaming, tool calls, và lịch sử tin nhắn.
- **`lib/apis/`**: Lớp client được định kiểu (typed client layer) giao tiếp với Backend.
### Extension (`surfsense_browser_extension`)
- **`background/`**: Xử lý logic bền vững (persistent logic) như thu thập lịch sử và giám sát tab ngay cả khi popup đã đóng.

View file

@ -0,0 +1,565 @@
# Business Model Analysis - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Step 3
**Focus:** Revenue Model, Cost Structure, Unit Economics, Defensibility
---
## 💰 REVENUE MODEL DESIGN
### Freemium SaaS Model (Recommended)
**Tier Structure:**
#### **FREE TIER** (Lead Generation)
**Target:** Casual traders, tire-kickers
**Features:**
- Basic token monitoring (5 tokens max)
- Historical price charts (7 days)
- Community alerts (delayed 15 min)
- Basic AI queries (10/day limit)
**Purpose:**
- User acquisition (low CAC)
- Product validation
- Conversion funnel top
- Viral growth potential
**Conversion Target:** 2-5% to paid tiers
- Industry benchmark: 2-5% (general SaaS)
- Crypto tools: likely higher (3-7%) due to high intent
---
#### **PRO TIER** ($49/month or $470/year)
**Target:** Active traders (primary revenue driver)
**Features:**
- Unlimited token monitoring
- Real-time alerts (instant)
- AI-powered pattern recognition
- Smart alerts (ML-based)
- Historical data (30 days)
- Portfolio tracking
- Natural language queries (unlimited)
- Email/Telegram notifications
**Value Proposition:**
- "AI co-pilot pays for itself with ONE good trade"
- Time savings: 10+ hours/week research
- Risk reduction: Rug pull detection
- Opportunity discovery: Whale tracking
**Pricing Rationale:**
- Below DexTools Standard ($100/month)
- Above "free" (perceived value)
- Affordable for serious traders
- Annual discount (20%) encourages commitment
**Expected ARPU:** $50-60/month (including annual subscribers)
---
#### **PREMIUM TIER** ($199/month or $1,990/year)
**Target:** Professional traders, power users
**Features:**
- Everything in Pro
- Advanced AI predictions (price targets, trend forecasting)
- Custom alert rules (complex conditions)
- API access (programmatic integration)
- Historical data (unlimited)
- Priority support
- Multi-portfolio tracking
- Advanced analytics dashboard
- Whale wallet tracking
- Arbitrage opportunity detection
**Value Proposition:**
- "Professional intelligence for professional traders"
- Competitive edge through AI predictions
- Automation via API
- Institutional-grade analytics
**Pricing Rationale:**
- Competitive with DexTools Premium (token-gated)
- Targets top 10% of users (high LTV)
- Justifiable for traders with $50K+ portfolios
**Expected ARPU:** $180-220/month (including annual subscribers)
---
### Revenue Projections
#### **Year 1 (Accelerated Launch)**
- **Week 1:** **Launch Beta** (Free/Pro) - "Smart Assistant" MVP.
- **Month 1:** First 10 paying users (Organic).
- **Month 3:** 100 paying users.
- **Year End Target:** 500-1,000 paying users.
- **Projected ARR:** $60K-300K (Valid).
**Mix:**
- Pro (80%): $4K-20K MRR
- Premium (20%): $1K-5K MRR
#### **Year 2 (Moderate)**
- Free users: 10,000-25,000
- Pro users: 800-4,000
- Premium users: 200-1,000
- **MRR:** $50K-250K
- **ARR:** $600K-3M
**Mix:**
- Pro (75%): $37.5K-187.5K MRR
- Premium (25%): $12.5K-62.5K MRR
#### **Year 3+ (Aggressive)**
- Free users: 50,000-100,000
- Pro users: 8,000-15,000
- Premium users: 2,000-5,000
- **MRR:** $500K-1M+
- **ARR:** $6M-12M+
**Mix:**
- Pro (70%): $350K-700K MRR
- Premium (30%): $150K-300K MRR
---
## 💸 COST STRUCTURE
### Fixed Costs (Monthly)
#### **Infrastructure**
- **Hosting:** $200-500/month
- Backend API (FastAPI): $100-200
- Frontend (Next.js): $50-100
- Database (Supabase/PostgreSQL): $50-200
- **AI/ML Services:** $300-800/month
- OpenAI API (embeddings, GPT-4): $200-500
- Vector database (Pinecone/Weaviate): $100-300
- **Monitoring/Analytics:** $50-100/month
- Sentry, Datadog, Mixpanel
**Total Infrastructure:** $550-1,400/month
#### **Data/API Costs**
- **DexScreener:** $0 (Free API is sufficient for initial launch).
- **DefiLlama:** $0 (Free API).
- **QuickNode RPC:** $300-1,000/month (premium tier)
- Alternative: Self-host with RPC ($500-800/month)
**Total Data Costs:** $300-1,000/month
#### **Tools/Software**
- **Development:** $50-100/month
- GitHub, Vercel, monitoring tools
- **Marketing:** $100-500/month
- Email (Mailgun), analytics, SEO tools
**Total Tools:** $150-600/month
#### **Total Fixed Costs:** $1,000-3,000/month
---
### Variable Costs (Per User)
#### **AI/ML Costs**
- **Embeddings:** $0.01-0.05/user/month
- Document indexing, semantic search
- **LLM Queries:** $0.50-2.00/user/month
- GPT-4 for AI predictions, natural language queries
- Depends on usage (10-100 queries/month)
**Total AI Cost:** $0.50-2.00/user/month
#### **Data/API Costs**
- **QuickNode RPC:** $0.10-0.50/user/month
- Real-time blockchain data
- Scales with active users
- **DexScreener Premium:** $0.05-0.20/user/month
- If using premium tier
**Total Data Cost:** $0.15-0.70/user/month
#### **Total Variable Cost:** $0.65-2.70/user/month
**Margin Analysis:**
- **Pro Tier ($49/month):**
- Cost: $0.65-2.70
- Margin: $46.30-48.35 (94-99%)
- **Premium Tier ($199/month):**
- Cost: $1.50-5.00 (higher usage)
- Margin: $194-197.50 (97-99%)
**Gross Margin: 94-99%** (typical SaaS)
---
## 📈 UNIT ECONOMICS
### Customer Acquisition Cost (CAC)
**Channels:**
1. **Organic (Content Marketing):** $5-20/user
- Twitter threads, blog posts, YouTube tutorials
- Low cost, high quality users
2. **Paid Ads (Twitter, Google):** $50-150/user
- Targeted crypto trader audiences
- Higher cost, faster scale
3. **Referrals/Viral:** $2-10/user
- Referral program (1 month free for referrer)
- Lowest cost, best retention
**Blended CAC Target:** $20-50/user (Year 1)
- Heavy organic focus (solo founder constraint)
- Paid ads only after PMF validation
**CAC Payback Period:**
- Pro user: 1-2 months ($49/month, $20-50 CAC)
- Premium user: <1 month ($199/month, $20-50 CAC)
---
### Lifetime Value (LTV)
**Churn Rate Assumptions:**
- **Year 1:** 25-30% annual churn (high, early product)
- **Year 2:** 15-20% annual churn (improving PMF)
- **Year 3+:** 10-15% annual churn (mature product)
**Average Customer Lifetime:**
- Year 1: 3-4 years (30% churn)
- Year 2: 5-7 years (20% churn)
- Year 3+: 7-10 years (15% churn)
**LTV Calculation (Year 2 steady state):**
**Pro Tier:**
- ARPU: $50/month
- Lifetime: 5 years (60 months)
- Churn: 20% annual
- **LTV:** $50 × 60 × (1 - 0.20) = **$2,400**
**Premium Tier:**
- ARPU: $200/month
- Lifetime: 6 years (72 months)
- Churn: 15% annual (lower, higher commitment)
- **LTV:** $200 × 72 × (1 - 0.15) = **$12,240**
**Blended LTV (75% Pro, 25% Premium):**
- $2,400 × 0.75 + $12,240 × 0.25 = **$4,860**
---
### LTV:CAC Ratio
**Target:** 3:1 minimum (healthy SaaS)
**Year 1:**
- LTV: $2,000-3,000 (high churn)
- CAC: $20-50
- **Ratio: 40:1 to 150:1** ✅ (EXCELLENT)
**Year 2:**
- LTV: $4,000-5,000
- CAC: $30-60 (more paid ads)
- **Ratio: 67:1 to 167:1** ✅ (EXCELLENT)
**Interpretation:**
- Solo founder advantage: LOW CAC (organic focus)
- High-margin SaaS: HIGH LTV
- Ratio is EXCEPTIONAL (10x+ better than 3:1 target)
- Can afford to invest in paid acquisition
---
### Break-Even Analysis
**Monthly Fixed Costs:** $1,000-3,000
**Break-Even Users (Pro Tier @ $49/month):**
- Low end: $1,000 / $49 = **21 users**
- High end: $3,000 / $49 = **62 users**
**Break-Even Timeline:**
**Break-Even Timeline:**
- **Month 2:** 20-30 users (Beta conversion).
- **Break-even: Month 2-3** ✅ (Immediate due to low OPEX).
**Profitability Timeline:**
- Month 12: 100-500 users = $5K-25K MRR
- Costs: $2K-4K/month
- **Profit: $1K-23K/month**
---
## 🛡️ DEFENSIBILITY ANALYSIS
### Moat Assessment
#### 1. **AI/ML Moat** (STRONG) ✅
**Defensibility:**
- Proprietary AI models trained on crypto patterns
- Prediction accuracy improves with data (network effect)
- Pattern recognition library (rug pulls, whale behavior)
- Difficult to replicate without historical data
**Sustainability:**
- 6-12 month lead time (before incumbents catch up)
- Continuous improvement (more data = better models)
- Requires ML expertise (barrier for competitors)
**Risk:**
- OpenAI/GPT-4 is commoditized (anyone can use)
- Must build proprietary models on top
- Data moat more important than model moat
---
#### 2. **Data Moat** (MEDIUM) ⚠️
**Defensibility:**
- Historical pattern library (rug pulls, pumps, dumps)
- User behavior data (what traders care about)
- Proprietary alert triggers (ML-learned)
**Weakness:**
- Raw data is PUBLIC (DexScreener, DefiLlama)
- Competitors can access same sources
- No exclusive data partnerships
**Mitigation:**
- Build proprietary pattern library
- User feedback loop (what predictions work)
- Community-contributed insights
---
#### 3. **Brand Moat** (WEAK → STRONG) ⚠️→✅
**Current State (WEAK):**
- New brand (no recognition)
- No existing customer base
- Competing with established players
**Future State (STRONG):**
- "The AI co-pilot for crypto traders"
- Trusted predictions (accuracy track record)
- Community advocacy (referrals)
- Thought leadership (content marketing)
**Timeline:** 12-24 months to build brand
---
#### 4. **Network Effects** (WEAK) ⚠️
**Limited Network Effects:**
- Not a marketplace (no buyer-seller dynamics)
- Not a social network (no user-to-user value)
- Individual tool (value doesn't increase with users)
**Potential Network Effects:**
- Community insights (user-contributed patterns)
- Shared alert triggers (what works for others)
- Referral program (viral growth)
**Verdict:** Network effects are WEAK (not a core moat)
---
#### 5. **Switching Costs** (MEDIUM) ⚠️
**Switching Barriers:**
- Portfolio history (sunk data)
- Custom alert rules (configuration effort)
- Learned interface (familiarity)
- Historical predictions (track record)
**Weakness:**
- Easy to export data (no lock-in)
- Competitors can import data
- Low technical switching cost
**Mitigation:**
- Build sticky features (portfolio tracking)
- Personalized AI (learns user preferences)
- Integration with trading workflows
---
### Overall Defensibility: **MEDIUM** ⚠️
**Strengths:**
- ✅ AI/ML moat (6-12 month lead)
- ✅ High-margin SaaS (profitable)
- ✅ Low CAC (organic growth)
**Weaknesses:**
- ❌ Weak network effects
- ❌ Public data (no exclusive sources)
- ❌ Easy to copy features
**Strategic Imperative:**
> Build AI moat FAST (6-12 months). Focus on prediction accuracy and proprietary pattern library. Brand and community will follow.
---
## 🎯 BUSINESS MODEL SCORECARD
| Metric | Target | Crypto Co-Pilot | Score |
|--------|--------|-----------------|-------|
| **Gross Margin** | >70% | 94-99% | ✅ 10/10 |
| **LTV:CAC Ratio** | >3:1 | 40:1 to 150:1 | ✅ 10/10 |
| **CAC Payback** | <12 months | 1-2 months | 10/10 |
| **Churn Rate** | <20% annual | 15-25% annual | 7/10 |
| **Break-Even** | <12 months | 4-7 months | 10/10 |
| **Defensibility** | Strong moat | Medium moat | ⚠️ 6/10 |
| **Scalability** | Solo → Team | Solo only | ⚠️ 5/10 |
| **Market Size** | $100M+ TAM | $500M-800M SAM | ✅ 9/10 |
| **TOTAL** | | | **✅ 8.4/10** |
**Interpretation:** **STRONG BUSINESS MODEL**
Excellent unit economics, fast break-even, high margins. Main risks: defensibility and solo scaling.
---
## 💡 STRATEGIC RECOMMENDATIONS
### 1. **Pricing Strategy**
**Recommendation:** Freemium with $49 Pro / $199 Premium
**Rationale:**
- Below DexTools ($100/month) = competitive
- Above "free" = perceived value
- Affordable for active traders
- Premium tier captures power users (high LTV)
**Tactics:**
- Annual discount (20%) to reduce churn
- Referral credits (1 month free)
- Early adopter lifetime discount (lock in evangelists)
---
### 2. **Cost Optimization**
**Recommendation:** Aggressive cost control in Year 1
**Tactics:**
- Use free tiers during development (DexScreener, DefiLlama)
- Self-host QuickNode RPC if costs exceed $1K/month
- Optimize AI queries (caching, batch processing)
- Serverless architecture (pay per use)
**Target:** Keep fixed costs <$2K/month in Year 1
---
### 3. **CAC Strategy**
**Recommendation:** Organic-first, paid later
**Year 1 (Organic Focus):**
- Twitter threads (crypto trading tips)
- YouTube tutorials (how to use AI co-pilot)
- Blog posts (crypto intelligence insights)
- Community engagement (Discord, Telegram)
- **Target CAC:** $10-30/user
**Year 2 (Paid Ads):**
- Twitter ads (targeted crypto traders)
- Google ads (crypto trading tools)
- Influencer partnerships (crypto YouTubers)
- **Target CAC:** $30-60/user
---
### 4. **Churn Reduction**
**Recommendation:** Build sticky features
**Tactics:**
- Portfolio tracking (historical data)
- Custom alert rules (configuration effort)
- Prediction track record (accuracy validation)
- Community insights (shared patterns)
- Email engagement (weekly insights)
**Target:** Reduce churn from 25% → 15% by Year 2
---
### 5. **Defensibility Strategy**
**Recommendation:** Build AI moat FAST
**6-Month Plan:**
- Build proprietary pattern library (rug pulls, pumps)
- Train ML models on historical data
- Validate prediction accuracy (track record)
- Publish accuracy metrics (transparency)
- Build community (user-contributed insights)
**12-Month Plan:**
- Establish brand as "AI crypto intelligence leader"
- Thought leadership (blog, Twitter, YouTube)
- Case studies (successful predictions)
- Partnerships (crypto influencers, exchanges)
---
## ⚠️ CRITICAL RISKS
### 1. **Solo Founder Scaling Challenge** ⚠️
**Risk:** One person cannot serve 1K+ users
**Mitigation:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- Prioritize product over support (Year 1)
- Hire support (Year 2, after $50K MRR)
### 2. **Market Timing Risk** ⚠️
**Risk:** Bear market kills demand
**Mitigation:**
- Build sticky features (survive bear market)
- Freemium model (low churn)
- Focus on serious traders (less price-sensitive)
- Diversify revenue (API access, white-label)
### 3. **Competitive Risk** ⚠️
**Risk:** Incumbents add AI features
**Mitigation:**
- Move FAST (6-12 month window)
- Build proprietary models (not just GPT-4)
- Focus on accuracy (not just features)
- Brand as "AI-first" (not "data + AI")
---
## 🚀 NEXT STEPS
**Step 4:** Disruption Opportunities Analysis
- Jobs-to-be-done framework
- Blue ocean strategy
- Platform potential
- Strategic options development
---
**BUSINESS MODEL VERDICT:** ✅ **STRONG - PROCEED**
Excellent unit economics, fast break-even, high margins. Main risks are defensibility and solo scaling, but mitigable with aggressive AI moat building and automation.

View file

@ -0,0 +1,504 @@
# Market Landscape Analysis - Crypto Intelligence Platforms
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Step 2
**Frameworks Used:** TAM/SAM/SOM, Five Forces, Competitive Positioning, Market Timing
---
## 📊 MARKET SIZING (TAM/SAM/SOM)
### Total Addressable Market (TAM)
**Crypto Trading Platforms Market: $38.5B (2026)**[^1]
**Context:**
- Grew from $33.48B (2025) → $38.5B (2026)
- **Growth Rate: 15% YoY**
- Includes exchange software, trading interfaces, analytics tools
- Broader crypto market: $7.08B in software/tools segment
**TAM Interpretation for Crypto Intelligence:**
- Trading platforms ($38.5B) is the TOTAL market
- Intelligence/analytics tools are a SUBSET
- Estimate: **10-15% of trading platform market = $3.8B-5.8B TAM**
- Rationale: Tools like DexTools, Birdeye are premium add-ons to trading
### Serviceable Addressable Market (SAM)
**DEX-Focused Intelligence Tools: ~$500M-800M (estimated)**
**Segmentation:**
- **Geographic:** Global, but concentrated in:
- North America: ~33% of crypto market
- Asia Pacific: ~31% of crypto market
- Europe: ~25% of crypto market
- **Platform Focus:** DEX vs CEX
- DEX trading growing faster (DeFi boom)
- Our focus: DEX intelligence (DexScreener, DefiLlama data)
- SAM = DEX-focused traders only
- **User Segment:** Active traders (not HODLers)
- Estimate: 20-30% of crypto users are active traders
- Active traders more likely to pay for intelligence tools
**SAM Calculation:**
- Total crypto intelligence TAM: $3.8B-5.8B
- DEX-focused subset: ~15-20% = $570M-1.16B
- Conservative SAM estimate: **$500M-800M**
### Serviceable Obtainable Market (SOM)
**Realistic 3-Year Target: $5M-50M (0.6%-6% of SAM)**
**Year 1 (Conservative):**
- 100-500 paying users @ $49-199/month
- MRR: $5K-25K
- ARR: **$60K-300K**
- Market share: 0.008%-0.04% of SAM
**Year 2 (Moderate):**
- 1K-5K paying users @ $49-199/month
- MRR: $50K-250K
- ARR: **$600K-3M**
- Market share: 0.08%-0.4% of SAM
**Year 3+ (Aggressive):**
- 10K+ paying users @ $49-199/month
- MRR: $500K+
- ARR: **$6M+**
- Market share: 0.75%-1.2% of SAM
**SOM Assumptions:**
- Freemium conversion rate: 2-5%
- Average revenue per user (ARPU): $60-120/month
- Churn rate: 15-25% annually
- Market share achievable as solo founder: 0.5-1% realistic
---
## 🏆 COMPETITIVE LANDSCAPE
### Major Players
#### 1. **DexTools** (Market Leader)
**Positioning:** Premium DEX analytics platform
**Features:**
- Real-time analytics across 100+ blockchains
- Monitors 7M+ liquidity pools, 13M+ tokens
- Aggregates data from 15,000+ DEXs
- DEXTScore reliability ratings
- Honeypot detection, liquidity lock verification
- Whale tracking (Big Swap Explorer)
**Pricing:**
- **Free:** Unlimited token monitoring, charts, volume analysis
- **Standard:** $100/month (paid in DEXT tokens)
- **Premium:** Requires holding 100,000 DEXT tokens
- Portfolio tracking
- Automated trading tools
- Advanced alerts
- Proprietary trading signals
**Business Model:**
- Freemium + token-gated premium
- Deflationary token economics (100% fees → buyback & burn)
- Recent burn: 8M tokens ($3.87M value)
**Strengths:**
- ✅ Comprehensive data coverage (100+ chains)
- ✅ Advanced security scanning (honeypot detection)
- ✅ Established brand (market leader)
- ✅ Token economics creates loyalty
**Weaknesses:**
- ❌ Premium pricing barrier ($100/month or 100K token hold)
- ❌ Token requirement creates friction
- ❌ No AI-powered predictions (data aggregation only)
- ❌ Complex UI (steep learning curve)
**Estimated Market Share:** 30-40% of DEX intelligence market
---
#### 2. **DEX Screener** (Free Alternative)
**Positioning:** Free, ad-supported DEX analytics
**Features:**
- Real-time DEX data
- Token pair monitoring
- Price charts, volume analysis
- No paywalls, no subscriptions
**Pricing:**
- **100% Free**
- Monetization: Ads + promoted token listings ("Dexcreeners")
**Strengths:**
- ✅ Completely free (no barriers)
- ✅ Simple, clean UI
- ✅ Fast adoption (no signup required)
**Weaknesses:**
- ❌ Limited advanced features
- ❌ Slower data refresh vs paid tools
- ❌ Ad-supported (promoted listings)
- ❌ No AI intelligence
**Estimated Market Share:** 40-50% of DEX intelligence users (but low revenue)
---
#### 3. **Birdeye** (Multi-Chain Focus)
**Positioning:** Multi-chain analytics + trading
**Features:** (Limited data available)
- Multi-chain support
- Good UX
- Trading integration
**Pricing:** Premium pricing (expensive)
**Strengths:**
- ✅ Multi-chain coverage
- ✅ Good UX/UI
**Weaknesses:**
- ❌ Expensive
- ❌ No AI predictions
**Estimated Market Share:** 10-15%
---
#### 4. **Dex Guru** (Analytics Focus)
**Positioning:** Advanced analytics for technical traders
**Strengths:**
- ✅ Deep analytics
- ✅ Technical trader focus
**Weaknesses:**
- ❌ No alerts
- ❌ Technical/complex
- ❌ Limited accessibility
**Estimated Market Share:** 5-10%
---
#### 5. **CoinGecko** (Broad Coverage)
**Positioning:** Broad crypto data aggregator
**Strengths:**
- ✅ Massive coverage (all coins)
- ✅ Established brand
**Weaknesses:**
- ❌ Not DEX-focused
- ❌ Limited real-time DEX data
- ❌ No trading intelligence
**Estimated Market Share:** 5% of DEX intelligence (not core focus)
---
### Emerging AI-Powered Competitors (2025-2026)
**Trend:** AI-powered crypto tools reshaping 2026 markets
- **Stoic AI:** Algorithmic trading
- **Botty:** Trading automation
- **DexTools:** Adding AI features
**Threat Level:** HIGH
- Incumbents are adding AI capabilities
- Window for AI differentiation: **6-12 months**
---
## 🔍 COMPETITIVE POSITIONING MAP
### Positioning Dimensions
**Dimension 1: Price (Free → Premium)**
- Free: DEX Screener
- Low: $49-99/month (Our target)
- Medium: $100-199/month (DexTools Standard)
- High: Token-gated (DexTools Premium, Birdeye)
**Dimension 2: Intelligence (Data → AI Predictions)**
- Data Aggregation: DEX Screener, CoinGecko
- Analytics: Dex Guru, Birdeye
- **AI Intelligence: [WHITE SPACE] ← Our Opportunity**
**Dimension 3: Accessibility (Complex → Simple)**
- Complex: DexTools, Dex Guru (technical traders)
- **Simple: [WHITE SPACE] ← Our Opportunity**
- Very Simple: DEX Screener (limited features)
### Strategic White Space
**OPPORTUNITY: AI-Powered + Accessible + Mid-Tier Pricing**
```
Intelligence Level
| [OUR POSITION]
AI | AI + Simple + $49-199
| ⭐
|
| DexTools Birdeye
| (Complex) (Expensive)
|
Data | DEX Screener
| (Free/Simple)
|
└──────────────────────────────→
Free $100+ Price
```
**Differentiation Strategy:**
1. **AI Intelligence** (not just data)
2. **Accessible UX** (not complex)
3. **Fair Pricing** ($49-199, not $100+ or token-gated)
4. **Proactive Insights** (not reactive queries)
---
## ⚔️ FIVE FORCES ANALYSIS
### 1. Competitive Rivalry: **HIGH** ⚠️
**Intensity Factors:**
- Multiple established players (DexTools, DEX Screener, Birdeye)
- Low switching costs (users can use multiple tools)
- Market growing fast (15% YoY) = room for multiple winners
- Differentiation possible (AI vs data aggregation)
**Strategic Implication:**
- Must differentiate clearly (AI intelligence)
- Cannot compete on price alone (DEX Screener is free)
- Must build defensible moat (AI models, proprietary patterns)
### 2. Threat of New Entrants: **MEDIUM** ⚠️
**Barriers to Entry:**
- **Low technical barriers (Basic):** APIs are accessible (DexScreener, DefiLlama free).
- **HIGH technical barriers (AI):** Building a robust RAG pipeline + Agentic capabilities (which SurfSense **already has**) takes months of specialized engineering.
- **Brand barriers:** Established players have trust.
**Strategic Implication:**
- We have a **significant technical head start** vs. new entrants.
- We must exploit this "AI Readiness" gap immediately.
- Brand/trust takes time, but superior product (AI) accelerates it.
### 3. Threat of Substitutes: **HIGH** ⚠️
**Substitutes:**
- **Free tools:** DEX Screener, CoinGecko (good enough for many)
- **Manual research:** Twitter, Discord, Telegram (free)
- **CEX tools:** TradingView, Binance analytics (different but overlapping)
- **AI chatbots:** ChatGPT + manual data (emerging threat)
**Strategic Implication:**
- Must provide 10x value over free alternatives
- Must be faster/better than manual research
- Must integrate insights (not just answer questions)
### 4. Bargaining Power of Buyers: **HIGH** ⚠️
**Buyer Power Factors:**
- **Low switching costs:** Easy to cancel subscription
- **Many alternatives:** DexTools, DEX Screener, Birdeye, etc.
- **Price sensitivity:** Crypto traders are cost-conscious
- **Information availability:** Easy to compare tools
**Strategic Implication:**
- Must deliver clear ROI (tool pays for itself)
- Must have sticky features (portfolio tracking, alerts)
- Must provide unique value (AI predictions)
- Freemium model reduces risk for buyers
### 5. Bargaining Power of Suppliers: **MEDIUM** ⚠️
**Supplier Power:**
- **API providers:** DexScreener (free), DefiLlama (free), QuickNode (paid)
- **Switching costs:** Can build own data services if needed
- **Alternatives:** Multiple data sources available
- **Dependency:** High on data quality/reliability
**Strategic Implication:**
- Multi-source strategy reduces dependency
- Can build own QuickNode RPC service if needed
- Premium APIs affordable (no budget constraint)
- Data quality is critical (must validate sources)
### Overall Industry Attractiveness: **MEDIUM** ⚠️
**Positive Factors:**
- ✅ Market growing fast (15% YoY)
- ✅ High willingness to pay ($100/month proven)
- ✅ Clear differentiation opportunity (AI)
**Negative Factors:**
- ❌ High competition
- ❌ Low barriers to entry
- ❌ High buyer power
- ❌ Many substitutes
**Strategic Imperative:**
> **SHIP and DISTRIBUTE.** The "Build" phase is largely done. The window is solely about capturing users before incumbents improve their AI.
---
## ⏰ MARKET TIMING ASSESSMENT
### Is Now the Right Time?
#### ✅ **FAVORABLE FACTORS**
**1. Market Growth**
- 15% YoY growth (2025→2026)
- Bull run momentum (2026)
- DeFi adoption increasing
**2. Technology Readiness**
- AI/ML models mature (GPT-4, embeddings)
- RAG infrastructure proven
- APIs accessible (DexScreener, DefiLlama)
**3. Customer Readiness**
- Traders already paying $100/month (DexTools)
- Proven willingness to pay for intelligence
- Information overload problem acute
**4. Competitive Landscape**
- Incumbents focused on data aggregation
- AI features just emerging (early stage)
- Window of opportunity open
#### ⚠️ **RISK FACTORS**
**1. Market Timing Risk**
- Bull run may not last (bear market kills demand)
- Crypto volatility high
- Regulatory uncertainty
**2. Technology Risk**
- AI predictions may not be accurate enough
- Data quality challenges
- API dependencies
**3. Competitive Risk**
- Incumbents adding AI (DexTools, Birdeye)
- Well-funded competitors
- Fast follower risk
**Window of Opportunity:**
**Optimal Entry:** **NOW (Q1 2026)**
**Reasoning:**
1. **Bull run timing:** Demand is HIGH now.
2. **AI differentiation:** **6-12 month window** before incumbents catch up.
3. **Our Unfair Advantage (Entry Barrier):**
- We have *already* solved the hardest technical part: **The RAG & Context Engine** (Epic 1).
- Competitors (DexScreener/Birdeye) define "AI" as "summary buttons". We define it as **"Active Co-Pilot"** (Epic 2 - Smart Monitoring).
4. **Market validation:** Competitors prove market exists, but satisfaction is low due to complexity.
**Critical Timeline:**
- **Month 1:** **Launch Beta & Monetize.** (Platform is ready).
- **Months 2-3:** Feature Expansion (DefiLlama, AI Alerts) & Growth.
- **Months 4-12:** Scale to 1K+ users, advanced AI predictions.
**Risk Mitigation:**
- Build sticky features (portfolio tracking, alerts)
- Freemium model reduces churn in bear market
- Focus on serious traders (less price-sensitive)
---
## 🎯 KEY MARKET INSIGHTS
### 1. **Market is REAL and GROWING**
- $38.5B trading platforms market, 15% YoY growth
- $500M-800M DEX intelligence SAM
- Proven willingness to pay ($100/month)
### 2. **Competitive Landscape is CROWDED but DIFFERENTIABLE**
- DexTools dominates (30-40% share) but expensive + complex
- DEX Screener has users (40-50%) but no revenue model
- **WHITE SPACE:** AI-powered + accessible + fair pricing
### 3. **AI Differentiation Window is SHORT**
- Incumbents adding AI features (2025-2026)
- **6-12 month window** to build moat
- Must move FAST
### 4. **Market Timing is FAVORABLE but RISKY**
- Bull run = high demand NOW
- Bear market risk = demand could collapse
- Must achieve traction in 6-12 months
### 5. **Solo Founder Can Compete**
- No budget constraints = can use premium APIs
- Technical foundation ready = faster to market
- AI differentiation = defensible moat
- Freemium model = scalable without team
---
## 📊 MARKET OPPORTUNITY SCORE
| Factor | Score | Weight | Weighted |
|--------|-------|--------|----------|
| Market Size | 8/10 | 25% | 2.0 |
| Market Growth | 9/10 | 20% | 1.8 |
| Competitive Intensity | 5/10 | 15% | 0.75 |
| Differentiation Potential | 9/10 | 20% | 1.8 |
| Market Timing | 8/10 | 10% | 0.8 |
| Entry Barriers | 6/10 | 10% | 0.6 |
| **TOTAL** | **7.75/10** | **100%** | **7.75** |
**Interpretation:** **STRONG OPPORTUNITY**
Market is attractive, timing is favorable, differentiation is possible. Main risks: competition and market timing (bear market).
---
## 🚀 STRATEGIC IMPLICATIONS
### What This Means for Strategy
**1. GO AGGRESSIVE on AI Differentiation**
- This is the ONLY defensible moat
- Must be 10x better than incumbents
- 6-12 month window to build
**2. PRICE Competitively**
- $49-199/month sweet spot
- Below DexTools ($100+)
- Above "free" (perceived value)
**3. FOCUS on Accessibility**
- Simple UX (not complex like DexTools)
- Natural language queries
- Proactive insights (not reactive)
**4. MOVE FAST**
- Market timing is NOW
- Bull run won't last forever
- Incumbents are adding AI
**5. BUILD Sticky Features**
- Portfolio tracking
- Personalized alerts
- Historical patterns
- Survive bear market
---
[^1]: The Business Research Company, "Crypto Trading Platform Global Market Report" (2026)
---
**NEXT STEP:** Business Model Analysis (Step 3)

View file

@ -0,0 +1,110 @@
# Strategic Context - SurfSense Crypto Co-Pilot
**Date:** February 2, 2026
**Analysis Type:** Innovation Strategy
**Strategic Ambition:** BET-THE-COMPANY / ALL-IN
---
## 🎯 STRATEGIC FRAMING
### Company Context
**Name:** SurfSense Crypto Co-Pilot
**Current Status:** **Ready for Beta Implementation (Epics 1 & 2 Fully Specified)**
**Future Vision:** The comprehensive "Operating System" for crypto traders, starting as a high-utility browser extension.
**Critical Insight:**
- **Pivot Complete:** Shifted from generic "SurfSense" to focused "Crypto Co-Pilot".
- **Execution Mode:** We are no longer just exploring; we are executing a specific, validated roadmap.
- **Technical Readiness:** Core architecture (RAG, Connectors) and critical features (AI Assistant, Smart Alerts) are designed and ready to build.
---
## 💪 STRATEGIC DRIVER
**Primary Driver:** **AI-NATIVE INTELLIGENCE GAP**
**Context:**
- **Market Saturation:** Data aggregators (DexScreener, Birdeye) are ubiquitous but passive.
- **The Gap:** Traders are drowning in data but starving for *insight* and *actionable intelligence*.
- **The "Agent" Trend:** 2026 is the year of the "AI Agent". Users want tool that *do* things, not just show things.
**Strategic Logic:**
- **Differentiation:** We don't compete on "more charts". We compete on "better answers" and "automated vigilance" (Smart Monitoring).
- **Value Prop:** "Never miss a 100x because you were sleeping" (Smart Alerts) + "Understand any token in 10 seconds" (AI Assistant).
---
## 🏢 CURRENT BUSINESS MODEL STATUS
**SurfSense Status:**
- **Development Phase:** Pre-Revenue, Implementation Started.
- **Monetization Strategy:** Freemium (Free access to core data/charts, Premium subscription for AI Insights & Advanced Alerts).
- **Validation:** Technical feasibility confirmed (Google Gemini 2.0 / OpenAI o3-mini integration verified).
**Strategic Implication:**
- **Focus on Retention:** First features (Chat, Alerts) must be "sticky" daily-use tools.
- **Low Overhead:** Leveraging existing LLMs means we don't need to train models, just orchestrate them well (low CAPEX).
---
## 🏗️ TECHNICAL READINESS (NEW)
**Status:** ✅ **HIGH**
1. **Architecture:** Modular "SurfSense 2.0" architecture defined, separating Content Script, Side Panel, and Background Service.
2. **Epics Ready:**
* **Epic 1 (AI Assistant):** Chat interface, RAG context, LLM Router—fully specified (BDD Ready).
* **Epic 2 (Smart Monitoring):** Price alerts, Whale tracking, Risk analysis—fully specified (BDD Ready).
3. **Risk Mitigation:**
* **Data Reliability:** Fallback strategy (DexScreener + DefiLlama + RPC) in place.
* **Browser Limits:** Off-screen document strategy for WebSocket connections validated.
---
## 🚧 CONSTRAINTS & BOUNDARIES
### Financial Constraints
**Budget:** Self-Project / flexible.
- **Strategy:** Smart API usage (hybrid free/paid tiers) to keep MVP costs near zero until revenue.
### Timeline Constraints
**Timeline:** Aggressive Launch (Week 1 Target).
- **Goal:** Get a working "Assistant" into users' hands immediately to validate the "Co-Pilot" feel.
### Regulatory Constraints
**Financial Advice Liability:**
- **Mitigation:** Strict disclaimer UI patterns ("NFA" badges), AI guardrails to refuse direct "Buy/Sell" commands without context.
---
## 🎯 SUCCESS DEFINITION
**Breakthrough Success Targets:**
### Phase 1: Launch (Month 1-3)
- **Users:** 100 Active Weekly Users (retention focus).
- **Goal:** Prove the "Co-Pilot" behavior (users keep the sidebar open while browsing).
### Phase 2: Growth (Month 4-12)
- **Users:** 1,000+ Paid Subscribers.
- **Feature:** Full "Agentic" capabilities (Automated trading execution, portfolio management).
---
## 🔥 STRATEGIC AMBITION
**Level:** **BET-THE-COMPANY / ALL-IN**
**Refined Focus:**
We are not building a "better DexScreener". We are building the **layer above it**.
- **Legacy:** User looks at charts, calculates, decides.
- **SurfSense:** User asks SurfSense, SurfSense analyzes charts, SurfSense suggests/alerts.
---
## 📊 NEXT STEPS
1. **Execution:** Build Epic 1 (AI Assistant) immediately.
2. **Validation:** Test "Chat with Page" context quality on live DexScreener pages.
3. **Expansion:** Implement Epic 2 (Smart Monitoring) once Chat is stable.

View file

@ -0,0 +1,614 @@
# Strategic Recommendation - SurfSense Crypto Co-Pilot
**Date:** February 1, 2026
**Analysis Type:** Innovation Strategy - Final Recommendation
**Decision:** GO / NO-GO / CONDITIONAL GO
---
## 🎯 EXECUTIVE SUMMARY
### The Opportunity
**Market:** $500M-800M DEX intelligence market, growing 15% YoY
**Timing:** Bull run 2026, 6-12 month AI differentiation window
**Positioning:** AI-first crypto intelligence (white space)
**Business Model:** Freemium SaaS, exceptional unit economics (LTV:CAC 40:1-150:1)
### The Challenge
**Solo founder** with **no existing customer base** must build **market-leading AI platform** in **competitive market** with **well-funded incumbents** before **AI window closes** (6-12 months).
### The Verdict
# ✅ **CONDITIONAL GO**
**Conditions:**
1. **AI moat FIRST** - Build proprietary AI models before features
2. **Speed is CRITICAL** - 6-12 month window to establish lead
3. **Focus on PMF** - Quality over quantity (100 users > 1,000 users)
4. **Plan for scaling** - Automation + community (solo constraint)
5. **Bear market hedge** - Sticky features (survive downturn)
---
## 📊 STRATEGIC ANALYSIS SUMMARY
### Market Landscape (Score: 7.75/10 - STRONG)
**Strengths:**
- ✅ Large market ($500M-800M SAM)
- ✅ Fast growth (15% YoY)
- ✅ Proven willingness to pay ($100/month)
- ✅ Clear white space (AI + accessible + fair pricing)
**Risks:**
- ⚠️ High competition (DexTools, DEX Screener, Birdeye)
- ⚠️ Low barriers to entry (APIs are public)
- ⚠️ Market timing risk (bear market could kill demand)
**Key Insight:**
> Market is real and growing, but competitive. AI differentiation is the ONLY defensible moat, and window is 6-12 months.
---
### Business Model (Score: 8.4/10 - STRONG)
**Strengths:**
- ✅ Exceptional unit economics (LTV:CAC 40:1-150:1)
- ✅ High gross margin (94-99%)
- ✅ Fast break-even (4-7 months)
- ✅ Scalable (SaaS model)
**Risks:**
- ⚠️ Medium defensibility (AI moat critical)
- ⚠️ Solo scaling challenge (1 person → 1K+ users)
- ⚠️ Churn risk (25% Year 1)
**Key Insight:**
> Business model is STRONG. Main risks are defensibility (AI moat) and solo scaling (automation critical).
---
### Disruption Opportunities (STRONG)
**Top Opportunities:**
1. **AI-first positioning** ⭐⭐⭐ (vs "data + AI")
2. **Natural language interface** ⭐⭐ (vs charts/tables)
3. **Proactive intelligence** ⭐⭐ (vs reactive queries)
**Blue Ocean Strategy:**
- **Eliminate:** Complexity, token-gating, manual work
- **Reduce:** Price (50% vs DexTools), time (10x faster)
- **Raise:** AI intelligence, accessibility, proactivity
- **Create:** Predictions, natural language, AI coaching
**Key Insight:**
> Clear differentiation path. Must lead with AI (not just add AI to data).
---
## 🎲 STRATEGIC OPTIONS
### Option 1: **AI-FIRST MVP** (RECOMMENDED) ✅
**Strategy:** Build AI differentiation FIRST, then add features
**Year 1 Focus:**
- AI predictions (price targets, trend forecasting)
- Natural language queries ("Explain why WETH is pumping")
- Proactive alerts (rug pull detection, whale tracking)
- Simple UX (3-click setup)
**Year 1 Targets:**
- 100-500 paying users
- $5K-25K MRR
- 70%+ prediction accuracy
- <25% churn
**Rationale:**
- AI moat is ONLY defensible advantage
- 6-12 month window before incumbents catch up
- Quality over quantity (100 users with great AI > 1,000 users with mediocre AI)
**Risks:**
- AI predictions may not be accurate enough
- Solo founder may struggle with ML complexity
- Market may not value predictions over data
**Mitigation:**
- Start with simple predictions (price direction, not targets)
- Use GPT-4 + RAG (don't build from scratch)
- Validate with private beta (20 users)
---
### Option 2: **FEATURE-FIRST MVP** (NOT RECOMMENDED) ❌
**Strategy:** Build features FIRST, add AI later
**Year 1 Focus:**
- Data aggregation (DexScreener + DefiLlama)
- Portfolio tracking
- Basic alerts
- Charts/dashboards
**Year 1 Targets:**
- 1,000+ users
- $10K-50K MRR
- Fast user growth
- High churn (no differentiation)
**Rationale:**
- Faster to market (no AI complexity)
- Easier to build (data aggregation only)
- Lower risk (proven model)
**Why NOT Recommended:**
- No differentiation (competing with DexTools, DEX Screener)
- No defensible moat (easy to copy)
- Price competition (DEX Screener is free)
- Missed AI window (incumbents will add AI)
---
### Option 3: **PLATFORM-FIRST MVP** (NOT RECOMMENDED) ❌
**Strategy:** Build community platform FIRST
**Year 1 Focus:**
- User-contributed patterns
- Shared watchlists
- Community insights
- Social features
**Year 1 Targets:**
- 5,000+ users
- Network effects
- Viral growth
- Community engagement
**Rationale:**
- Network effects (defensible moat)
- Viral growth (low CAC)
- Community value (sticky)
**Why NOT Recommended:**
- Solo founder constraint (platforms need teams)
- Chicken-egg problem (need users for value)
- No differentiation (social features are commoditized)
- Missed AI window (not focusing on core moat)
---
## ✅ RECOMMENDED STRATEGY: AI-FIRST MVP
### Strategic Pillars
#### **Pillar 1: AI Differentiation** (HIGHEST PRIORITY)
**Goal:** Build proprietary AI moat in 6-12 months
**Tactics:**
- AI predictions (price direction, trend forecasting)
- Pattern recognition (rug pulls, whale behavior)
- Natural language interface (conversational AI)
- Proactive alerts (ML-based)
**Success Metrics:**
- 70%+ prediction accuracy (Year 1)
- 80%+ rug pull detection (Year 1)
- 90%+ user satisfaction with AI explanations
**Timeline:** Months 1-6 (MVP), Months 7-12 (refinement)
---
#### **Pillar 2: Accessible UX** (HIGH PRIORITY)
**Goal:** Make crypto intelligence accessible to everyone
**Tactics:**
- Natural language queries ("Show me whale activity")
- 3-click setup (connect wallet, select tokens, done)
- Plain English explanations (no jargon)
- Mobile-first design (trade on the go)
**Success Metrics:**
- <5 min time to first insight
- 80%+ users complete onboarding
- 90%+ users understand AI explanations
**Timeline:** Months 1-3 (MVP), Months 4-12 (refinement)
---
#### **Pillar 3: Proactive Intelligence** (HIGH PRIORITY)
**Goal:** Alert users, don't make them search
**Tactics:**
- Smart alerts (ML-based, not just price thresholds)
- Rug pull detection (proactive warnings)
- Opportunity discovery (automated scanning)
- Portfolio risk scoring (real-time)
**Success Metrics:**
- 50%+ users enable alerts
- 70%+ users act on alerts
- 80%+ users find alerts valuable
**Timeline:** Months 3-6 (MVP), Months 7-12 (refinement)
---
#### **Pillar 4: Competitive Pricing** (MEDIUM PRIORITY)
**Goal:** Undercut DexTools, beat DEX Screener on value
**Tactics:**
- Freemium model (low barrier)
- $49 Pro tier (50% cheaper than DexTools)
- $199 Premium tier (power users)
- Annual discount (20% off)
**Success Metrics:**
- 3-5% freemium conversion
- $50-60 ARPU (blended)
- <25% churn (Year 1)
**Timeline:** Months 1-12 (ongoing)
---
#### **Pillar 5: Solo Founder Optimization** (CRITICAL)
**Goal:** Build scalable product without team
**Tactics:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- No-code tools (Zapier, n8n for integrations)
- Outsource non-core (design, content)
**Success Metrics:**
- <5 hours/week support (Year 1)
- 90%+ self-service resolution
- 80%+ community engagement
**Timeline:** Months 1-12 (ongoing)
---
## 📅 12-MONTH EXECUTION ROADMAP
### **Months 1-3: AI MVP Development**
**Goal:** Build core AI capabilities
**Deliverables:**
- AI predictions (price direction)
- Natural language queries (basic)
- Proactive alerts (rug pull detection)
- Simple UX (3-click setup)
**Success Criteria:**
- 60%+ prediction accuracy
- 70%+ rug pull detection
- <5 min time to first insight
**Resources:**
- Solo founder (full-time)
- OpenAI API ($200-500/month)
- QuickNode RPC ($300-500/month)
---
### **Months 4-6: Private Beta Launch**
**Goal:** Validate AI value with 20-50 users
**Deliverables:**
- Private beta (invite-only)
- User feedback loop
- AI refinement (based on feedback)
- Freemium tier (public)
**Success Criteria:**
- 20-50 beta users
- 70%+ prediction accuracy
- 80%+ user satisfaction
- 50%+ users willing to pay
**Resources:**
- Solo founder (full-time)
- Beta users (free access)
- Community (Discord)
---
### **Months 7-9: Public Launch**
**Goal:** Scale to 100-500 paying users
**Deliverables:**
- Public launch (freemium)
- Pro tier ($49/month)
- Premium tier ($199/month)
- Marketing (content, Twitter, YouTube)
**Success Criteria:**
- 100-500 paying users
- $5K-25K MRR
- 3-5% freemium conversion
- <25% churn
**Resources:**
- Solo founder (full-time)
- Marketing ($500-1,000/month)
- Infrastructure ($2K-3K/month)
---
### **Months 10-12: PMF Validation**
**Goal:** Validate product-market fit
**Deliverables:**
- AI refinement (80%+ accuracy)
- Feature expansion (portfolio tracking, advanced alerts)
- Community building (Discord, Telegram)
- Thought leadership (blog, Twitter, YouTube)
**Success Criteria:**
- 500-1,000 paying users
- $25K-50K MRR
- 80%+ prediction accuracy
- <20% churn
- 40%+ NPS (Net Promoter Score)
**Resources:**
- Solo founder (full-time)
- Community (Discord, Telegram)
- Infrastructure ($3K-4K/month)
---
## ⚠️ CRITICAL RISKS & MITIGATION
### Risk 1: **AI Predictions Not Accurate Enough** (HIGH) ⚠️
**Impact:** Users don't trust AI, churn is high
**Probability:** MEDIUM (30-40%)
**Mitigation:**
- Start with simple predictions (direction, not targets)
- Validate with private beta (20-50 users)
- Publish accuracy metrics (transparency)
- Continuous improvement (feedback loop)
- Hedge with data aggregation (if AI fails, still useful)
**Contingency:**
- If accuracy <60% after 6 months, pivot to data aggregation + basic AI
- Focus on proactive alerts (easier than predictions)
---
### Risk 2: **Solo Founder Cannot Scale** (HIGH) ⚠️
**Impact:** Support overwhelms, product stagnates
**Probability:** HIGH (50-60%)
**Mitigation:**
- Automation (AI support, self-service)
- Community (Discord, user-to-user help)
- Limit users (100-500 Year 1, not 1,000+)
- Outsource non-core (design, content)
- Hire support (Year 2, after $50K MRR)
**Contingency:**
- If overwhelmed, pause new signups
- Focus on retention (not acquisition)
- Raise prices (reduce volume, increase margin)
---
### Risk 3: **Bear Market Kills Demand** (MEDIUM) ⚠️
**Impact:** Users churn, revenue drops
**Probability:** MEDIUM (40-50%)
**Mitigation:**
- Build sticky features (portfolio tracking, historical data)
- Freemium model (low churn)
- Focus on serious traders (less price-sensitive)
- Diversify revenue (API access, white-label)
- Annual subscriptions (lock in revenue)
**Contingency:**
- If bear market hits, reduce costs (pause paid ads)
- Focus on retention (not acquisition)
- Pivot to "bear market tools" (risk management, portfolio tracking)
---
### Risk 4: **Incumbents Add AI Features** (HIGH) ⚠️
**Impact:** Differentiation erodes, competition intensifies
**Probability:** HIGH (70-80%)
**Mitigation:**
- Move FAST (6-12 month window)
- Build proprietary models (not just GPT-4)
- Focus on accuracy (not just features)
- Brand as "AI-first" (not "data + AI")
- Community moat (user-contributed patterns)
**Contingency:**
- If incumbents catch up, pivot to niche (e.g., "AI for DeFi traders")
- Focus on UX (simpler, more accessible)
- Compete on price (undercut DexTools)
---
### Risk 5: **Regulatory Crackdown** (LOW) ⚠️
**Impact:** Financial advice liability, legal issues
**Probability:** LOW (10-20%)
**Mitigation:**
- Disclaimers (not financial advice)
- Terms of service (liability waiver)
- Position as "information tool" (not "investment advisor")
- Legal review (before launch)
- Insurance (if needed)
**Contingency:**
- If regulatory issues arise, pivot to "data aggregation only"
- Remove predictions (keep alerts, portfolio tracking)
- Consult legal counsel
---
## 🎯 SUCCESS CRITERIA
### Year 1 (Months 1-12)
**User Metrics:**
- 100-500 paying users ✅
- 2,000-5,000 free users ✅
- 3-5% freemium conversion ✅
**Revenue Metrics:**
- $5K-25K MRR ✅
- $60K-300K ARR ✅
- 4-7 month break-even ✅
**Product Metrics:**
- 70%+ prediction accuracy ✅
- 80%+ rug pull detection ✅
- <25% churn
- 40%+ NPS ✅
**Operational Metrics:**
- <5 hours/week support
- 90%+ self-service resolution ✅
- Solo founder sustainable ✅
---
### Year 2 (Months 13-24)
**User Metrics:**
- 1,000-5,000 paying users
- 10,000-25,000 free users
- 4-6% freemium conversion
**Revenue Metrics:**
- $50K-250K MRR
- $600K-3M ARR
- Profitable (30%+ margin)
**Product Metrics:**
- 80%+ prediction accuracy
- 90%+ rug pull detection
- <20% churn
- 50%+ NPS
**Operational Metrics:**
- Hire support (1-2 people)
- Community-driven (Discord, Telegram)
- Thought leadership (blog, Twitter, YouTube)
---
### Year 3+ (Months 25+)
**User Metrics:**
- 10,000+ paying users
- 50,000-100,000 free users
- Platform evolution (community insights)
**Revenue Metrics:**
- $500K-1M+ MRR
- $6M-12M+ ARR
- Acquisition interest (potential exit)
**Product Metrics:**
- 85%+ prediction accuracy
- Market leader in AI crypto intelligence
- Strong brand recognition
**Operational Metrics:**
- Team of 5-10 people
- Platform ecosystem (plugins, bots)
- Thought leadership (conferences, media)
---
## 💡 FINAL RECOMMENDATION
# ✅ **GO - WITH CONDITIONS**
### The Decision
**PROCEED with AI-First MVP strategy**
**Rationale:**
1. **Market is REAL:** $500M-800M SAM, 15% YoY growth
2. **Timing is FAVORABLE:** Bull run 2026, 6-12 month AI window
3. **Business model is STRONG:** LTV:CAC 40:1-150:1, 94-99% margin
4. **Differentiation is CLEAR:** AI-first positioning (white space)
5. **Solo founder is VIABLE:** No budget constraints, automation possible
### The Conditions
**MUST DO:**
1. **AI moat FIRST** - Build proprietary AI before features
2. **Speed is CRITICAL** - 6-12 month window to establish lead
3. **Focus on PMF** - 100 users with great AI > 1,000 users with mediocre AI
4. **Plan for scaling** - Automation + community (solo constraint)
5. **Bear market hedge** - Sticky features (survive downturn)
**MUST AVOID:**
1. **Feature creep** - Don't build data aggregation tool (that's DexTools)
2. **Premature scaling** - Don't chase 1,000+ users in Year 1
3. **Ignoring AI accuracy** - If <60% accuracy, pivot immediately
4. **Solo hero syndrome** - Automate, outsource, build community
5. **Regulatory risk** - Disclaimers, legal review, insurance
### The Timeline
**Week 1:** **BETA LAUNCH** (Soft Launch to Waitlist)
**Week 2:** Intelligence Expansion (DefiLlama)
**Week 3:** Deployment & Scaling
**Week 4:** Public Access (Marketing Push)
### The Bet
> "AI-powered intelligence will beat pure data aggregation in crypto tools, and a solo founder can build a market-leading AI platform by moving fast, focusing on quality, and leveraging automation."
### The Verdict
**GO BUILD IT.** 🚀
The opportunity is real, the timing is favorable, the business model is strong, and the differentiation is clear. The main risks (AI accuracy, solo scaling, market timing, competition) are mitigable with aggressive AI moat building, automation, and speed.
**The window is NOW. Move fast, build AI moat, validate PMF, and scale.**
---
## 📚 APPENDIX: ANALYSIS ARTIFACTS
1. **Strategic Context Synthesis** - Bet-the-company ambition, solo founder, market opportunity driven
2. **Market Landscape Analysis** - TAM $38.5B, SAM $500M-800M, 15% YoY growth, competitive analysis
3. **Business Model Analysis** - Freemium SaaS, LTV:CAC 40:1-150:1, 94-99% margin, 4-7 month break-even
4. **Disruption Opportunities Analysis** - Jobs-to-be-done, Blue Ocean Strategy, platform potential
**All analyses support the GO decision with conditions.**
---
**END OF STRATEGIC RECOMMENDATION**
**Next Steps:** Execute 12-month roadmap, starting with AI MVP development (Months 1-3).

440
_bmad-output/user-guide.md Normal file
View file

@ -0,0 +1,440 @@
# Hướng Dẫn Sử Dụng SurfSense
**Dành cho Người Dùng Cuối**
---
## 📖 Giới Thiệu
SurfSense là nền tảng tìm kiếm và quản lý kiến thức được hỗ trợ bởi AI, giúp bạn:
- 🔍 Tìm kiếm thông tin nhanh chóng từ lịch sử duyệt web
- 💾 Lưu trữ và tổ chức kiến thức cá nhân
- 🤖 Trò chuyện với AI để nghiên cứu sâu
- 🌐 Capture nội dung từ bất kỳ trang web nào
---
## 🚀 Bắt Đầu Nhanh
### Bước 1: Cài Đặt Browser Extension
1. **Tải Extension:**
- Truy cập Chrome Web Store (hoặc store tương ứng với trình duyệt của bạn)
- Tìm kiếm "SurfSense"
- Click **Add to Chrome/Browser**
2. **Kích Hoạt Extension:**
- Click vào icon SurfSense trên thanh công cụ trình duyệt
- Đăng nhập bằng tài khoản của bạn
- Cấp quyền truy cập cần thiết
3. **Xác Nhận Cài Đặt:**
- Icon SurfSense sẽ xuất hiện trên thanh công cụ
- Bạn sẽ thấy thông báo "Connected" khi extension hoạt động
### Bước 2: Truy Cập Web Dashboard
1. Mở trình duyệt và truy cập: `https://app.surfsense.ai` (hoặc URL do admin cung cấp)
2. Đăng nhập bằng tài khoản đã đăng ký
3. Bạn sẽ thấy Dashboard chính với các tính năng:
- **Search Bar** - Tìm kiếm nhanh
- **Recent Activity** - Hoạt động gần đây
- **Collections** - Bộ sưu tập kiến thức
- **AI Chat** - Trò chuyện với AI
---
## 🔍 Tính Năng Chính
### 1. Capture Nội Dung Từ Web
**Cách sử dụng Extension để lưu nội dung:**
1. **Capture Toàn Bộ Trang:**
- Truy cập trang web bạn muốn lưu
- Click icon SurfSense trên thanh công cụ
- Chọn **"Capture This Page"**
- Nội dung sẽ được lưu tự động
2. **Capture Đoạn Văn Bản Cụ Thể:**
- Bôi đen văn bản bạn muốn lưu
- Click chuột phải → **"Save to SurfSense"**
- Hoặc sử dụng shortcut: `Ctrl/Cmd + Shift + S`
3. **Thêm Tags và Notes:**
- Sau khi capture, popup sẽ hiện ra
- Thêm tags (ví dụ: `research`, `work`, `personal`)
- Thêm ghi chú cá nhân nếu cần
- Click **"Save"**
**💡 Mẹo:** Extension tự động trích xuất metadata (title, URL, timestamp) để bạn dễ tìm kiếm sau này.
---
### 2. Tìm Kiếm Kiến Thức
**Trên Web Dashboard:**
1. **Tìm Kiếm Cơ Bản:**
- Nhập từ khóa vào Search Bar
- Kết quả hiển thị theo độ liên quan (relevance)
- Click vào kết quả để xem chi tiết
2. **Tìm Kiếm Nâng Cao (Advanced Search):**
- Click icon **Filter** bên cạnh Search Bar
- Lọc theo:
- **Date Range** - Khoảng thời gian
- **Tags** - Nhãn đã gán
- **Source** - Nguồn (website, PDF, note)
- **Content Type** - Loại nội dung (article, video, image)
3. **Semantic Search (Tìm Kiếm Ngữ Nghĩa):**
- SurfSense sử dụng AI để hiểu ý nghĩa câu hỏi
- Ví dụ: Thay vì tìm "Python tutorial", bạn có thể hỏi:
- *"How do I create a REST API in Python?"*
- *"Best practices for Python async programming"*
**💡 Mẹo:** Sử dụng dấu ngoặc kép `"exact phrase"` để tìm cụm từ chính xác.
---
### 3. Quản Lý Collections (Bộ Sưu Tập)
**Tạo Collection mới:**
1. Vào **Dashboard** → Click **"Collections"** trên sidebar
2. Click **"+ New Collection"**
3. Đặt tên (ví dụ: "AI Research", "Work Projects")
4. Chọn icon và màu sắc (tùy chọn)
5. Click **"Create"**
**Thêm items vào Collection:**
- **Cách 1:** Kéo thả (drag & drop) từ search results
- **Cách 2:** Click vào item → **"Add to Collection"** → Chọn collection
- **Cách 3:** Khi capture nội dung mới, chọn collection trong popup
**Chia sẻ Collection:**
1. Mở Collection bạn muốn chia sẻ
2. Click **"Share"** ở góc trên bên phải
3. Chọn quyền truy cập:
- **View Only** - Chỉ xem
- **Can Edit** - Có thể chỉnh sửa
4. Copy link và gửi cho người khác
---
### 4. AI Chat
**Trò chuyện với AI về kiến thức của bạn:**
1. **Mở AI Chat:**
- Click icon **Chat** trên sidebar
- Hoặc sử dụng shortcut: `Ctrl/Cmd + K`
2. **Hỏi Câu Hỏi:**
- Nhập câu hỏi vào chat box
- Ví dụ:
- *"Summarize all articles I saved about machine learning"*
- *"What are the key points from my research on climate change?"*
- *"Find contradictions in my saved articles about diet"*
3. **AI Tự Động Phân Tích:**
- AI sẽ tìm kiếm trong toàn bộ kiến thức của bạn
- Tổng hợp thông tin từ nhiều nguồn liên quan
- Cung cấp câu trả lời dựa trên nội dung bạn đã lưu
- Thời gian xử lý: 5-15 giây (tùy độ phức tạp)
4. **Xem Sources (Nguồn Tham Khảo):**
- Mỗi câu trả lời của AI có **[1], [2], [3]** citations
- Click vào số để xem nguồn gốc
- Bạn có thể mở link gốc để đọc chi tiết
5. **Attach Files và Mention Documents:**
- Click icon **📎** để đính kèm files
- Sử dụng **@** để mention documents cụ thể trong chat
- AI sẽ ưu tiên phân tích các documents được mention
**💡 Mẹo:** AI Chat hoạt động tốt nhất khi bạn đã lưu nhiều nội dung liên quan đến chủ đề bạn hỏi.
---
### 5. Connectors (Kết Nối Ứng Dụng Bên Ngoài)
**Mở rộng khả năng tìm kiếm với các ứng dụng bạn đang dùng:**
SurfSense cho phép bạn kết nối với **26+ ứng dụng bên ngoài** như Gmail, Google Drive, Slack, Notion, Linear, và nhiều hơn nữa. Sau khi kết nối, bạn có thể tìm kiếm thông tin từ **tất cả các ứng dụng này** ngay trong SurfSense!
**Cách kết nối:**
1. **Mở Connectors Modal:**
- Vào **Dashboard** → Click **"Connectors"** trên sidebar
- Hoặc trong Chat → Click icon **"⚡ Connectors"**
2. **Chọn Ứng Dụng:**
- Bạn sẽ thấy 2 nhóm:
- **Managed OAuth (Composio):** Google Drive, Gmail, Google Calendar
- **Quick Connect:** Slack, Notion, Linear, Airtable, và nhiều hơn
- Click **"Connect"** bên cạnh ứng dụng bạn muốn
3. **Xác Thực (OAuth):**
- Bạn sẽ được chuyển đến trang đăng nhập của ứng dụng (ví dụ: Google)
- Đăng nhập và cấp quyền **chỉ đọc** (read-only) cho SurfSense
- SurfSense **KHÔNG** có quyền xóa hoặc chỉnh sửa dữ liệu của bạn
4. **Indexing Tự Động:**
- Sau khi kết nối, SurfSense sẽ tự động:
- Lấy dữ liệu từ ứng dụng (emails, files, messages, etc.)
- Tạo index để bạn có thể tìm kiếm
- Tự động cập nhật mỗi 60 phút (hoặc theo cấu hình)
**Ví dụ sử dụng:**
- **Kết nối Gmail:** Tìm kiếm trong emails cũ mà không cần mở Gmail
- **Kết nối Google Drive:** Tìm files và documents ngay trong SurfSense
- **Kết nối Slack:** Tìm conversations và shared files từ workspace
- **Kết nối Notion:** Tìm kiếm trong pages và databases
- **Kết nối DexScreener:** Theo dõi giá crypto tokens real-time
- Không cần API key
- Chỉ cần nhập token addresses muốn theo dõi
- AI có thể trả lời: *"What's the current price of WETH?"*
- Xem trading pairs, liquidity, volume, price changes
**Quản lý Connectors:**
- **Xem trạng thái:** Vào **Settings****"Connectors"** để xem danh sách
- **Ngắt kết nối:** Click **"Disconnect"** để thu hồi quyền truy cập
- **Re-index:** Click **"Re-index Now"** để cập nhật dữ liệu ngay lập tức
**🔐 Bảo mật:**
- Connectors chỉ có quyền **đọc** (read-only)
- Dữ liệu được mã hóa khi lưu trữ
- Bạn có thể ngắt kết nối bất cứ lúc nào
**💡 Mẹo:** Kết nối các ứng dụng bạn dùng thường xuyên để có trải nghiệm tìm kiếm "all-in-one" - tìm mọi thứ ở một nơi!
> **📚 Tìm hiểu thêm:** Xem [connectors-explained.md](./connectors-explained.md) để hiểu chi tiết cách Connectors hoạt động.
---
### 6. Quick Search (Tìm Kiếm Nhanh)
**Sử dụng Extension Popup:**
1. Click icon SurfSense trên thanh công cụ
2. Nhập từ khóa vào search box trong popup
3. Kết quả hiển thị ngay lập tức (không cần mở web app)
4. Click vào kết quả để:
- **View in SurfSense** - Mở trong web app
- **Open Original** - Mở trang web gốc
- **Copy Link** - Copy link
**Keyboard Shortcuts:**
- `Ctrl/Cmd + Shift + F` - Mở Quick Search
- `Enter` - Mở kết quả đầu tiên
- `↑ ↓` - Di chuyển giữa các kết quả
- `Esc` - Đóng popup
---
## ⚙️ Cài Đặt Cá Nhân
### Tùy Chỉnh Preferences
1. Vào **Dashboard** → Click avatar → **"Settings"**
2. Các tùy chọn:
**General:**
- **Language** - Ngôn ngữ giao diện (English, Tiếng Việt)
- **Theme** - Giao diện (Light, Dark, Auto)
- **Default Collection** - Collection mặc định khi capture
**Privacy:**
- **Auto-Capture** - Tự động capture trang web (On/Off)
- **Exclude Domains** - Danh sách website không capture (ví dụ: banking sites)
- **Data Retention** - Thời gian lưu trữ dữ liệu (30 days, 90 days, Forever)
**AI Settings:**
- **AI Model** - Chọn model (GPT-4, Claude, Gemini)
- **Response Style** - Phong cách trả lời (Concise, Detailed, Academic)
- **Citations** - Luôn hiển thị nguồn (On/Off)
**Notifications:**
- **Email Digest** - Nhận tóm tắt hàng tuần (On/Off)
- **Browser Notifications** - Thông báo khi có kết quả mới (On/Off)
---
## 🔐 Bảo Mật và Quyền Riêng Tư
### Dữ Liệu Của Bạn
- **Mã Hóa:** Tất cả dữ liệu được mã hóa (encryption) khi lưu trữ và truyền tải
- **Quyền Sở Hữu:** Bạn sở hữu 100% dữ liệu của mình
- **Xóa Dữ Liệu:** Bạn có thể xóa bất kỳ item hoặc toàn bộ tài khoản bất cứ lúc nào
### Quản Lý Quyền Truy Cập
1. **Xem Devices Đã Đăng Nhập:**
- Vào **Settings****"Security"**
- Xem danh sách devices đang active
- Click **"Sign Out"** để đăng xuất device cụ thể
2. **Two-Factor Authentication (2FA):**
- Vào **Settings****"Security"** → **"Enable 2FA"**
- Quét QR code bằng app authenticator (Google Authenticator, Authy)
- Nhập mã xác nhận
---
## 🛠️ Troubleshooting (Xử Lý Sự Cố)
### Extension Không Hoạt Động
**Triệu chứng:** Icon SurfSense không hiển thị hoặc không capture được nội dung.
**Giải pháp:**
1. **Kiểm tra Extension đã được enable:**
- Vào `chrome://extensions/` (hoặc tương đương)
- Tìm "SurfSense"
- Đảm bảo toggle **ON**
2. **Refresh Extension:**
- Click icon SurfSense → **"Refresh"**
- Hoặc reload trang web (`F5`)
3. **Kiểm tra quyền truy cập:**
- Vào `chrome://extensions/` → SurfSense → **"Details"**
- Đảm bảo **"Site access"** = "On all sites"
4. **Reinstall Extension:**
- Gỡ extension cũ
- Cài đặt lại từ store
### Tìm Kiếm Không Ra Kết Quả
**Nguyên nhân có thể:**
- Từ khóa quá cụ thể hoặc sai chính tả
- Nội dung chưa được index (đợi vài phút sau khi capture)
- Filters quá chặt
**Giải pháp:**
1. Thử từ khóa đơn giản hơn
2. Tắt tất cả filters
3. Kiểm tra **"All Content"** thay vì chỉ một collection
4. Sử dụng Semantic Search (hỏi bằng câu tự nhiên)
### AI Chat Không Phản Hồi
**Triệu chứng:** Chat loading mãi không có kết quả.
**Giải pháp:**
1. **Kiểm tra kết nối internet**
2. **Refresh trang web** (`F5`)
3. **Thử câu hỏi đơn giản hơn** (tránh câu quá dài hoặc phức tạp)
4. **Kiểm tra AI Model settings:**
- Vào **Settings****"AI Settings"**
- Thử đổi sang model khác (ví dụ: từ GPT-4 sang Claude)
### Sync Issues (Vấn Đề Đồng Bộ)
**Triệu chứng:** Nội dung capture trên extension không hiển thị trên web app.
**Giải pháp:**
1. **Đợi vài giây** (sync thường mất 2-5 giây)
2. **Refresh web app** (`F5`)
3. **Kiểm tra trạng thái sync:**
- Click icon SurfSense → Xem **"Sync Status"**
- Nếu **"Offline"**, kiểm tra internet
- Nếu **"Error"**, click **"Retry Sync"**
---
## 📞 Hỗ Trợ
### Liên Hệ Support Team
- **Email:** support@surfsense.ai
- **Live Chat:** Click icon **"Help"** ở góc dưới bên phải Dashboard
- **Documentation:** [https://docs.surfsense.ai](https://docs.surfsense.ai)
- **Community Forum:** [https://community.surfsense.ai](https://community.surfsense.ai)
### Báo Lỗi (Bug Report)
1. Vào **Settings****"Help & Feedback"** → **"Report a Bug"**
2. Mô tả vấn đề:
- Bạn đang làm gì khi lỗi xảy ra?
- Kết quả mong đợi vs kết quả thực tế?
- Screenshot (nếu có)
3. Click **"Submit"**
4. Team sẽ phản hồi trong vòng 24 giờ
---
## 💡 Tips & Best Practices
### Tối Ưu Hóa Trải Nghiệm
1. **Sử dụng Tags Nhất Quán:**
- Tạo danh sách tags cố định (ví dụ: `work`, `personal`, `research`)
- Tránh tạo quá nhiều tags tương tự (`ai`, `AI`, `artificial-intelligence`)
2. **Organize Collections Theo Dự Án:**
- Mỗi dự án/chủ đề = 1 collection
- Sử dụng sub-collections cho các chủ đề con
3. **Review Định Kỳ:**
- Mỗi tuần, xem lại **Recent Activity**
- Xóa nội dung không còn cần thiết
- Re-organize items vào collections phù hợp
4. **Tận Dụng AI Chat:**
- Thay vì tìm kiếm thủ công, hỏi AI:
- *"What did I learn about X last month?"*
- *"Summarize my research on Y"*
5. **Backup Quan Trọng:**
- Vào **Settings****"Data Export"**
- Click **"Export All Data"** (format: JSON hoặc Markdown)
- Lưu file backup vào cloud storage (Google Drive, Dropbox)
---
## 🎓 Học Thêm
### Video Tutorials
- [Getting Started with SurfSense (5 phút)](https://youtube.com/surfsense/getting-started)
- [Advanced Search Techniques (10 phút)](https://youtube.com/surfsense/advanced-search)
- [Using AI Chat Effectively (15 phút)](https://youtube.com/surfsense/ai-chat)
### Use Cases
**1. Sinh Viên/Nghiên Cứu Viên:**
- Lưu papers, articles từ Google Scholar
- Tổ chức theo môn học/chủ đề
- Sử dụng AI để tóm tắt và so sánh nghiên cứu
**2. Developers:**
- Save Stack Overflow answers, documentation
- Organize theo ngôn ngữ/framework
- Quick search khi cần reference
**3. Content Creators:**
- Lưu inspiration từ web
- Organize theo campaign/project
- AI giúp brainstorm ideas từ saved content
---
**Cập nhật lần cuối:** 2026-01-31
**Phiên bản tài liệu:** 1.0
**Áp dụng cho:** SurfSense v2.0+

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,329 @@
# SurfSense 2.0 - UX/UI Analysis Report
**Date:** 2026-02-02
**Analyst:** UX Designer (Augment Agent)
**Status:** 🔍 ANALYSIS COMPLETE
---
## Executive Summary
This report analyzes the current UX/UI implementation of SurfSense 2.0 against the design specifications. The analysis reveals significant gaps between the documented designs and actual implementation, particularly in the browser extension.
### Overall Assessment
| Component | Spec Completion | UX Quality | Priority |
|-----------|-----------------|------------|----------|
| Web Dashboard | 75% | ⭐⭐⭐⭐ Good | Medium |
| Browser Extension | 35% | ⭐⭐ Basic | **Critical** |
| Design System | 60% | ⭐⭐⭐ Adequate | High |
---
## Part 1: Browser Extension Analysis
### 1.1 Current State vs Specification
| Component | Spec | Current | Gap |
|-----------|------|---------|-----|
| ChatHeader | Logo + Space Selector + Settings + User | Logo + Settings only | 🔴 Missing 50% |
| ChatMessages | Streaming + Thinking Steps + Markdown | Basic bubbles | 🔴 Missing 80% |
| ChatInput | Text + Attachments + Quick Actions | Text + Send only | 🔴 Missing 60% |
| TokenInfoCard | Full stats + 4 actions + Watchlist | Basic stats + 3 actions | 🟡 Missing 30% |
| QuickCapture | Space selector + States + Animation | Basic button | 🟡 Missing 50% |
| WatchlistPanel | Full watchlist management | ❌ Not implemented | 🔴 Missing 100% |
| AlertConfigModal | Alert configuration UI | ❌ Not implemented | 🔴 Missing 100% |
| SafetyScoreDisplay | Risk score visualization | ❌ Not implemented | 🔴 Missing 100% |
| Welcome Screen | Greeting + Suggestions | Empty state only | 🔴 Missing 70% |
| Settings Dropdown | Full settings menu | Icon only | 🔴 Missing 90% |
### 1.2 Critical Issues
#### 🔴 Issue #1: No Backend Integration
**Current:** ChatInterface uses placeholder responses with setTimeout
**Impact:** Extension is non-functional for actual AI chat
**Fix:** Integrate with backend streaming API
```typescript
// Current (ChatInterface.tsx line 35-46)
setTimeout(() => {
setMessages((prev) => [...prev, { content: "Placeholder response" }]);
}, 1000);
// Should be: Stream from backend API
```
#### 🔴 Issue #2: Missing Thinking Steps
**Current:** No visualization of AI reasoning process
**Impact:** Users don't understand what AI is doing
**Fix:** Port ThinkingStepsDisplay from web dashboard
#### 🔴 Issue #3: No Welcome Experience
**Current:** Empty "Start a conversation..." text
**Impact:** Poor first-time user experience
**Fix:** Add greeting + suggestion cards per spec
#### 🔴 Issue #4: Incomplete TokenInfoCard
**Current:** Missing price change indicator, market cap, rug check
**Impact:** Crypto users lack critical information
**Fix:** Enhance component per wireframe spec
### 1.3 Missing Components (Priority Order)
1. **SafetyScoreDisplay** - Core crypto feature
2. **WatchlistPanel** - Token tracking
3. **AlertConfigModal** - Alert setup
4. **ThinkingStepsDisplay** - AI transparency
5. **Welcome Screen** - Onboarding
6. **Settings Dropdown** - Full menu
---
## Part 2: Web Dashboard Analysis
### 2.1 Current Strengths ✅
| Feature | Implementation | Quality |
|---------|---------------|---------|
| Chat Interface | thread.tsx (708 lines) | ⭐⭐⭐⭐⭐ Excellent |
| Streaming Responses | Full SSE support | ⭐⭐⭐⭐⭐ Excellent |
| Thinking Steps | ThinkingStepsDisplay | ⭐⭐⭐⭐⭐ Excellent |
| Document Mentions | @mention system | ⭐⭐⭐⭐⭐ Excellent |
| Layout System | LayoutShell + Sidebar | ⭐⭐⭐⭐ Good |
| Time-based Greeting | Dynamic greetings | ⭐⭐⭐⭐ Good |
| Tool UIs | Podcast, Link Preview, etc. | ⭐⭐⭐⭐ Good |
### 2.2 Missing Crypto Features
| Feature | Status | Priority |
|---------|--------|----------|
| Crypto Dashboard Tab | ❌ Not started | P1 |
| Portfolio Summary | ❌ Not started | P2 |
| Watchlist Table | ❌ Not started | P1 |
| Alerts Panel | ❌ Not started | P1 |
| Market Overview Widget | ❌ Not started | P2 |
| Trending Tokens | ❌ Not started | P3 |
| $TOKEN shortcuts | ❌ Not started | P2 |
| /command support | ❌ Not started | P2 |
---
## Part 3: Design System Analysis
### 3.1 Color Palette Gaps
**Specified but not implemented:**
```css
/* Crypto-specific colors - NOT IN CODEBASE */
--crypto-bullish: #22C55E;
--crypto-bearish: #EF4444;
--chain-solana: #9945FF;
--chain-ethereum: #627EEA;
--risk-safe: #22C55E;
--risk-danger: #EF4444;
```
### 3.2 Typography Alignment
| Aspect | Spec | Current | Status |
|--------|------|---------|--------|
| Font Family | Inter | Inter | ✅ Aligned |
| Font Sizes | 12-30px scale | Similar | ✅ Aligned |
| Font Weights | 400-700 | 400-700 | ✅ Aligned |
### 3.3 Spacing Consistency
**Extension-specific spacing not implemented:**
```css
/* Spec defines but not used */
--ext-space-xs: 4px;
--ext-space-sm: 8px;
--ext-header-height: 56px;
--ext-quick-capture-height: 48px;
```
---
## Part 4: Prioritized Recommendations
### 🔴 P0 - Critical (This Week)
| # | Issue | Action | Effort |
|---|-------|--------|--------|
| 1 | Extension backend integration | Connect to streaming API | 3 days |
| 2 | Add ThinkingStepsDisplay to extension | Port from web | 1 day |
| 3 | Enhance TokenInfoCard | Add price change, mcap | 0.5 day |
| 4 | Create Welcome Screen | Add greeting + suggestions | 1 day |
### 🟠 P1 - High Priority (Next 2 Weeks)
| # | Issue | Action | Effort |
|---|-------|--------|--------|
| 5 | SafetyScoreDisplay component | Create new component | 2 days |
| 6 | WatchlistPanel | Create with local storage | 3 days |
| 7 | ChatHeader enhancement | Add space selector, user icon | 1 day |
| 8 | ChatInput enhancement | Add attachment button | 1 day |
| 9 | Settings Dropdown | Full menu implementation | 1 day |
### 🟡 P2 - Medium Priority (Weeks 3-4)
| # | Issue | Action | Effort |
|---|-------|--------|--------|
| 10 | AlertConfigModal | Create alert configuration UI | 2 days |
| 11 | Crypto Dashboard tab (web) | New dashboard page | 3 days |
| 12 | Watchlist Table (web) | Full watchlist management | 2 days |
| 13 | QuickCapture enhancement | Add space selector modal | 1 day |
| 14 | Keyboard shortcuts | Implement Cmd+K, etc. | 1 day |
### 🟢 P3 - Low Priority (Month 2+)
| # | Issue | Action | Effort |
|---|-------|--------|--------|
| 15 | Market Overview widget | BTC/ETH/SOL prices | 2 days |
| 16 | Trending Tokens carousel | Hot tokens display | 2 days |
| 17 | $TOKEN shortcuts | Chat input parsing | 1 day |
| 18 | Design system alignment | Crypto colors, animations | 2 days |
| 19 | Accessibility audit | ARIA, keyboard nav | 2 days |
---
## Part 5: Component-Level Recommendations
### 5.1 TokenInfoCard Improvements
**Current:**
```
┌─────────────────────────────────────┐
│ 🪙 Token Symbol │
│ chain • address... │
│ Price | Vol | Liquidity │
│ [Safety] [Holders] [Predict] │
└─────────────────────────────────────┘
```
**Recommended:**
```
┌─────────────────────────────────────┐
│ 🪙 BULLA / SOL │
│ Solana • CA: 7xKX...3nPq [⭐] │ ← Add to watchlist
│ │
│ $0.00001234 ▲ +156.7% │ ← Price change indicator
│ 24h change │
│ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Vol 24h │ │Liquidity│ │ MCap │ │ ← Add Market Cap
│ │ $1.2M │ │ $450K │ │ $2.1M │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │
│ [🛡Safety][👥Holders][📈Predict][⚠Rug]│ ← Add Rug check
└─────────────────────────────────────┘
```
### 5.2 ChatHeader Improvements
**Current:**
```
┌─────────────────────────────────────┐
│ [Logo] SurfSense [⚙️] │
└─────────────────────────────────────┘
```
**Recommended:**
```
┌─────────────────────────────────────┐
│ 🌊 SurfSense [Crypto ▼] [⚙️] [👤] │
└─────────────────────────────────────┘
```
### 5.3 Welcome Screen Implementation
**Current:** Empty state with "Start a conversation..."
**Recommended:** Time-based greeting + suggestion cards (see wireframes in ux-design-specification.md)
---
## Part 6: User Flow Gaps
### 6.1 Token Safety Check Flow
| Step | Spec | Current | Status |
|------|------|---------|--------|
| 1 | User clicks Safety button | ✅ Button exists | ✅ |
| 2 | API call to safety endpoint | ❌ Not implemented | 🔴 |
| 3 | Loading state during analysis | ❌ Not implemented | 🔴 |
| 4 | Display SafetyScoreDisplay | ❌ Component missing | 🔴 |
| 5 | Add to Watchlist action | ❌ Not implemented | 🔴 |
| 6 | Set Alert action | ❌ Not implemented | 🔴 |
### 6.2 Quick Capture Flow
| Step | Spec | Current | Status |
|------|------|---------|--------|
| 1 | Click capture button | ✅ Works | ✅ |
| 2 | Select Search Space | ❌ No selector | 🟡 |
| 3 | Show loading state | ❌ No loading UI | 🟡 |
| 4 | Success toast | ✅ Works | ✅ |
---
## Part 7: Accessibility Gaps
| Requirement | Status | Priority |
|-------------|--------|----------|
| Keyboard navigation | ❌ Missing | P2 |
| ARIA labels | ❌ Missing | P2 |
| Screen reader announcements | ❌ Missing | P3 |
| Color contrast (WCAG AA) | ⚠️ Partial | P2 |
| Focus indicators | ⚠️ Partial | P2 |
---
## Part 8: Action Items Summary
### Immediate Actions (This Sprint)
- [ ] **EXT-001**: Integrate extension with backend streaming API
- [ ] **EXT-002**: Port ThinkingStepsDisplay to extension
- [ ] **EXT-003**: Enhance TokenInfoCard with price change, mcap
- [ ] **EXT-004**: Create Welcome Screen with suggestions
- [ ] **EXT-005**: Implement SafetyScoreDisplay component
### Next Sprint
- [ ] **EXT-006**: Create WatchlistPanel component
- [ ] **EXT-007**: Enhance ChatHeader with space selector
- [ ] **EXT-008**: Add attachment button to ChatInput
- [ ] **EXT-009**: Implement Settings Dropdown
- [ ] **WEB-001**: Create Crypto Dashboard tab
### Backlog
- [ ] **EXT-010**: AlertConfigModal
- [ ] **WEB-002**: Watchlist Table
- [ ] **WEB-003**: Market Overview widget
- [ ] **SYS-001**: Design system alignment
- [ ] **ACC-001**: Accessibility audit
---
## Appendix: File References
| Component | File Path | Lines |
|-----------|-----------|-------|
| ChatInterface | `surfsense_browser_extension/sidepanel/chat/ChatInterface.tsx` | 79 |
| ChatHeader | `surfsense_browser_extension/sidepanel/chat/ChatHeader.tsx` | 25 |
| ChatMessages | `surfsense_browser_extension/sidepanel/chat/ChatMessages.tsx` | 34 |
| ChatInput | `surfsense_browser_extension/sidepanel/chat/ChatInput.tsx` | 42 |
| TokenInfoCard | `surfsense_browser_extension/sidepanel/dexscreener/TokenInfoCard.tsx` | 83 |
| QuickCapture | `surfsense_browser_extension/sidepanel/chat/QuickCapture.tsx` | 50 |
| Thread (Web) | `surfsense_web/components/assistant-ui/thread.tsx` | 708 |
| UX Spec | `_bmad-output/planning-artifacts/ux-design-specification.md` | 813 |
| Extension UX | `_bmad-output/ux-design/extension-ux-design.md` | 933 |
---
**Report Status:** ✅ COMPLETE
**Next Review:** After P0 items completed
**Owner:** UX Designer

View file

@ -0,0 +1,42 @@
# Epic 2 AC Conversion Summary
**Date:** 2026-02-02
**Status:** ✅ COMPLETE
## Overview
Successfully converted all Epic 2 acceptance criteria from checklist format to BDD Given/When/Then format.
## Stories Converted
### Story 2.1: Real-time Price Alerts (5 ACs)
- AC 2.1.1: Watchlist Management
- AC 2.1.2: Alert Types Configuration
- AC 2.1.3: Browser Notifications
- AC 2.1.4: Sound Alerts
- AC 2.1.5: Alert History
### Story 2.2: Whale Activity Tracker (5 ACs)
- AC 2.2.1: Monitor Large Transactions
- AC 2.2.2: Wallet Clustering Detection
- AC 2.2.3: Smart Money Tracking
- AC 2.2.4: Transaction Details
- AC 2.2.5: Whale Activity Feed
### Story 2.3: Rug Pull Early Warning System (5 ACs)
- AC 2.3.1: Risk Indicators Monitoring
- AC 2.3.2: Risk Score Calculation
- AC 2.3.3: Risk Score Display
- AC 2.3.4: Recommendations
- AC 2.3.5: Risk Alerts
## Total Impact
- **15 acceptance criteria** converted to BDD format
- **P2 Issue #7** marked as RESOLVED
- **Epic 2** now READY FOR IMPLEMENTATION
## Files Modified
1. `/Users/mac_1/Documents/GitHub/SurfSense/_bmad-epics/epic-2-smart-monitoring-alerts.md`
2. `/Users/mac_1/.gemini/antigravity/brain/02a071c7-57fc-4f43-a2e8-516ac511579a/implementation_readiness_report.md`

File diff suppressed because it is too large Load diff