A Next.js application for code review and analysis using AI. This tool helps developers analyze pull requests, identify code smells, and generate comprehensive summaries using Google's Gemini AI.
- 🤖 AI-powered code review using Gemini AI
- 🔍 Code smells analysis and detection
- 📝 Pull request summary generation
- 🔐 Firebase integration for data persistence
- 🎨 Modern UI with Tailwind CSS and shadcn/ui
- 🔒 Secure HTML sanitization with DOMPurify
- Docker (version 20.10.0 or higher)
- Docker Compose (version 2.0.0 or higher)
- Node.js 20.x (for local development)
Create a .env file in the root directory with your Firebase and Gemini configuration:
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
# Gemini AI Configuration
NEXT_PUBLIC_GOOGLE_AI_API_KEY=your_gemini_api_key- Go to Google AI Studio
- Sign in with your Google account
- Click on "Get API key" or "Create API key"
- Copy your API key and add it to the
.envfile asNEXT_PUBLIC_GOOGLE_AI_API_KEY
- Build and start the containers:
docker compose up --build-
The application will be available at http://localhost:9002
-
To stop the application:
docker compose downTo run the application in development mode:
- Install dependencies:
npm install- Start the development server:
npm run dev- Start the Genkit development server:
npm run genkit:devThe development server will be available at http://localhost:3000
- Build the application:
npm run build- Start the production server:
npm startdevopsCopilot/
├── src/
│ ├── ai/ # AI flows and prompts
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions
│ └── app/ # Next.js app directory
├── public/ # Static assets
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker build configuration
└── package.json # Project dependencies
The application uses Google's Gemini AI model for:
- Code review analysis
- Syntax and style checking
- Best practices validation
- Security vulnerability detection
- Identifying code smells
- Code duplication
- Complex methods
- Long parameter lists
- Inconsistent naming
- Generating pull request summaries
- Change overview
- Impact analysis
- Risk assessment
- Recommendations
-
Docker Build Fails
- Ensure Docker and Docker Compose are up to date
- Check if all environment variables are set correctly
- Clear Docker cache:
docker system prune -a
-
AI Analysis Not Working
- Verify your Gemini API key is valid
- Check browser console for any errors
- Ensure the input PR diff is properly formatted
-
HTML Rendering Issues
- Clear browser cache
- Check if DOMPurify is properly initialized
- Verify the HTML content is properly sanitized
If you encounter any issues:
- Check the browser console for error messages
- Review the Docker logs:
docker compose logs -f - Open an issue on the project repository
- All HTML content is sanitized using DOMPurify
- Environment variables are properly handled
- Firebase security rules are enforced
- API keys are never exposed to the client
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Make sure to keep your Gemini API key secure and never commit it to version control.