An AI-powered RAG (Retrieval-Augmented Generation) web app that lets you chat with your JavaScript codebase using OpenAI's GPT and vector embeddings.
- 🤖 AI Code Analysis - Chat with ChatGPT about your code
- 🔍 Semantic Search - Uses cosine similarity to find relevant code segments
- 📦 Codebase Upload - Upload JavaScript projects via .zip file URLs
- 💾 Session Persistence - Conversation history cached in Redis
- 🎯 RAG Pipeline - Retrieves relevant code context before generating responses
- Frontend: Next.js, React, TailwindCSS
- Backend: Next.js API Routes
- LLM: OpenAI GPT-4
- Vector DB: Pinecone
- Cache: Redis
- Code Parsing: Tree-sitter
- Node.js 16+
- npm or yarn
- OpenAI API key (with billing enabled)
- Pinecone API key
- Redis instance (Redis Cloud recommended)
-
Clone or download this repository
-
Install dependencies
npm install
-
Create
.env.localwith your API keys:OPENAI_API_KEY=sk-proj-... PINECONE_API_KEY=pcsk_... REDIS_HOST=your-redis-host.com REDIS_PORT=10420 REDIS_PASSWORD=your-password NEXT_PUBLIC_URL=http://localhost:3000
-
Run development server
npm run dev
-
Open http://localhost:3000 in your browser
- Paste a direct link to a .zip file in the top input box
- The app will download, extract, and index your JavaScript files
- Embeddings are generated and stored in Pinecone
- Regular messages: Press
Enterto chat with ChatGPT - Query codebase: Click
Query codebasebutton to:- Find the 3 most relevant code segments using cosine similarity
- Include those segments in the ChatGPT context
- Get an informed answer about your code
- Currently supports JavaScript (.js) files only
- One codebase per session (upload a new one to replace the current)
| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI API key for ChatGPT access |
PINECONE_API_KEY |
Pinecone vector database API key |
REDIS_HOST |
Redis host URL |
REDIS_PORT |
Redis port number |
REDIS_PASSWORD |
Redis password |
NEXT_PUBLIC_URL |
Frontend URL (for API calls) |
src/
├── app/
│ ├── chat/route.js # Chat endpoint
│ ├── config/ # Configuration files
│ ├── database/ # Database & embedding services
│ ├── codebase/route.js # Codebase upload/query endpoint
│ └── page.js # Main page
├── components/ # React components
└── utils/ # Utility functions
POST /chat- Send a message to ChatGPTPOST /codebase- Upload a codebaseGET /codebase- Get current codebase infoDELETE /codebase- Remove current codebaseGET /config/seed- Seed database configuration
- Only JavaScript files are indexed
- One codebase per session
- Requires active OpenAI billing
- Tree-sitter parsing limited to JavaScript syntax
- Support for multiple programming languages
- Multi-codebase session support
- Custom system prompts
- Code summary generation
- Performance optimizations
MIT
For issues or questions, check the OpenAI Docs or Pinecone Docs.