| Feature | Description |
|---|---|
| Low-Latency Chat | Streaming responses with real-time market context & source transparency |
| Smart Portfolio | Live P&L tracking, health scores, sentiment analysis & buy/hold/sell signals |
| Market Intelligence | Real-time quotes, technical analysis, fundamentals & synthesized news |
| AI Transparency | Execution phases, source tracking, deduplication & live activity monitor |
| Daily Briefs | Automated portfolio summaries & market pulse reports (Vercel Cron) |
| Enterprise Security | RLS-enforced Supabase auth, environment-isolated credentials |
| Multi-Turn Intelligence | Coreference resolution for "that/it" queries, follow-up grounding |
| Responsive UI | Mobile-first design with Tailwind CSS, Framer Motion, native OS body fonts, and Fraunces headings |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT (Next.js + React 19) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Chat UI (streaming responses) β
β β’ Portfolio Dashboard (real-time P&L) β
β β’ Watchlist Monitor (price tracking) β
β β’ Settings & Profile Management β
β β’ State: Zustand (persistent client state) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API LAYER (Next.js Route Handlers) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β /api/chat ......................... Streaming AI responses β
β /api/portfolio/* .................. Holdings management β
β /api/portfolio/intelligence ........ AI insights & signals β
β /api/watchlist .................... Price monitoring β
β /api/conversations/* .............. Chat history β
β /api/stock/* ...................... Market data β
β /api/daily-brief .................. Report generation β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SERVICES LAYER β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Mistral AI (LLM, Embeddings) β
β β’ Supabase (Auth, Postgres, RLS) β
β β’ Yahoo Finance (Quotes, History, Search) β
β β’ MarketAux & NewsData (News Synthesis) β
β β’ Vercel Cron (Scheduled Briefs) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16 App Router, React 19, TypeScript | Fast, type-safe UI with streaming support |
| Styling | Tailwind CSS, Framer Motion, native font stack, Fraunces serif | Premium responsive design, typography & animations |
| State Management | Zustand | Lightweight, persistent client state |
| Backend | Next.js Route Handlers | Serverless API functions |
| Database | Supabase (PostgreSQL) | RLS-enforced data isolation |
| Auth | Supabase Auth (PKCE OAuth) | Secure passwordless & email flows |
| LLM | Mistral + Cerebras | Context-aware AI responses, embeddings & low-latency routing |
| Market Data | Yahoo Finance + Finnhub | Real-time quotes, profiles, fundamentals & historical data |
| News | MarketAux, NewsData, Yahoo RSS | Multi-source news aggregation |
| Deployment | Vercel | Serverless, edge-optimized hosting |
alphasight-ai/
βββ src/
β βββ app/
β β βββ (app)/ # Protected routes (authenticated)
β β β βββ chat/[id]/ # Chat conversation page
β β β βββ portfolio/ # Portfolio dashboard
β β β βββ watchlist/ # Watchlist monitor
β β β βββ daily-brief/ # Daily report
β β β βββ settings/ # User preferences
β β β βββ profile/ # Profile management
β β βββ api/ # Route handlers
β β β βββ chat/ # AI streaming
β β β βββ portfolio/ # Holdings CRUD
β β β βββ conversations/ # Chat history
β β β βββ watchlist/ # Monitoring
β β β βββ stock/ # Market data
β β βββ auth/ # Auth pages (login, signup)
β β βββ login/ # Login page
β β βββ signup/ # Signup page
β βββ components/
β β βββ chat/ # Chat UI components
β β βββ portfolio/ # Portfolio cards
β β βββ common/ # Reusable UI elements
β β βββ layout/ # Navigation & layout
β βββ lib/
β β βββ ai/ # Mistral integration & prompts
β β βββ stock/ # Market data utilities
β β βββ supabase/ # DB helpers & RLS
β β βββ hooks/ # Custom React hooks
β β βββ utils/ # Helper functions
β β βββ __tests__/ # Unit tests
β βββ stores/ # Zustand state management
β βββ types/ # Shared TypeScript types
β βββ middleware.ts # Auth middleware
βββ supabase/
β βββ schema.sql # Database schema with RLS
βββ public/ # Static assets
βββ logos/ # Brand assets
βββ package.json # Dependencies & scripts
Queries like "tell me about ITC" β "tell me about that" are resolved to standalone intent before routing, enabling natural multi-turn conversations.
Query rewrite path improves retrieval quality and reduces literal bad searches, ensuring every search is contextually relevant.
- Real-time execution phases (Searching... β Analyzing... β Finalizing...)
- Live source tracking with dedupe & domain-only filtering
- Smooth state transitions for optimal UX and clearer AI progress feedback
Prompts enforce use of available search/context instead of "not in training data" responses, keeping all answers grounded in live data.
Theme, chart/news visibility, and notification toggles apply instantly to UI without page reloads, with full light-mode token support across settings, profile, portfolio, and brief screens.
- Structured key/value memory for explicit facts (risk profile, preferences)
- pgvector embeddings for semantic facts ("prefers dividend stocks")
- Top-K retrieval with similarity thresholding
- Auto-extraction & deduplication on every chat turn
- Source reliability scoring surfaces a response confidence meter directly in chat.
- Public share links preserve rendered chat output and improve markdown-safe message display.
- Node.js 18+ or 20+
- npm or yarn
- Supabase project (free tier available)
- Mistral API key
- Cerebras API key (recommended for low-latency routing + fallback)
git clone https://github.com/Eshwar02/bearbot.git
cd bearbot
npm installCreate .env.local:
# Supabase (required)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
NEXT_PUBLIC_APP_URL=http://localhost:3000
# AI Providers (required: at least one; recommended: both)
MISTRAL_API_KEY=your-mistral-key
CEREBRAS_API_KEY=your-cerebras-key
# News Providers (optional, but recommended)
MARKETAUX_API_KEY=your-marketaux-key
NEWSDATA_API_KEY=your-newsdata-key
# Optional: Scheduled report auth
CRON_SECRET=your-cron-secret# Supabase CLI (optional but recommended)
supabase start
# Or manually: run supabase/schema.sql in your Supabase SQL editornpm run devOpen http://localhost:3000 and sign up.
npm run build
npm run startDeploy to Vercel:
vercel deploy| Command | Purpose |
|---|---|
npm run dev |
Start dev server with Turbopack |
npm run build |
Optimized production build |
npm run start |
Run production build locally |
npm run lint |
ESLint checks with flat config |
npm test |
Run Jest tests (single-run) |
npm run test:watch |
Jest in watch mode |
npm run test:coverage |
Coverage report |
| Endpoint | Method | Purpose | Auth |
|---|---|---|---|
/api/chat |
POST |
Stream AI response with market context | Required |
/api/conversations |
GET, POST |
List or create chat conversations | Required |
/api/conversations/[id] |
GET, DELETE |
Fetch or delete conversation | Required |
/api/conversations/[id]/messages |
GET |
Paginated message history | Required |
| Endpoint | Method | Purpose | Auth |
|---|---|---|---|
/api/portfolio |
GET, POST |
List holdings or add new position | Required |
/api/portfolio/[id] |
PUT, DELETE |
Update or remove holding | Required |
/api/portfolio/intelligence |
GET |
AI health score, sentiment, signals | Required |
| Endpoint | Method | Purpose | Auth |
|---|---|---|---|
/api/stock/quote |
GET |
Real-time stock quote | Optional |
/api/stock/search |
GET |
Symbol/company search | Optional |
| Endpoint | Method | Purpose | Auth |
|---|---|---|---|
/api/watchlist |
GET, POST, DELETE |
Manage watchlist | Required |
/api/daily-brief |
GET, POST |
Fetch or generate daily brief | Required |
- β Chart Stability - Fixed the market indices bar stuttering on refresh.
- β Auth Redirects - Hardened OAuth redirects for custom-domain flows and stopped benign errors from crashing the app.
- β Conversation Intelligence - Improved follow-up intent continuation and noisy-English normalization.
- β
Google OAuth - Switched redirect handling to the custom domain instead of
vercel.app. - β Source Safety - Added Groq API error detection and defensive checks for source arrays.
- β Routing - Marketing subdomains now resolve to the app origin, while marketing pages stay on the working origin.
- β Guest UX - Simplified guest login CTAs, opened chat to guests, and kept the 5-prompt cap.
- β Agent Workflow - Completed the plan-then-execute path with the Cerebras planner.
- β Branding - Unified brand icons across the app and public assets.
- β Auth Reliability - Wrote OAuth session cookies before redirecting to chat.
- β
SEO - Improved crawler access with
llms.txtand semantic HTML. - β Confidence Meter - Added source reliability scoring and a visible confidence badge in chat.
- β Response Sharing - Added shareable response pages with safer chat rendering.
- β Provider Upgrades - Added the Cerebras provider and Finnhub fundamentals/profile data.
- β UI Polish - Refined sidebar chat typography and hover behavior, plus attachment-click feedback.
- β Subdomain UX - Fixed the info subdomain tab title.
6dd203a - fix: stop market indices bar from stuttering on refresh
bdc9cdb - fix: harden vercel.app OAuth redirects and benign error handling
4bd7b9e - fix: improve follow-up intent continuation and noisy-English normalization
c34eac9 - fix: route Google OAuth back to the custom domain
6b41ae0 - fix: add Groq API error detection and defensive source-array checks
ba53ac9 - fix: redirect marketing subdomains to the app origin
e7aeb2c - fix: keep marketing pages on the working origin
637d57b - fix: simplify guest login CTAs and refresh stability
5e7d045 - feat: complete plan-then-execute agent path with Cerebras planner
1daccea - feat: open chat to guests, enforce 5-prompt cap, unify brand icons
fc4ab94 - fix(auth): write OAuth session cookies before redirecting to chat
677fe8e - feat: improve GEO/SEO with AI crawler access, llms.txt, semantic HTML
0942c39 - feat: add AI confidence meter with source reliability scoring
63ddb6d - Fix shared response links and chat rendering
8f3ef64 - Add Cerebras provider with intent-based routing
0e73fe9 - Add Finnhub for US profile and fundamentals
75d22b4 - Refine sidebar chat typography and hover behavior
04fde8a - Add attachment click development notification
50ba188 - Fix info subdomain tab title
We welcome contributions! Here's how to get started:
# Click "Fork" on GitHub
git clone https://github.com/YOUR_USERNAME/bearbot.git
cd bearbotgit checkout -b feature/your-feature-name- Follow ESLint rules:
npm run lint - Write tests if applicable
- Keep commits atomic and descriptive
git commit -m "feat: add your feature description"
git push origin feature/your-feature-name- Describe what your PR does
- Reference any related issues
- Request review from maintainers
- RLS Enforced: All database queries use Row-Level Security
- Auth Tokens: Supabase PKCE OAuth flow, no password stored
- API Keys: Environment-isolated via
.env.local - User Data: Scoped to authenticated user (auth.uid())
- No Hallucinations: All AI responses grounded in live market data
- Streaming Chat: Low-latency responses with text-first UI
- Edge Functions: Vercel serverless scaling
- Database: Supabase PostgreSQL with connection pooling
- Caching: Optimized quote & history caching
- Bundling: Turbopack for 5-10x faster builds
- π Report Bugs: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: support@alphasight.ai
This project is licensed under the MIT License. See LICENSE for details.
- Mistral AI - LLM & embedding provider
- Supabase - Database & auth backend
- Vercel - Deployment infrastructure
- Next.js & React - Core framework & library
- Community Contributors - All developers who contributed to this project
β If you find this useful, please give us a star on GitHub