AI-Powered Code Review Assistant for GitHub
CodeRevU is an intelligent, automated code review platform that seamlessly integrates into your GitHub workflow. Powered by Google Gemini AI and RAG (Retrieval-Augmented Generation), it provides deep, context-aware analysis of your Pull Requests, helping teams maintain high code quality with zero friction.
Track your repositories, commits, pull requests, and AI-generated reviews at a glance
Visualize your contribution activity and monthly coding trends
Connect GitHub repositories with one click and manage webhook integrations
Flexible pricing tiers powered by Polar.sh with usage tracking
Manage your account, connected repositories, and preferences
View detailed AI-generated code reviews with file-by-file analysis, suggestions, and quality ratings
- π GitHub OAuth Integration: One-click authentication and repository connection
- π€ Automated AI Reviews: Listens for PR events via webhooks and automatically posts detailed, constructive code reviews
- π§ Context-Aware (RAG): Indexes your entire repository using vector embeddings to understand the broader context of changes, not just the diff
- π Dashboard & Analytics: Track review history, repository stats, contribution graphs, and monthly activity
- π³ Subscription Management: Tiered pricing with usage limits (Free, Pro) powered by Polar.sh
- π Secure & Scalable: Built with webhook signature validation, environment variable validation, and proper authentication/authorization
- β‘ Background Processing: Durable workflow execution with Inngest for reliable, long-running AI tasks
CodeRevU uses an event-driven architecture to handle asynchronous AI tasks reliably and scale efficiently.
graph TD
classDef user fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef app fill:#fff3e0,stroke:#e65100,stroke-width:2px;
classDef job fill:#f3e5f5,stroke:#4a148c,stroke-width:2px;
classDef data fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
classDef ext fill:#eceff1,stroke:#37474f,stroke-width:2px,stroke-dasharray:5 5;
User([Developer]):::user
GitHub([GitHub]):::ext
Gemini([Google Gemini AI]):::ext
Polar([Polar.sh]):::ext
subgraph "CodeRevU Platform"
WebApp[Next.js App Router<br/>Server Actions + API Routes]:::app
DB[(PostgreSQL<br/>Prisma ORM)]:::data
VectorDB[(Pinecone<br/>Vector Embeddings)]:::data
subgraph "Background Workers - Inngest"
Indexer[Repository Indexing<br/>Worker]:::job
Reviewer[AI Review Generation<br/>Worker]:::job
end
end
User -->|1. Authenticate| WebApp
WebApp -->|OAuth| GitHub
User -->|2. Connect Repo| WebApp
WebApp -->|Create Webhook| GitHub
WebApp -->|Trigger Event| Indexer
Indexer -->|Fetch Code| GitHub
Indexer -->|Generate Embeddings| Gemini
Indexer -->|Store Vectors| VectorDB
GitHub -->|3. PR Webhook| WebApp
WebApp -->|Trigger Event| Reviewer
Reviewer -->|Retrieve Context| VectorDB
Reviewer -->|Fetch PR Diff| GitHub
Reviewer -->|Generate Review| Gemini
Reviewer -->|Post Comment| GitHub
Reviewer -->|Save Review| DB
User -->|4. Subscribe| WebApp
WebApp -->|Checkout| Polar
Polar -->|Webhook| WebApp
WebApp -->|Update Tier| DB
- Authentication: Users authenticate via GitHub OAuth, granting repository access
- Repository Connection: Users connect repositories, triggering webhook creation and background indexing
- PR Review: When a PR is opened/updated, GitHub sends a webhook β Inngest worker fetches context from Pinecone β Gemini generates review β Posted as PR comment
- Subscription: Users can upgrade to Pro tier via Polar.sh for higher limits
- Next.js 16 (App Router) - React framework with server-side rendering
- React 19 - UI library with latest concurrent features
- TypeScript 5 - Type-safe development
- Tailwind CSS 4 - Utility-first styling
- shadcn/ui - Radix UI components with beautiful defaults
- TanStack Query - Data fetching and caching
- Recharts - Data visualization for analytics
- Next.js Server Actions - Type-safe server-side mutations
- Next.js API Routes - RESTful endpoints for webhooks
- Prisma 7 - Type-safe ORM with PostgreSQL adapter
- Better Auth - Modern authentication with GitHub OAuth
- Zod - Runtime type validation
- Google Gemini 2.5 Flash - Large language model for code review generation
- Pinecone - Vector database for semantic code search (RAG)
- Vercel AI SDK - Unified interface for AI model interactions
- Inngest - Durable workflow execution with retries, concurrency control, and observability
- Polar.sh - Developer-first payment platform with subscription management
- PostgreSQL - Relational database for user data, repositories, and reviews
- Vercel (recommended) - Deployment platform with edge functions
- ngrok (development) - Local webhook testing
CodeRevU combines AI-powered analysis with RAG (Retrieval-Augmented Generation) to provide context-aware code reviews that understand your entire codebase, not just the diff.
-
Long-Running AI Tasks: AI review generation can take 30-60 seconds, exceeding serverless function timeouts
- Solution: Inngest for durable workflow execution with automatic retries
-
Context Awareness: LLMs reviewing only the diff miss important context
- Solution: RAG pipeline that embeds entire codebase into Pinecone and retrieves relevant context
-
GitHub API Rate Limits: Recursive file fetching can exhaust rate limits
- Solution: Inngest concurrency controls and efficient batching
-
Webhook Security: Webhooks must be validated to prevent spoofing
- Solution: HMAC-SHA256 signature verification with timing-safe comparison
-
Multi-Tenant Architecture: Single webhook secret for all users
- Solution: Programmatic webhook creation via GitHub API with server-managed secret
CodeRevU/
βββ my-app/ # Main Next.js application
β βββ app/ # Next.js App Router
β β βββ (auth)/ # Auth route group (login, signup)
β β βββ api/ # API Routes
β β β βββ auth/[...all]/ # Better Auth endpoints
β β β βββ inngest/ # Inngest webhook endpoint
β β β βββ webhooks/github/ # GitHub webhook handler
β β βββ dashboard/ # Dashboard pages
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Landing page
β β
β βββ components/ # React components
β β βββ ui/ # shadcn/ui components
β β βββ providers/ # Context providers (Query, Theme)
β β βββ app-sidebar.tsx # Main navigation sidebar
β β
β βββ module/ # Feature modules (domain-driven design)
β β βββ ai/ # AI review logic
β β β βββ actions/ # Server actions (reviewPullRequest)
β β β βββ lib/ # RAG implementation
β β βββ auth/ # Authentication utilities
β β βββ dashboard/ # Dashboard data fetching
β β βββ github/ # GitHub API integration
β β β βββ lib/github.ts # Octokit wrapper (repos, webhooks, PRs)
β β βββ payment/ # Subscription management
β β β βββ actions/ # Checkout actions
β β β βββ config/ # Polar.sh client
β β β βββ lib/subscription.ts # Tier limits and usage tracking
β β βββ repository/ # Repository connection logic
β β β βββ actions/ # Connect/disconnect actions
β β β βββ hooks/ # React hooks for repo state
β β βββ review/ # Review history
β β βββ settings/ # User settings
β β
β βββ lib/ # Shared utilities
β β βββ auth.ts # Better Auth configuration
β β βββ db.ts # Prisma client singleton
β β βββ env.ts # Environment variable validation (Zod)
β β βββ pinecone.ts # Pinecone client
β β βββ utils.ts # Helper functions (cn, etc.)
β β βββ webhook-security.ts # HMAC signature verification
β β
β βββ inngest/ # Background job definitions
β β βββ client.ts # Inngest client configuration
β β βββ functions/ # Inngest functions
β β βββ index.ts # Function registry
β β βββ review.ts # PR review generation worker
β β
β βββ prisma/ # Database schema and migrations
β β βββ schema.prisma # Prisma schema (User, Repository, Review, etc.)
β β
β βββ public/ # Static assets
β βββ .env # Environment variables (gitignored)
β βββ .env.example # Environment template
β βββ next.config.ts # Next.js configuration
β βββ tailwind.config.ts # Tailwind configuration
β βββ tsconfig.json # TypeScript configuration
β
βββ CODE_REVIEW_CHECKLIST.md # Code review guidelines for team
βββ README.md # This file
- Node.js 18+ (or Bun)
- PostgreSQL database
- GitHub OAuth App (Create one)
- Pinecone Account (Sign up)
- Google AI API Key (Get key)
- Polar.sh Account (optional, for payments)
git clone https://github.com/your-username/CodeRevU.git
cd CodeRevU/my-appnpm install
# or
bun installCreate a .env file in the my-app directory (use .env.example as template):
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/coderevu"
# GitHub OAuth & Webhooks
GITHUB_CLIENT_ID="your_github_client_id"
GITHUB_CLIENT_SECRET="your_github_client_secret"
GITHUB_WEBHOOK_SECRET="generate_with_openssl_rand_hex_32"
# Application URLs
APP_BASE_URL="http://localhost:3000"
BETTER_AUTH_URL="http://localhost:3000/api/auth"
BETTER_AUTH_SECRET="generate_with_openssl_rand_hex_32"
NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000/api/auth"
# AI & Vector Database
GOOGLE_GENERATIVE_AI_API_KEY="your_google_ai_key"
PINECONE_API_KEY="your_pinecone_key"
PINECONE_INDEX_NAME="coderevu"
# Inngest (optional in dev)
INNGEST_EVENT_KEY="your_inngest_event_key"
INNGEST_SIGNING_KEY="your_inngest_signing_key"
# Polar.sh (optional)
POLAR_ACCESS_TOKEN="your_polar_token"
POLAR_WEBHOOK_SECRET="your_polar_webhook_secret"
POLAR_SUCCESS_URL="http://localhost:3000/dashboard/subscriptions?success=true"Generate secrets:
openssl rand -hex 32 # For GITHUB_WEBHOOK_SECRET
openssl rand -hex 32 # For BETTER_AUTH_SECRETnpx prisma migrate dev
npx prisma generateCreate a Pinecone index with:
- Dimensions: 768 (for Google text-embedding-004)
- Metric: Cosine similarity
- Name:
coderevu(or match yourPINECONE_INDEX_NAME)
Option A: Simple (Next.js only)
npm run devOption B: Full Stack (Next.js + Inngest Dev Server)
npm run dev:all # Uses mprocs to run bothOr manually in separate terminals:
# Terminal 1
npm run dev
# Terminal 2
npx inngest-cli@latest devngrok http 3000Update APP_BASE_URL in .env with your ngrok URL.
Visit http://localhost:3000 and sign in with GitHub!
- β Webhook Signature Validation: HMAC-SHA256 verification with timing-safe comparison
- β Environment Variable Validation: Zod schema validation on startup
- β SQL Injection Prevention: Prisma ORM with parameterized queries
- β Authentication: Better Auth with secure session management
- β Authorization: User-scoped data access in all server actions
- β Secret Management: No secrets in code, all in environment variables
- β CORS Protection: Trusted origins configuration
- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy!