Skip to content
Back to Work
Open Sourcefrontendbackendai-mldevops

CodeReview AI

An automated AI-powered code review tool for GitHub pull requests. Connects to GitHub repos, listens for PR events via webhooks, and uses Google Gemini AI to analyze diffs for bugs, security vulnerabilities, performance issues, and style problems.

Next.jsReactTypeScripttRPCPrismaPostgreSQLGoogle Gemini AIInngestTailwind CSSshadcn/uiDockerGithub Actionsbetter-auth

Problem

Manual code reviews are time-consuming and inconsistent, often missing subtle bugs or security issues.

Approach

Built a full-stack Next.js app with tRPC for end-to-end type safety, Inngest for resilient background job processing, and Prisma + PostgreSQL for persistence. GitHub webhooks trigger automatic reviews while users can also trigger reviews manually from the UI.

Key Engineering Decisions

1

Step-based Inngest functions

Each pipeline step (fetch PR files, run AI, save results) is independently retryable, so a Gemini API failure doesn't re-fetch GitHub data.

2

Dual trigger paths

Webhook-based automatic and manual UI triggers share the same pipeline, keeping logic DRY.

3

Robust AI output parsing

Three-stage JSON parser (raw, markdown-fenced, bracket-matching extraction) handles Gemini's formatting quirks before Zod validation.

4

PrismaPg driver adapter

Chosen for serverless/edge compatibility over the default Prisma engine.

5

End-to-end type safety with tRPC

Provides fully typed API calls from client to server with Zod validation, giving autocomplete and type checking for all queries/mutations.

Results

Connected repos automatically review new PRs via GitHub webhooks

Automated PR review

UI updates every 2-3 seconds while reviews are in progress

Real-time status polling

AI assigns a risk score with severity distribution breakdown

Structured risk scoring (0-100)

Issues categorized as critical/high/medium/low with category icons (bug, security, performance, style)

Severity-rated comments

Each comment includes optional suggested fixes in expandable sections

Actionable fix suggestions

Full diff viewer with line numbers for context

Inline diff viewer

Email/password + GitHub OAuth with account linking

Dual authentication

GitHub Actions runs lint + build, then deploys via Docker to VPS with automatic HTTPS via Caddy

CI/CD pipeline

Technologies

Next.jsReactTypeScripttRPCPrismaPostgreSQLGoogle Gemini AIInngestTailwind CSSshadcn/uiDockerGithub Actionsbetter-auth