Skip to content

Latest commit

Β 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kirboreo AI

Tech-driven investment research platform combining institutional-grade analysis with cutting-edge AI technology.

Next.js TypeScript License

Kirboreo Limited is a Hong Kong-based investment research firm dedicated to decoding the complex world of global technology equities. This platform delivers hedge-fund-grade insights with engineering precision through an AI-powered research interface.


πŸš€ Features

  • πŸ€– AI Chat Interface: RAG-powered conversational AI using GPT-4o and Pinecone vector database
  • πŸ“Š Real-Time Stock Analysis: Live market data and technical analysis for US tech stocks
  • πŸ“ Research Library: Curated equity research powered by Sanity CMS
  • πŸ“ˆ Interactive Charts: Multi-timeframe stock visualizations with Recharts
  • 🎨 Modern UI: Glass-morphism design with 3D backgrounds using Three.js

πŸ“‹ Tech Stack

Core Framework

  • Next.js 15 (App Router) - React framework with server components
  • TypeScript - Type-safe development
  • React 19 - Latest React features

AI & Data

  • OpenAI GPT-4o - Chat completion and reasoning
  • OpenAI Embeddings (text-embedding-3-small) - Semantic search
  • Pinecone - Vector database for RAG (index: knowledge)
  • Vercel AI SDK - Streaming responses and tool integration

Content & Data Sources

  • Sanity.io - Headless CMS for research content
  • Yahoo Finance (yahoo-finance2) - Real-time market data

UI & Visualization

  • CSS Modules + Tailwind CSS - Styling
  • Recharts - Stock charts and data visualization
  • React Three Fiber - 3D backgrounds and effects
  • Lucide React - Icon library

πŸ—οΈ Project Structure

Kirboreo/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── chat/
β”‚   β”‚       └── route.ts      # RAG-powered chat API endpoint
β”‚   β”œβ”€β”€ chat/
β”‚   β”‚   └── page.tsx          # Chat interface
β”‚   β”œβ”€β”€ analysis/
β”‚   β”‚   └── [ticker]/         # Dynamic stock analysis pages
β”‚   β”œβ”€β”€ research/
β”‚   β”‚   └── [slug]/           # Research article pages
β”‚   β”œβ”€β”€ about/                # About page
β”‚   β”œβ”€β”€ studio/               # Embedded Sanity Studio
β”‚   β”œβ”€β”€ layout.tsx            # Root layout
β”‚   └── page.tsx              # Homepage
β”‚
β”œβ”€β”€ components/               # React components
β”‚   β”œβ”€β”€ ChatWidget.tsx        # Floating chat component
β”‚   β”œβ”€β”€ StockAnalysis.tsx     # Stock chart & metrics
β”‚   β”œβ”€β”€ Hero.tsx              # Landing hero section
β”‚   β”œβ”€β”€ Navbar.tsx            # Navigation
β”‚   β”œβ”€β”€ FeaturedReports.tsx   # Latest research
β”‚   β”œβ”€β”€ Background3D.tsx      # Three.js background
β”‚   └── ui/                   # Reusable UI components
β”‚
β”œβ”€β”€ lib/                      # Core utilities
β”‚   β”œβ”€β”€ vector-store.ts       # Pinecone integration
β”‚   β”œβ”€β”€ yahoo.ts              # Stock data fetching
β”‚   └── utils.ts              # Helper functions
β”‚
β”œβ”€β”€ sanity/                   # Sanity CMS configuration
β”‚   β”œβ”€β”€ schemaTypes/          # Content models
β”‚   β”‚   β”œβ”€β”€ postType.ts       # Research articles
β”‚   β”‚   β”œβ”€β”€ stockAnalysisType.ts
β”‚   β”‚   └── ...
β”‚   └── lib/
β”‚       β”œβ”€β”€ client.ts         # Sanity client
β”‚       └── queries.ts        # GROQ queries
β”‚
β”œβ”€β”€ scripts/                  # Utility scripts
β”‚   └── index-sanity-data.ts  # Sync content to Pinecone
β”‚
β”œβ”€β”€ __tests__/                # Test suites
β”‚   β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ components/
β”‚   └── lib/
β”‚
└── public/                   # Static assets

πŸ”§ Setup & Installation

Prerequisites

  • Node.js 18+ and npm
  • OpenAI API key
  • Pinecone account (free tier works)
  • Sanity.io project

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/Kirboreo.git
cd Kirboreo

2. Install dependencies

npm install

3. Configure environment variables

Create a .env.local file in the root directory:

# OpenAI
OPENAI_API_KEY=sk-...

# Pinecone
PINECONE_API_KEY=pcsk_...
PINECONE_INDEX_NAME=knowledge

# Sanity CMS
NEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id
NEXT_PUBLIC_SANITY_DATASET=production
SANITY_API_TOKEN=sk...

4. Initialize Pinecone index

Ensure your Pinecone index has:

  • Dimension: 1536 (for text-embedding-3-small)
  • Metric: Cosine similarity
  • Region: Asia-Pacific (recommended for Hong Kong)

5. Seed data (optional)

Index your Sanity content into Pinecone:

npm run index-data
# or manually:
npx tsx scripts/index-sanity-data.ts

6. Run development server

npm run dev

Open http://localhost:3000 in your browser.


πŸ§ͺ Testing

Run the test suite:

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Watch mode
npm run test:watch

