Skip to content

adeenae/bearbot

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

143 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 AlphaSight AI

AlphaSight Logo

AI-Powered Market Intelligence Workspace

Real-time portfolio insights Β· AI-driven analysis Β· Seamless streaming chat

Next.js 16 React 19 TypeScript Supabase Mistral AI

License MIT GitHub Stars


✨ Core Capabilities

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

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    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)                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Tech Stack

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 (Large, Small) Context-aware AI responses & embeddings
Market Data Yahoo Finance API Real-time quotes & historical data
News MarketAux, NewsData, Yahoo RSS Multi-source news aggregation
Deployment Vercel Serverless, edge-optimized hosting

πŸ“‚ Project Structure

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

🎯 Intelligence & UX Innovations

1. Context-Linked Follow-Ups

Queries like "tell me about ITC" β†’ "tell me about that" are resolved to standalone intent before routing, enabling natural multi-turn conversations.

2. Web-Search Grounding

Query rewrite path improves retrieval quality and reduces literal bad searches, ensuring every search is contextually relevant.

3. Transparent AI Activity Monitor

  • 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

4. No Hallucination Style

Prompts enforce use of available search/context instead of "not in training data" responses, keeping all answers grounded in live data.

5. Live Settings Application

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.

6. Semantic Memory System

  • 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

βš™οΈ Getting Started

Prerequisites

  • Node.js 18+ or 20+
  • npm or yarn
  • Supabase project (free tier available)
  • Mistral API key

1. Clone & Install

git clone https://github.com/Eshwar02/bearbot.git
cd bearbot
npm install

2. Environment Setup

Create .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 Provider (required)
MISTRAL_API_KEY=your-mistral-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

3. Database Setup

# Supabase CLI (optional but recommended)
supabase start

# Or manually: run supabase/schema.sql in your Supabase SQL editor

4. Run Locally

npm run dev

Open http://localhost:3000 and sign up.

5. Production Deployment

npm run build
npm run start

Deploy to Vercel:

vercel deploy

πŸ“š Available Scripts

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

πŸ”Œ API Reference

Chat & Intelligence

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

Portfolio Management

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

Market Data

Endpoint Method Purpose Auth
/api/stock/quote GET Real-time stock quote Optional
/api/stock/search GET Symbol/company search Optional

Watchlist & Reports

Endpoint Method Purpose Auth
/api/watchlist GET, POST, DELETE Manage watchlist Required
/api/daily-brief GET, POST Fetch or generate daily brief Required

🌟 Recent Updates

Latest Features (v1.2.0)

  • βœ… Memory Capture Improvements - Enhanced semantic extraction & reliability
  • βœ… Chat Intelligence Refinements - Coreference resolution, multi-turn grounding, and AI-generated chat titles
  • βœ… Typography Refresh - Native OS body font stack with Fraunces serif headlines
  • βœ… Transparency Monitor - Phase tracking, source deduplication, and clearer progress UI
  • βœ… Light Mode Support - CSS variable tokens across settings, profile, portfolio, and brief screens
  • βœ… Live Settings - Instant theme, chart, and notification toggles
  • βœ… Auth Redirects - Canonical domain support
  • βœ… Password Reset - Supabase forgot-password flow
  • βœ… Profile Management - Email verification & password updates

Recent Commits

15750ed - feat(ui): use native OS font stack for body, drop Geist sans webfont
340551f - fix: light mode tokens for settings, profile, error, portfolio-summary, add-holding-modal, schedule-settings
e276001 - feat(ui): swap to Fraunces serif and fix sidebar quick-access active state
0898afe - feat(chat): AI-generated chat titles with typewriter animation + new typography
37c03ef - feat: full light mode support with CSS variable tokens

🀝 Contributing

We welcome contributions! Here's how to get started:

1. Fork the Repository

# Click "Fork" on GitHub
git clone https://github.com/YOUR_USERNAME/bearbot.git
cd bearbot

2. Create a Feature Branch

git checkout -b feature/your-feature-name

3. Make Your Changes

  • Follow ESLint rules: npm run lint
  • Write tests if applicable
  • Keep commits atomic and descriptive

4. Commit & Push

git commit -m "feat: add your feature description"
git push origin feature/your-feature-name

5. Open a Pull Request

  • Describe what your PR does
  • Reference any related issues
  • Request review from maintainers

πŸ” Security & Privacy

  • 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

πŸ“Š Performance & Scalability

  • 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

πŸ“ž Support & Feedback


πŸ“œ License

This project is licensed under the MIT License. See LICENSE for details.


πŸ™ Acknowledgments

  • 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

Made with ❀️ by the AlphaSight AI team

⭐ If you find this useful, please give us a star on GitHub

About

AlphaSight AI is an intelligent stock market copilot that delivers deep company analysis, portfolio memory, geopolitical risk mapping, and AI-powered final verdicts for smarter investing decisions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 96.4%
  • PLpgSQL 1.6%
  • JavaScript 1.1%
  • CSS 0.9%