An intelligent AI-powered code review platform that automatically analyzes GitHub pull requests and provides comprehensive feedback, suggestions, and risk assessments. Built with Next.js, this application integrates with GitHub to streamline the code review process using advanced AI models.
- 🤖 Automated Code Reviews: Leverage AI (Google Gemini & OpenAI) to automatically review pull requests
- 🔐 GitHub Integration: Seamless authentication and repository synchronization
- 📊 Dashboard Analytics: Visualize review statistics, activity heatmaps, and risk scores
- 🎯 Risk Assessment: Intelligent scoring system to identify potential issues
- 💬 Inline Comments: AI-generated comments posted directly to GitHub PRs
- 🔄 Background Processing: Asynchronous review processing using Inngest
- 🌙 Dark Mode: Built-in theme support for comfortable viewing
- 📱 Responsive Design: Works seamlessly across desktop and mobile devices
- Framework: Next.js 16 with App Router
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- Authentication: Better Auth with GitHub OAuth
- AI Models: Google Gemini API & OpenAI API
- Background Jobs: Inngest
- API Layer: tRPC for type-safe APIs
- Styling: Tailwind CSS with Radix UI components
- State Management: TanStack Query (React Query)
- Animations: Framer Motion & React Spring
Before you begin, ensure you have the following installed:
- Node.js 20.x or higher
- pnpm (recommended) or npm
- PostgreSQL database
- GitHub OAuth App credentials
- Google Gemini API key or OpenAI API key
Create a .env file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/aicodereviewer"
# Authentication
BETTER_AUTH_SECRET="your-secret-key-here"
BETTER_AUTH_URL="http://localhost:3000"
# GitHub OAuth
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"
# AI API Keys (use at least one)
GOOGLE_GEMINI_API_KEY="your-gemini-api-key"
OPENAI_API_KEY="your-openai-api-key"
# Inngest
INNGEST_EVENT_KEY="your-inngest-event-key"
INNGEST_SIGNING_KEY="your-inngest-signing-key"-
Clone the repository:
git clone https://github.com/yourusername/aicodereviewer.git cd aicodereviewer -
Install dependencies:
pnpm install
-
Set up the database:
pnpm db:generate pnpm db:push
-
Run the development server:
pnpm dev
-
In a separate terminal, run Inngest dev server:
pnpm inngest:dev
-
Open http://localhost:3000 in your browser to see the application.
pnpm dev- Start the Next.js development serverpnpm inngest:dev- Start the Inngest development serverpnpm build- Build the application for productionpnpm build:full- Generate Prisma client and build the applicationpnpm start- Start the production serverpnpm lint- Run ESLint for code quality checkspnpm db:push- Push database schema changes to the databasepnpm db:generate- Generate Prisma Client
- Authentication: Users sign in with their GitHub account
- Repository Sync: The app syncs accessible GitHub repositories
- Webhook Integration: GitHub webhooks trigger reviews on new pull requests
- AI Analysis: Pull requests are analyzed using AI models (Gemini/OpenAI)
- Review Generation: AI generates comprehensive feedback with risk scores
- Comment Posting: Reviews are automatically posted back to GitHub
- Dashboard: Users can view all reviews, statistics, and activity
The application uses PostgreSQL with the following main models:
- User: User accounts with GitHub authentication
- Repository: Synced GitHub repositories
- Review: AI-generated code reviews with status tracking
- Session: User session management
- Account: OAuth account information
aicodereviewer/
├── prisma/ # Database schema and migrations
├── src/
│ ├── app/ # Next.js app router pages
│ │ ├── (auth)/ # Authentication pages
│ │ ├── (dashboard)/# Dashboard and repository pages
│ │ └── api/ # API routes and webhooks
│ ├── components/ # React components
│ ├── constant/ # Constants and configuration
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility libraries
│ └── server/ # Server-side code (tRPC routers, Inngest functions)
└── package.json
When a pull request is opened or updated, the system:
- Fetches the diff and file changes from GitHub
- Analyzes code patterns, potential bugs, and best practices
- Generates inline comments with suggestions
- Calculates a risk score based on complexity and potential issues
The dashboard provides:
- Overview of all reviewed pull requests
- Activity heatmap showing review frequency
- Statistics including total reviews, risk scores, and success rates
- Quick access to repository management
Uses Inngest for reliable background job processing:
- Asynchronous PR analysis to avoid blocking
- Retry logic for failed reviews
- Status tracking (PENDING → PROCESSING → COMPLETED/FAILED)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add your feature' - Push to the branch:
git push origin feature/your-feature - Open a pull request
This project is private and proprietary.
For issues or questions, please open an issue in the GitHub repository.