Skip to content

1234-ad/RepoChat

Β 
Β 

Repository files navigation

RepoChat πŸ€–

AI-powered GitHub repository analyzer and chat interface built with Next.js, tRPC, and Google Gemini AI

Next.js TypeScript tRPC Prisma License

πŸ“‹ Overview

RepoChat is an intelligent repository management system that allows you to:

  • πŸ”— Connect GitHub repositories
  • πŸ€– AI-powered commit summarization using Google Gemini
  • πŸ“Š Automatic code analysis and embeddings
  • πŸ’¬ Interactive Q&A about your codebase
  • πŸ“ˆ Visual commit history and insights
  • πŸ” Secure authentication with Clerk

✨ Features

Core Functionality

  • Repository Integration: Seamlessly connect and index GitHub repositories
  • AI Commit Summaries: Automatically generate human-readable commit summaries
  • Code Embeddings: Vector-based code search using semantic understanding
  • Real-time Updates: Automatic polling for new commits
  • Project Dashboard: Visual overview of all your connected repositories
  • Meeting Transcription: (Coming soon) Record and analyze development meetings

Technical Highlights

  • Type-safe API: End-to-end type safety with tRPC
  • Modern UI: Beautiful interface built with shadcn/ui components
  • Responsive Design: Optimized for desktop and mobile devices
  • Database: PostgreSQL with Prisma ORM and pgvector extension
  • Authentication: Secure user management with Clerk

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn/pnpm
  • PostgreSQL database with pgvector extension
  • GitHub account and personal access token
  • Google Gemini API key
  • Clerk account for authentication

Installation

  1. Clone the repository
git clone https://github.com/yourusername/repochat.git
cd repochat
  1. Install dependencies
npm install
# or
pnpm install
# or
yarn install
  1. Set up environment variables

Create a .env file in the root directory:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/repochat?schema=public"

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxx
CLERK_SECRET_KEY=sk_test_xxxxx
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up

# GitHub
GITHUB_TOKEN=ghp_xxxxx

# Google Gemini AI
GEMINI_API_KEY=xxxxx

# Node Environment
NODE_ENV=development
  1. Set up the database
# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev

# (Optional) Open Prisma Studio
npx prisma studio
  1. Run the development server
npm run dev
# or
pnpm dev
# or
yarn dev

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

Running with Docker

If you prefer to run the database and app in Docker for development, this repository includes a simple docker-compose.yml and Dockerfile to get you started.

Quick steps (PowerShell on Windows):

  1. Copy your env file and fill in secrets (do not commit it):
Copy-Item .env.example .env
# Edit .env and replace tokens/keys with your local secrets
  1. Start Postgres and the app (start only db and app to save memory):
# Start DB and app
docker-compose up -d --build db app

# (Optional) start everything including pgAdmin
docker-compose up -d --build
  1. Follow logs:
docker-compose logs -f app
docker-compose logs -f db

οΏ½πŸ“ Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (protected)/        # Protected routes
β”‚   β”‚   β”œβ”€β”€ dashboard/      # Main dashboard
β”‚   β”‚   β”œβ”€β”€ qa/            # Q&A interface
β”‚   β”‚   β”œβ”€β”€ meetings/      # Meeting management
β”‚   β”‚   └── create/        # Project creation
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── trpc/          # tRPC API routes
β”‚   β”œβ”€β”€ sign-in/           # Authentication pages
β”‚   └── sign-up/
β”œβ”€β”€ components/
β”‚   └── ui/                # shadcn/ui components
β”œβ”€β”€ hooks/                 # Custom React hooks
β”œβ”€β”€ lib/                   # Utility functions
β”‚   β”œβ”€β”€ gemini.ts         # AI integration
β”‚   β”œβ”€β”€ github.ts         # GitHub API
β”‚   └── github-loader.ts  # Repository indexing
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ routers/      # tRPC routers
β”‚   β”‚   └── trpc.ts       # tRPC configuration
β”‚   └── db.ts             # Prisma client
└── styles/
    └── globals.css       # Global styles

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS v4
  • UI Components: shadcn/ui (New York style)
  • Icons: Lucide React
  • Forms: React Hook Form

Backend

  • API: tRPC v11
  • Database: PostgreSQL with Prisma ORM
  • Vector Search: pgvector extension
  • Authentication: Clerk
  • AI/ML: Google Gemini AI

Development

  • Code Quality: ESLint + TypeScript ESLint
  • Formatting: Prettier
  • Package Manager: pnpm/npm/yarn

πŸ”‘ Key Features Explained

1. Repository Indexing

When you connect a repository, RepoChat:

  • Clones and analyzes the codebase
  • Generates AI summaries for each file
  • Creates vector embeddings for semantic search
  • Stores structured data in PostgreSQL

2. Commit Summarization

  • Automatically fetches new commits
  • Analyzes git diffs
  • Generates concise, human-readable summaries
  • Displays commit history with author info

3. AI-Powered Q&A

  • Ask questions about your codebase
  • Get context-aware answers
  • Search through commit history
  • Understand code relationships

πŸ“ API Routes

Project Management

  • POST /api/trpc/project.createProject - Create a new project
  • GET /api/trpc/project.getProjects - Get all user projects
  • GET /api/trpc/project.getCommits - Get project commits

🎨 UI Components

RepoChat uses shadcn/ui components with the New York style variant:

  • Sidebar navigation
  • Cards and layouts
  • Forms and inputs
  • Buttons and dialogs
  • Tables and data display

πŸ”’ Security

  • Server-side authentication with Clerk
  • Environment variable validation with Zod
  • Protected API routes with middleware
  • Secure database queries with Prisma

πŸ› Troubleshooting

Common Issues

Database Connection Error

  • Ensure PostgreSQL is running
  • Check DATABASE_URL in .env
  • Verify pgvector extension is installed

GitHub API Rate Limit

  • Use a personal access token
  • Implement exponential backoff
  • Consider caching responses

AI Summarization Fails

  • Check GEMINI_API_KEY is valid
  • Verify API quota limits
  • Review error logs for details

πŸ“š Documentation

🀝 Contributing

We welcome contributions! Please see CONTRIBUTORS.md for guidelines.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“§ Contact

For questions or support, please open an issue on GitHub or contact the maintainers.


Made with ❀️ by the RepoChat team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.2%
  • CSS 1.9%
  • JavaScript 1.5%
  • Shell 1.3%
  • Dockerfile 0.1%