Test structure:

  • __tests__/api/ - API route tests
  • __tests__/components/ - Component unit tests
  • __tests__/lib/ - Utility function tests
  • __tests__/integration/ - End-to-end tests

🚒 Deployment

Deploy to Vercel (Recommended)

This project uses React 19. The .npmrc configuration with legacy-peer-deps=true is already set up to avoid peer dependency conflicts.

  1. Push to GitHub:
git add .
git commit -m "Ready for production"
git push origin main
  1. Import to Vercel:
    • Visit vercel.com
    • Click "Add New Project"
    • Import your GitHub repository
    • Configure environment variables (same as .env.local)
    • Deploy!

Environment Variables to Configure:

  • OPENAI_API_KEY - OpenAI API key
  • PINECONE_API_KEY - Pinecone API key
  • PINECONE_INDEX_NAME - Pinecone index name (default: knowledge)
  • NEXT_PUBLIC_SANITY_PROJECT_ID - Sanity project ID
  • NEXT_PUBLIC_SANITY_DATASET - Sanity dataset (default: production)
  • SANITY_API_TOKEN - Sanity API token
  • RESEND_API_KEY - (Optional) Resend API key for contact form
  1. Region Configuration (Optional): The vercel.json file is configured for Hong Kong, Singapore, and Seoul regions with optimized function settings:
  • Function timeout: 60 seconds
  • Memory: 1024MB

Alternative: Docker

docker build -t kirboreo .
docker run -p 3000:3000 --env-file .env.local kirboreo

Post-Deployment Checklist

  • Verify homepage loads
  • Test AI chat at /chat
  • Check stock analysis pages
  • Verify research articles load
  • Test contact form (if RESEND_API_KEY configured)
  • Monitor Vercel Analytics for performance

πŸ›οΈ Architecture

RAG (Retrieval-Augmented Generation) Pipeline

User Query
    ↓
1. Embed query (OpenAI text-embedding-3-small)
    ↓
2. Retrieve top-K contexts (Pinecone vector search)
    ↓
3. Inject context into system prompt
    ↓
4. Generate response (GPT-4o)
    ↓
5. Stream response to client

Implementation: app/api/chat/route.ts

Stock Data Flow

User selects ticker/timeframe
    ↓
Server Action (app/actions/stock.ts)
    ↓
Yahoo Finance API
    ↓
Transform & cache
    ↓
Render chart (Recharts)

πŸ“Š Data Sources

Source Purpose Update Frequency
Yahoo Finance Stock prices, charts Real-time
Sanity CMS Research articles Manual publish
Pinecone Vector search context Indexed on content update
OpenAI Embeddings, chat API call

🎯 Key Features Explained

1. AI Chat with RAG

  • Context-aware responses: Retrieves relevant research content before answering
  • Streaming: Real-time response generation
  • Graceful degradation: Falls back to general knowledge if no context found

2. Stock Analysis

  • Multi-timeframe support: 1d, 5d, 1mo, 6mo, ytd, 1y, 5y
  • Intraday data: 15-minute intervals for recent data
  • Related research: Auto-links to relevant articles from Sanity

3. Research Library

  • Full-text search: Powered by Sanity's GROQ queries
  • Category filtering: Tech sectors (AI, Cloud, SaaS, etc.)
  • Rich content: Block content with code snippets, images, tables

πŸ” Security

  • βœ… API keys stored in environment variables only
  • βœ… Server-side API calls (no client-side key exposure)
  • βœ… Input validation and sanitization
  • βœ… Rate limiting on API routes (Vercel default)
  • βœ… HTTPS enforced in production

πŸ›£οΈ Roadmap

  • Real-time alerts for stock movements
  • User authentication and saved watchlists
  • Advanced charting (technical indicators)
  • Multi-language support (English, Chinese)
  • Mobile app (React Native)
  • Backtesting framework for strategies

πŸ“„ License

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


πŸ§ͺ AI Labs

The platform includes experimental AI features in the /labs section:

FOMO Meter

Real-time sentiment analysis for stocks and cryptocurrencies powered by:

  • Yahoo Finance: News and price data
  • GPT-4o: AI-driven sentiment analysis with witty commentary
  • Keyword Analysis: Per-headline sentiment indicators

Features:

  • Dynamic background colors based on sentiment (Fear/Greed scale)
  • Thermometer visualization (0-100 scale)
  • Smart ticker resolution (company name β†’ ticker symbol)
  • News filtering for relevant headlines only
  • 5-minute caching with rate limiting

Try it: Visit /labs/fomo-meter and enter a ticker (e.g., TSLA, BTC-USD, AAPL)


πŸ‘₯ Contributing

Contributions are welcome! Please follow these guidelines:

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Ensure all tests pass: npm test
  5. Commit using Conventional Commits:
    • feat: - New features
    • fix: - Bug fixes
    • docs: - Documentation updates
    • test: - Test additions
    • refactor: - Code refactoring
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Code Standards

  • Use TypeScript with explicit types
  • Write tests for new features (aim for >80% coverage)
  • Follow existing code style
  • Add JSDoc comments for public APIs
  • Ensure npm run build and npm run lint pass

πŸ“§ Contact

Kirboreo Limited
Central, Hong Kong
Email: contact@kirboreo.com
Website: kirboreo.com


πŸ™ Acknowledgments


Built with ❀️ by Jingcheng Su
Where Silicon Valley Engineering Meets Wall Street Rigor

About

Kirboreo Limited Official Website

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages