Skip to content

ankitk26/baychat

Repository files navigation

baychat

baychat is an open-source AI chatbot application built with TanStack Start, Convex, and the Vercel AI SDK.
It supports multiple AI providers, real-time messaging, and chat organization.

Features

AI Model Support

  • Google Gemini
  • OpenAI
  • Anthropic
  • OpenRouter
  • BYOK (Bring your own API keys)

Chat Management

  • Real-time streaming responses
  • Organize chats with folders
  • Pin or branch conversations
  • Share chats with others
  • Edit or regenerate messages

UI

  • Light and dark themes
  • Code syntax highlighting (Shiki)
  • Math rendering (KaTeX)
  • Markdown support

Image Generation

  • Generate images from text prompts
  • Support for multiple image generation models
  • Download and share generated images

Authentication

  • GitHub and Google OAuth (via Better Auth)

Tech Stack

Frontend

  • TanStack Start (full-stack React framework)
  • TanStack Query (server state management)
  • ShadCN (UI components)
  • Zustand (client state management)

Backend

  • Convex (real-time database and backend)
  • Better Auth (authentication library)
  • Vercel AI SDK (AI model integration)
  • Zod (schema validation)

AI Providers

  • OpenAI (GPT models)
  • Anthropic (Claude models)
  • Google (Gemini models)
  • xAI (Grok models)
  • OpenRouter (unified AI API)
  • BYOK support for all above providers

Development

  • Oxlint for linting and Oxfmt for formatting

Installation

Prerequisites

  • Node.js 18+
  • Any package manager (bun used here)
  • Git

Setup

  1. Clone the repository:

    git clone https://github.com/ankitk26/baychat.git
    cd baychat
  2. Install dependencies:

    bun install
  3. Set up Convex:

    npx convex dev

    Follow the prompts to create a new Convex project and get your deployment URL.

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

    # Convex (Required)
    CONVEX_DEPLOYMENT=dev:your_project_name
    VITE_CONVEX_URL=https://your_project_url.convex.cloud
    VITE_CONVEX_SITE_URL=https://your_project_url.convex.site
    
    # Site URL (Required)
    VITE_SITE_URL=http://localhost:3000
    
    # BetterAuth (Required for authentication)
    BETTER_AUTH_SECRET=your_better_auth_secret
    
    # GitHub OAuth (Required for authentication)
    GITHUB_CLIENT_ID=your_github_client_id
    GITHUB_CLIENT_SECRET=your_github_client_secret
    
    # Google OAuth (Required for authentication)
    GOOGLE_CLIENT_ID=your_google_client_id
    GOOGLE_CLIENT_SECRET=your_google_client_secret
    
    # Optional: API keys for AI providers
    GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key
    ANTHROPIC_API_KEY=your_anthropic_api_key
  5. Run the development server:

    bun run dev
  6. Open your browser and navigate to http://localhost:3000

Usage

  1. Sign in with your GitHub or Google account
  2. Configure API keys in settings (optional - you can use OpenRouter for all models)
  3. Start chatting with any available AI model
  4. Organize chats by creating folders and pinning important conversations

Support