Skip to content

m07amed25/DevReview-AI

Repository files navigation

Code Catch

Next.js TypeScript Prisma tRPC

Code Catch

AI-powered code reviews that catch bugs, security issues, and maintainability problems before they reach production.

✨ Features

  • πŸ€– AI-Powered Code Review - Automated code analysis using multiple AI providers (OpenAI, Google Gemini, Groq, Hugging Face)
  • πŸ”— GitHub Integration - Seamlessly connect your GitHub repositories and review pull requests
  • πŸ‘₯ Team Collaboration - Work together with team members on code reviews with real-time features
  • πŸ“Š Analytics Dashboard - Track review metrics, code quality trends, and team performance
  • πŸ“ Automatic Diagrams - Generate ERD, Class, and Use-Case diagrams from your codebase (supports Prisma, TypeORM, Sequelize, Drizzle, Mongoose, Knex, SQL DDL)
  • ⚑ Real-time Updates - Live notifications and collaborative review features via Pusher
  • 🎨 Modern UI - Beautiful, responsive interface with dark mode support
  • πŸ”’ Rate Limiting - Built-in protection against abuse using Upstash Redis
  • πŸ“§ Email Notifications - Stay updated with review status via Resend

πŸ›  Tech Stack

Category Technology
Framework Next.js 16 (App Router)
Language TypeScript
Database PostgreSQL with Prisma ORM
API tRPC v11
Authentication Better Auth
AI Providers OpenAI, Google Gemini, Groq, Hugging Face
Real-time Pusher
Background Jobs Inngest
Rate Limiting Upstash Redis
Styling Tailwind CSS + shadcn/ui
Animations GSAP
Email Resend

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • pnpm (recommended) or npm/yarn

Installation

  1. Clone the repository
git clone https://github.com/yourusername/depi-code-review.git
cd depi-code-review
  1. Install dependencies
pnpm install
# or
npm install
  1. Configure environment variables

Create a .env file in the root directory:

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

# Authentication (Better Auth)
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3000"

# GitHub OAuth
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"

# AI Providers (at least one required)
OPENAI_API_KEY="sk-..."
GOOGLE_GENERATIVE_AI_API_KEY="..."
GROQ_API_KEY="..."
HUGGING_FACE_API_KEY="..."

# Real-time (Pusher)
PUSHER_APP_ID="your-pusher-app-id"
PUSHER_KEY="your-pusher-key"
PUSHER_SECRET="your-pusher-secret"
PUSHER_CLUSTER="us2"

# Rate Limiting (Upstash Redis)
UPSTASH_REDIS_REST_URL="https://your-redis.upstash.io"
UPSTASH_REDIS_REST_TOKEN="your-token"

# File Upload (Vercel Blob)
BLOB_READ_WRITE_TOKEN="your-vercel-blob-token"

# Email (Resend)
RESEND_API_KEY="re_..."
  1. Initialize the database
npx prisma db push
  1. Run the development server
pnpm dev

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

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js App Router pages
β”‚   β”œβ”€β”€ (auth)/            # Authentication pages (sign-in, sign-up)
β”‚   β”œβ”€β”€ (dashboard)/      # Protected dashboard pages
β”‚   β”œβ”€β”€ api/              # API routes
β”‚   β”‚   β”œβ”€β”€ auth/         # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ trpc/         # tRPC API
β”‚   β”‚   β”œβ”€β”€ webhooks/     # GitHub webhooks
β”‚   β”‚   β”œβ”€β”€ upload/       # File upload handling
β”‚   β”‚   β”œβ”€β”€ pusher/       # Pusher authentication
β”‚   β”‚   └── inngest/      # Inngest functions
β”‚   └── page.tsx          # Landing page
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ ui/               # shadcn/ui components
β”‚   β”œβ”€β”€ animations/       # GSAP animations
β”‚   └── *.tsx             # Feature components
β”œβ”€β”€ lib/                   # Utility functions
β”‚   β”œβ”€β”€ trpc/             # tRPC client setup
β”‚   └── pusher/           # Pusher client
└── server/               # Server-side code
    β”œβ”€β”€ api/
    β”‚   β”œβ”€β”€ routers/      # tRPC routers
    β”‚   └── rate-limiter/ # Rate limiting
    β”œβ”€β”€ auth/             # Authentication config
    β”œβ”€β”€ db/               # Prisma client
    β”œβ”€β”€ services/         # Business logic (AI, GitHub)
    β”œβ”€β”€ email/            # Email templates
    β”œβ”€β”€ inngest/          # Inngest functions
    └── pusher/           # Pusher server

πŸ”Œ API Routes

tRPC Endpoints

Router Description
repository Repository management
review Code review operations
pullRequest Pull request handling
team Team management
analytics Review analytics
profile User profile
settings User settings
notification Notifications
collaboration Real-time collaboration

Webhooks

  • GitHub Webhooks (/api/webhooks/github) - Receive events from GitHub

πŸ“ Available Scripts

pnpm dev          # Start development server
pnpm build        # Build for production
pnpm start        # Start production server
pnpm lint         # Run ESLint

πŸ”§ Environment Variables Reference

Variable Required Description
DATABASE_URL Yes PostgreSQL connection string
BETTER_AUTH_SECRET Yes Secret for session encryption
BETTER_AUTH_URL Yes Production URL
GITHUB_CLIENT_ID Yes GitHub OAuth app client ID
GITHUB_CLIENT_SECRET Yes GitHub OAuth app client secret
OPENAI_API_KEY No* OpenAI API key
GOOGLE_GENERATIVE_AI_API_KEY No* Google Gemini API key
GROQ_API_KEY No* Groq API key
HUGGING_FACE_API_KEY No* Hugging Face API key
PUSHER_* Yes Pusher configuration
UPSTASH_REDIS_* Yes Upstash Redis for rate limiting
BLOB_READ_WRITE_TOKEN No Vercel Blob for file uploads
RESEND_API_KEY No Resend for emails

*At least one AI provider API key is required.

πŸ— Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Import the project in Vercel
  3. Configure environment variables
  4. Deploy

Docker

FROM node:18-alpine
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
EXPOSE 3000
CMD ["pnpm", "start"]

πŸ“„ License

MIT License - see LICENSE for details.


Built with ❀️ by Mohamed Reda

About

Automated code reviews powered by AI. Catch bugs, security issues, and code quality problems instantly directly in your GitHub pull requests.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors