Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 198 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,235 @@
# T3 Chat Clone Setup
# T3 Chat Clone

A modern AI-powered chatbot with file search and web search.
<div align="center">

This project uses [pnpm](https://pnpm.io/) for dependency management. Install it globally if you don't have it.
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/heymaaz/t3.chat.cloneathon)

## Quick Start
_A modern AI-powered chatbot with intelligent file search and real-time web search capabilities. Try it out at https://t3chatcloneathon.netlify.app_

[Features](#-features) • [Quick Start](#-quick-start) • [Self Hosting](#️-self-hosting) • [Usage](#-usage) • [Tech Stack](#️-tech-stack)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix broken navigation anchors
The link fragments (e.g., #-features, #️-self-hosting) don’t match the actual heading slugs that include emojis. Either remove emojis from headings (e.g., ## Features) or update anchors to #✨-features, #🏗️-self-hosting, etc., to ensure proper in-page navigation.

🤖 Prompt for AI Agents
In README.md at line 9, the navigation anchor links do not match the actual
heading slugs because the headings include emojis. To fix this, update the
anchor links to include the corresponding emojis exactly as they appear in the
headings, such as changing `#-features` to `#✨-features` and `#️-self-hosting`
to `#🏗️-self-hosting`, ensuring the anchors correctly link to the sections.


</div>

---

## ✨ Features

### 🔍 **Intelligent File Search**

- **Multi-format support**: PDF, TXT, DOCX
- **AI-powered citations**: Click on file references to preview documents
- **Contextual understanding**: Conversation-specific vector stores
- **Smart indexing**: Automatic document processing and search optimization

### 🌐 **Real-time Web Search**

- **Toggle control**: Enable/disable web search per message
- **Live information**: Access current data and recent events
- **Source citations**: Clickable links to original sources
- **Combined search**: Seamlessly merge file and web results

### 💬 **Advanced Chat Experience**

- **Streaming responses**: Real-time AI interaction
- **Conversation memory**: Persistent chat history
- **Auto-generated titles**: Smart conversation naming
- **Modern UI**: Clean, responsive design with dark/light themes

---

## 🚀 Quick Start

### Prerequisites

- [Node.js 18+](https://nodejs.org/) (`nvm install 18 && nvm use 18`)
- [pnpm](https://pnpm.io/) (install globally: `npm install -g pnpm`)

### Installation

```bash
# Clone the repository
git clone <repository-url>
cd chatbot_using_convex
cd <repo-directory>

# Install dependencies
pnpm install
cp .env.example .env.local
# edit .env.local with your Convex keys
# Add your OpenAI API key to convex dashboard
npx convex env set CONVEX_OPENAI_API_KEY {YOUR_CONVEX_OPENAI_API_KEY}

# Set up environment variables
npx convex dev
```
Comment thread
heymaaz marked this conversation as resolved.

### Development

```bash
# Option 1: Cloud Convex (recommended for production)
pnpm dev

# Option 2: Local Convex (for development)
# Terminal 1:
npx convex dev
# Terminal 2:
pnpm dev:noconvex
```

The `dev` script spins up both the Vite frontend and Convex backend.
Open [http://localhost:5173](http://localhost:5173) in your browser.

---

## 🏗️ Self Hosting

### Environment variables
### Using Local Convex

`.env.example` contains the variables required to run the app:
Perfect for development and testing:

```text
CONVEX_DEPLOYMENT=your-convex-deployment
VITE_CONVEX_URL=your-vite-convex-url
```bash
# Ensure Node.js 18
nvm install 18 && nvm use 18

# Install dependencies
pnpm install

# Start local Convex backend
npx convex dev
# Follow the prompts:
# ✓ Start without an account (run Convex locally)
# ✓ Choose "new" project
# ✓ Name your project (e.g., "cloneathalon")

# In a new terminal, start the frontend
nvm use 18
Comment thread
coderabbitai[bot] marked this conversation as resolved.
pnpm dev:noconvex
```

Copy this file to `.env.local` and fill in your own values.
### Cloud Deployment

#### Deploy to Netlify

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/heymaaz/t3.chat.cloneathon)

#### Manual Deployment

```bash
# Build for production
pnpm build

# Deploy the dist/ folder to your hosting provider
```

---

## 📖 Usage

### 🔍 Web Search

1. Click the **search icon (🔍)** next to the attachment button
2. When enabled, the button highlights in **blue**
3. Messages show **"Web search enabled"** indicator
4. AI responses include **clickable web citations**

### Common scripts
### 📁 File Upload

- `pnpm dev` – start the frontend and backend in development mode
- `pnpm build` – build the production bundle
- `pnpm lint` – run ESLint
- `pnpm typecheck` – run TypeScript type checks
- `pnpm format` – run prettier checks and fixes
- `pnpm format:check` – run prettier checks without fixing
1. Click the **plus (+) button** to upload files
2. **Drag & drop** or browse for supported formats
3. Files are **automatically indexed** for intelligent search
4. AI provides **clickable citations** with document previews

## Features
### 💡 Pro Tips

### File Search
- **Combine searches**: Use both file and web search for comprehensive answers
- **Citation preview**: Click any file citation to view the referenced content
- **Conversation context**: Files remain available throughout the chat session

- Upload and search through documents (PDF, TXT, DOC, DOCX, MD)
- AI can reference specific files and provide citations
- **Clickable citations** - Click on file citations to preview the referenced document
- Conversation-specific vector stores for context
---

### Web Search
## 🛠️ Tech Stack

- Toggle web search on/off for individual messages
- AI can search the web for real-time information
- Web results are cited with clickable links
- Combine with file search for comprehensive answers
### Frontend

### Real-time Chat
- **React 19** - Modern UI library with latest features
- **TypeScript** - Type-safe development
- **Vite** - Lightning-fast build tool
- **Tailwind CSS** - Utility-first styling
- **Tanstack Router** - Type-safe routing

- Streaming AI responses
- Message history per conversation
- Automatic conversation title generation
### Backend

- **Convex** - Real-time database and backend platform
- **Convex Auth** - Secure authentication system

### AI & Search

- **OpenAI GPT-4.1** - Advanced language model
- **OpenAI Responses API** - Streaming responses, file search and web search
- **Vector Stores** - Intelligent document search
- **Web Search API** - Real-time information retrieval
- **OpenRouter** - API for Anthropic, xAI, Google and more models

### Development Tools

- **ESLint** - Code linting and quality
- **Prettier** - Code formatting
- **Vitest** - Unit testing framework
- **TypeScript** - Static type checking

---

## 📋 Available Scripts

| Command | Description |
| ------------------- | ------------------------------------------- |
| `pnpm dev` | Start frontend + cloud Convex backend |
| `pnpm dev:noconvex` | Start frontend only (requires local Convex) |
| `pnpm build` | Build production bundle |
| `pnpm lint` | Run ESLint checks |
| `pnpm typecheck` | Run TypeScript validation |
| `pnpm format` | Format code with Prettier |
| `pnpm format:check` | Check code formatting |
| `pnpm test` | Run test suite |

---

### Project Structure

```
<repo-directory>/
├── src/ # Frontend React application
│ ├── components/ # Reusable UI components
│ ├── pages/ # Application pages
│ └── lib/ # Utilities and helpers
├── convex/ # Backend Convex functions
│ ├── schema.ts # Database schema
│ └── *.ts # API functions and mutations
└── public/ # Static assets
```

## Usage
---

### Web Search
## 🤝 Contributing

1. Click the search icon (🔍) next to the attachment button to enable web search
2. When enabled, the button will be highlighted in blue
3. Your messages will show "Web search enabled" indicator
4. AI responses will include web citations when relevant
1. **Fork** the repository
2. **Create** your feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request

### File Upload
### Development Guidelines

1. Click the plus (+) button to upload files
2. Supported formats: PDF, TXT, DOC, DOCX, MD
3. Files are automatically indexed for search
4. AI can reference and cite uploaded documents
- Run `pnpm lint`, `pnpm typecheck`, `pnpm format`, and `pnpm format:check` before committing
- Follow the existing code style and conventions
- Add tests for new features when applicable

## Technical Implementation
---

- **Frontend**: React with TypeScript, Tailwind CSS
- **Backend**: Convex for database and real-time updates
- **AI**: OpenAI GPT-4.1 with Responses API
- **File Search**: OpenAI Vector Stores
- **Web Search**: OpenAI Web Search Preview tool
## 📄 License

## Project structure
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

The frontend code is in the `src` directory and is built with [Vite](https://vitejs.dev/).
---

The backend code is in the `convex` directory.
<div align="center">

`pnpm dev` will start the frontend and backend servers.
**Built with ❤️ using modern web technologies**

## App authentication
[Report Bug](https://github.com/heymaaz/t3.chat.cloneathon/issues) • [Request Feature](https://github.com/heymaaz/t3.chat.cloneathon/issues)

[Convex Auth](https://auth.convex.dev/)
</div>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "convex dev --once && node setup.mjs && npm-run-all --parallel dev:frontend dev:backend",
"dev:noconvex": "node setup.mjs && npm-run-all --parallel dev:frontend dev:backend",
"dev:frontend": "vite --open",
"dev:backend": "convex dev",
"build": "vite build",
Expand Down