Cut Code Review Time & Bugs in Half. Instantly.
Code Sorcerer is an AI-powered code review platform that automatically analyzes pull requests using advanced RAG (Retrieval-Augmented Generation) technology. It provides comprehensive, context-aware code reviews with detailed walkthroughs, sequence diagrams, and actionable suggestions.
- Automatic PR Analysis: Automatically reviews pull requests when opened or updated
- Context-Aware Reviews: Uses RAG (Retrieval-Augmented Generation) to understand your codebase context
- Comprehensive Analysis: Includes:
- File-by-file walkthrough
- Sequence diagrams (Mermaid.js)
- Summary and strengths
- Bug detection and security concerns
- Code improvement suggestions
- Creative poem summarizing changes
- Real-time statistics (repositories, commits, PRs, reviews)
- Contribution activity graph
- Monthly activity breakdown with charts
- Visual insights into your coding patterns
- Connect multiple repositories
- Automatic webhook handling
- GitHub OAuth authentication
- Real-time PR monitoring
- Free tier with limits (5 repos, 5 reviews per repo)
- Pro tier with unlimited access
- Polar.sh integration for payments
- Usage tracking and limits
- Beautiful, responsive design
- Dark mode support
- Real-time updates
- Intuitive navigation
- Next.js 16.1 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- shadcn/ui - Beautiful, accessible component library
- Tailwind CSS 4 - Utility-first CSS
- Radix UI - Unstyled, accessible components
- TanStack Query - Data fetching and caching
- Recharts - Chart library
- Lucide React - Icon library
- Inngest - Background job processing and workflows
- Prisma - Next-generation ORM
- PostgreSQL - Database
- Better Auth - Authentication system
- Polar.sh - Subscription and payment management
- Vercel AI SDK - AI integration framework
- Google Gemini 2.5 Flash - AI model for code review generation
- Pinecone - Vector database for RAG
- Google Text Embedding - Embedding model for semantic search
- Bun - Fast JavaScript runtime and package manager
- ngrok - Secure tunneling for webhooks (development)
- ESLint - Code linting
- GitHub Octokit - GitHub API client
GitHub Webhook → Next.js API Route → Inngest Event → Background Job
↓
Pinecone (RAG) ← Codebase Indexing ← Repository Connection
↓
AI Review Generation (Gemini) → Post to GitHub → Save to DB
-
Webhook Handler (
app/api/webhooks/github/route.ts)- Receives GitHub webhook events
- Triggers review process for PR events
-
Inngest Functions (
inngest/functions/review.ts)- Background job processing
- Handles PR diff fetching, RAG context retrieval, AI review generation
- Posts reviews to GitHub and saves to database
-
RAG System (
module/ai/lib/rag.ts)- Indexes codebase files into Pinecone
- Retrieves relevant context for PR reviews
- Uses semantic search for better understanding
-
Authentication (
lib/auth.ts)- GitHub OAuth via Better Auth
- Session management
- Polar.sh integration for subscriptions
-
Subscription System (
module/payment/lib/subscription.ts)- Tier management (FREE/PRO)
- Usage tracking
- Limit enforcement
After setting up your environment variables and database, you'll need to run these commands in separate terminals:
Terminal 1 - Next.js Development Server:
bun run devTerminal 2 - Inngest Dev Server (for background jobs):
npx --ignore-scripts=false inngest-cli@latest devTerminal 3 - ngrok (for GitHub webhooks):
ngrok http 3000Then open http://localhost:3000 in your browser.
- Bun (v1.0+)
- PostgreSQL (v14+)
- Node.js (v20+) - if not using Bun
- GitHub OAuth App - for authentication
- Pinecone Account - for vector database
- Polar.sh Account - for subscriptions (optional)
- ngrok - for local webhook development (optional)
-
Clone the repository
git clone https://github.com/ksamrat224/code-sorcerer.git cd code-sorcerer -
Install dependencies
bun install
-
Set up environment variables Create a
.envfile in the root directory:# Database DATABASE_URL="postgresql://user:password@localhost:5432/syntax_sorcerer" # GitHub OAuth GITHUB_CLIENT_ID="your_github_client_id" GITHUB_CLIENT_SECRET="your_github_client_secret" # Better Auth BETTER_AUTH_SECRET="your_secret_key" BETTER_AUTH_URL="http://localhost:3000" # Pinecone PINECONE_API_KEY="your_pinecone_api_key" PINECONE_INDEX_NAME="your_index_name" PINECONE_ENVIRONMENT="your_environment" # AI (Google) GOOGLE_GENERATIVE_AI_API_KEY="your_google_ai_key" # Inngest INNGEST_EVENT_KEY="your_inngest_event_key" INNGEST_SIGNING_KEY="your_inngest_signing_key" INNGEST_BASE_URL="http://localhost:3000/api/inngest" # Polar.sh (optional) POLAR_ACCESS_TOKEN="your_polar_token" POLAR_WEBHOOK_SECRET="your_webhook_secret" POLAR_SUCCESS_URL="http://localhost:3000/dashboard/subscription?success=true" NEXT_PUBLIC_APP_URL="http://localhost:3000" # ngrok (for local development) NGROK_URL="https://your-ngrok-url.ngrok-free.app"
-
Set up the database
bunx prisma generate bunx prisma migrate dev
-
Run the development server
bun run dev
-
Set up Inngest (for background jobs)
In a separate terminal, run:
npx --ignore-scripts=false inngest-cli@latest dev
This will start the Inngest dev server to handle background jobs. Keep this running alongside your Next.js server.
-
Set up ngrok (for local webhook testing)
In another terminal, run:
ngrok http 3000
This creates a secure tunnel to your local server. Update your GitHub webhook URL to point to your ngrok URL (e.g.,
https://your-ngrok-url.ngrok-free.app/api/webhooks/github).
- Navigate to Repositories in the dashboard
- Search for your GitHub repository
- Click Connect to link it to your account
- The codebase will be automatically indexed into Pinecone
- Create or update a pull request in your connected repository
- The webhook will trigger an automatic review
- The AI will analyze the PR and post a comprehensive review comment
- View all reviews in the Reviews section
You can also trigger reviews programmatically via the API or by using the GitHub webhook directly.
See Syntax Sorcerer in action! Check out this real code review generated by our AI:
This pull request showcases the full capabilities of Syntax Sorcerer's AI code review system:
- ✅ Contextual Analysis - Understands codebase context using RAG
- ✅ Detailed Walkthrough - File-by-file explanation of changes
- ✅ Sequence Diagrams - Visual flow representation using Mermaid.js
- ✅ Bug Detection - Identifies potential issues and security concerns
- ✅ Actionable Suggestions - Specific code improvement recommendations
- ✅ Creative Summaries - Includes a poem summarizing the changes
This is a real example of how Syntax Sorcerer automatically reviews pull requests and provides comprehensive, intelligent feedback.
code-sorcerer/
├── app/ # Next.js app directory
│ ├── (auth)/ # Auth routes
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── inngest/ # Inngest webhook
│ │ └── webhooks/ # GitHub webhooks
│ └── dashboard/ # Dashboard pages
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ └── providers/ # Context providers
├── inngest/ # Inngest functions
│ └── functions/ # Background jobs
├── lib/ # Utilities and configs
│ ├── generated/ # Prisma generated types
│ └── ...
├── module/ # Feature modules
│ ├── ai/ # AI and RAG logic
│ ├── auth/ # Authentication
│ ├── dashboard/ # Dashboard features
│ ├── github/ # GitHub integration
│ ├── payment/ # Subscription management
│ ├── repository/ # Repository management
│ └── review/ # Review features
└── prisma/ # Database schema
# Lint code
bun run lint
# Type check
bunx tsc --noEmit# Create a new migration
bunx prisma migrate dev --name migration_name
# Apply migrations
bunx prisma migrate deployWe welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Commit your changes
git commit -m 'Add some amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow TypeScript best practices
- Use shadcn/ui components when possible
- Write clear commit messages
- Add comments for complex logic
- Test your changes locally
- Update documentation as needed
- 🐛 Bug fixes
- ✨ New features
- 📚 Documentation improvements
- 🎨 UI/UX enhancements
- ⚡ Performance optimizations
- 🧪 Test coverage
- 🌐 Internationalization
This project is licensed under the MIT License - see the LICENSE file for details.
- shadcn for the amazing component library
- Inngest for background job processing
- Pinecone for vector database
- Vercel AI SDK for AI integration
- Polar.sh for subscription management
- All the open-source contributors
- Developer: Samrat Karki
- GitHub: @ksamrat224
- Project: code-sorcerer
Made with ❤️ using Next.js, AI, and modern web technologies






