AI-driven US tech company earnings analysis platform with Chinese summaries.
Production: https://earnlytics-ebon.vercel.app
Last Updated: 2026-02-27
| Phase | Status | Completion | Key Achievements |
|---|---|---|---|
| Plan 1: MVP | โ Complete | 100% | 10 pages, Vercel deployed |
| Plan 2: AI Automation | โ Complete | 100% | DeepSeek AI, 23 earnings analyzed, GitHub Actions |
| Plan 3: Scale | โ Complete | 100% | 30 companies, 109 earnings, 100% AI coverage, email subscription |
| RAG AI Assistant | โ Complete | 100% | Vector search, multi-turn dialogue, dynamic suggestions |
| Portfolio Optimization | โ Complete | 100% | Real-time prices, glassmorphism design, auto-refresh |
- Companies: 30 (Tier 1/2/3) - scripts support tier2/tier3 insertion
- Earnings: 109 records - scripts for backfilling and seeding
- AI Analyses: 100% coverage - analyze-batch.ts script available
- Document Embeddings: Vector data populated - 1024-dim Cohere embeddings
- Chat Conversations: Ready for AI assistant - multi-turn dialogue support
- Subscribers: Ready (API + UI complete) - send-digests.ts script exists
earnlytics/
โโโ AGENTS.md # AI assistant knowledge base (updated 2026-02-11)
โโโ README.md # This file
โโโ .gitignore # Root gitignore (minimal)
โโโ doc/ # Chinese documentation
โ โโโ ่ฎกๅ/ # Execution plans (Plan 1-5)
โ โโโ ็ญ็ฅ/ # Strategy docs
โ โโโ ๆๆฏ/ # Technical docs
โ โโโ ้กน็ฎ็ถๆๆฅๅ-20260210.md # Current status report
โโโ earnlytics-web/ # Next.js 16 frontend โฌ
๏ธ Main codebase
โ โโโ src/
โ โ โโโ app/ # App Router pages
โ โ โ โโโ earnings/[symbol]/ # Dynamic route for earnings
โ โ โ โโโ companies/ # Company list page
โ โ โ โโโ calendar/ # Earnings calendar
โ โ โ โโโ assistant/ # AI assistant (RAG chat) โจ
โ โ โ โโโ portfolio/ # Portfolio management
โ โ โ โโโ privacy/ # Privacy policy
โ โ โ โโโ terms/ # Terms of service
โ โ โ โโโ api/ # API routes
โ โ โโโ components/
โ โ โ โโโ ui/ # shadcn/ui primitives
โ โ โ โโโ icons/ # SVG icon library (replaced all emoji)
โ โ โ โโโ layout/ # Header, Footer
โ โ โโโ lib/ # Utilities (ai.ts, supabase.ts)
โ โโโ scripts/ # 24 data scripts
โ โ โโโ fetch-earnings.ts
โ โ โโโ analyze-batch.ts
โ โ โโโ generate-embeddings.ts # Vector generation โจ
โ โ โโโ backfill-tier2.ts
โ โ โโโ send-digests.ts
โ โโโ supabase/migrations/ # Database schema
โโโ pencil-earnlytics.pen # Design file (13 pages)
# Frontend development
cd earnlytics-web && npm run dev # Start dev server (localhost:3000)
# Data Operations
npm run fetch:earnings # Fetch latest earnings from FMP
npm run analyze:batch # Generate AI analysis (batch of 5)
npm run generate:embeddings # Generate vector embeddings for RAG
# Build & Deploy
npm run build # Production build
npm run lint # Lint check| Layer | Technology | Version |
|---|---|---|
| Frontend | Next.js | 16.1.6 |
| Frontend | React | 19.2.3 |
| Frontend | TypeScript | 5 |
| Styling | Tailwind CSS | 4 |
| UI Components | shadcn/ui | Latest |
| Icons | Lucide React + Custom SVG | Latest |
| Path alias | @/* โ ./src/* |
- |
- Hosting: Vercel Serverless
- Database: Supabase PostgreSQL + pgvector
- AI Service: DeepSeek API (ยฅ0.002/1K tokens)
- Embedding: Cohere Embedding API (1024-dim, free tier)
- Data Source: Financial Modeling Prep (FMP) API + SEC EDGAR
- Automation: GitHub Actions (every 4 hours)
/homenow uses server-side prefetch + cache (revalidate=300) to reduce client waterfall.- Added dynamic imports and viewport-triggered rendering for below-the-fold sections.
HeroStatscounters start only when entering viewport.MarketTickeranimation pauses when tab hidden/offscreen to reduce CPU usage.EarningsCardoptimized withmemo+ memoized sparkline generation./api/market-tickernow supports in-memory short cache +ETag/304.- Added Web Vitals collection pipeline:
- client reporter:
src/components/performance/WebVitalsReporter.tsx - API endpoint:
src/app/api/web-vitals/route.ts(POST ingest + GET summary)
- client reporter:
- Added image optimization helper
src/lib/image-optimization.tsto avoid unnecessaryunoptimized.
- Legacy root doc
earnlytics-web-architecture.mdhas been removed. - Use
for_AGENTS/AGENTS.mdandfor_AGENTS/่ง่ๆๆกฃ/*as the canonical architecture and implementation references.
| Phase | Timeline | Goal | Status | Evidence in Code |
|---|---|---|---|---|
| Plan 1: MVP | Week 1-2 | 10 pages, 10 companies | โ Complete | 10+ pages in app/, shadcn/ui components |
| Plan 2: AI Automation | Week 3-4 | AI analysis, automation | โ Complete | ai.ts, analyze-batch.ts, GitHub Actions |
| Plan 3: Scale | Month 2 | 30 companies, 109 earnings | โ Complete | tier2/tier3 scripts, backfill scripts |
| RAG AI Assistant | Week 5-6 | Vector search, AI chat | โ Complete | /assistant page, Cohere embeddings, RAG pipeline |
| Portfolio Optimization | Week 6-7 | Real-time prices, UI upgrade | โ Complete | 15-min refresh, glassmorphism design |
| Plan 4: Growth | Month 3 | SEO, traffic growth | ๐ Planned | - |
| Plan 5: Commercialization | Month 4-6 | Monetization | ๐ Planned | - |
| Phase | Monthly Cost | Main Expense | Actual (Based on Code) |
|---|---|---|---|
| MVP | ยฅ0 | Free tier | โ ยฅ0 (Vercel, Supabase free) |
| Automation | ยฅ1-2 | DeepSeek API | โ ยฅ0.2-1 (batch processing) |
| Scale | ยฅ10-20 | Potential DB upgrade | ๐ ยฅ0.2-1 (still on free tiers) |
Current Monthly Cost: ~ยฅ0.2-1 (extremely low, all free tiers)
Changed from: /earnings?symbol=aapl (query params)
Changed to: /earnings/aapl (dynamic route)
Evidence: src/app/earnings/[symbol]/page.tsx exists
Reason: Next.js 15+ params are Promises, simpler to use dynamic segments
All emoji replaced with SVG components
Evidence: src/components/icons/index.tsx exists with custom icons
Benefits: Consistent styling, better performance, no platform differences
Approach: Process 5 earnings at a time
Evidence: scripts/analyze-batch.ts with batch logic
Reason: Control API costs, manageable execution time
| Path | Content | Status |
|---|---|---|
doc/่ฎกๅ/ |
Execution plans (Plan 1-5) | โ Complete |
doc/็ญ็ฅ/ |
Strategy documents | โ Complete |
doc/ๆๆฏ/ |
Technical documentation | โ Complete |
doc/้กน็ฎ็ถๆๆฅๅ-20260210.md |
Current status report | โ Updated |
- โ Run
create-next-appin root directory (creates duplicate config) - โ Add API keys to git (use environment variables)
- โ Use
as any,@ts-ignore,@ts-expect-error - โ Add
.gitignorerules that overlap withearnlytics-web/.gitignore - โ Commit
.env.localor files containing secrets
- โ
Use SVG icons from
src/components/icons/ - โ Follow shadcn/ui patterns for components
- โ Update progress documents when completing tasks
- โ Use dynamic routes for parameterized pages
- โ Test build before committing
| Issue | Solution | Evidence |
|---|---|---|
| useSearchParams returns null | Use dynamic route [symbol] instead |
earnings/[symbol]/page.tsx |
| params is Promise in Next.js 15 | Use React.use() to unwrap |
earnings/[symbol]/page.tsx |
| Environment variables in scripts | Use dotenv to load .env.local |
scripts/*.ts with config() |
| API keys leaked to git | 1) Delete file, 2) Rotate keys, 3) Add to .gitignore |
Already fixed |
- Project uses DOVE VPN proxy (HTTP 7897) for GitHub access
- Doc folder uses Chinese naming conventions (่ฎกๅ, ๆๆฏ, ๏ฟฝ๏ฟฝ๏ฟฝ็ฅ)
- Root
.gitignoreis minimal; full rules inearnlytics-web/.gitignore - Monthly AI cost: ~ยฅ0.2-1 (extremely low cost, batch processing)
- All API keys must be rotated if accidentally committed
- Dynamic routes use
[symbol]format, accessed viaReact.use(params)in Next.js 15 - 23 data scripts available for various operations
- โ Complete Frontend: 10+ pages with dynamic routing
- โ AI Integration: DeepSeek API with batch processing
- โ RAG AI Assistant: Vector search with Cohere embeddings, multi-turn dialogue
- โ Data Pipeline: 24 scripts for data fetching, analysis, and embeddings
- โ Database Schema: Supabase migrations with pgvector support
- โ UI System: shadcn/ui + custom SVG icons + glassmorphism design
- โ Automation: GitHub Actions for scheduled tasks
- โ Scalability: Support for 30 companies across 3 tiers
- โ Real-time Portfolio: 15-min price refresh with auto-update
Production: https://earnlytics-ebon.vercel.app
GitHub: https://github.com/Timcai06/Earnlytics
Branch: main
Last Updated: 2026-02-27