Skip to content

Abood170/CodeSense-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” CodeSense AI

AI-Powered Code Review Platform

Java Spring Boot Gemini AI PostgreSQL JWT License: MIT

Paste code or a GitHub URL and get an instant, structured AI review β€” bugs, security issues, performance tips, and a fixed version, all in seconds.

Features Β· Tech Stack Β· Getting Started Β· API Docs Β· Contributing


✨ Features

  • πŸ€– AI-Powered Reviews β€” Deep code analysis via Google Gemini 2.5 Flash, returning structured JSON with bugs, security flaws, performance issues, and suggestions
  • πŸ”— GitHub Integration β€” Paste any GitHub file URL and the app fetches and reviews the raw code automatically, with language auto-detection from the file extension
  • πŸ”’ JWT Authentication β€” Secure register/login flow with BCrypt password hashing and stateless JWT sessions
  • πŸ“Š Quality Score β€” Animated circular score ring (0–10) with color-coded labels (Excellent β†’ Critical Issues)
  • πŸ—‚οΈ Review History β€” Every review is persisted to PostgreSQL and accessible per-user through the History page
  • 🌐 12 Languages β€” Java, Python, JavaScript, TypeScript, Kotlin, Go, Rust, C++, C#, PHP, Ruby, Swift
  • 🎨 Dark UI β€” GitHub-inspired dark theme with collapsible result sections and a one-click fixed-code copy button
  • ⚑ Reactive HTTP β€” Non-blocking WebClient for all outbound calls (Gemini API, GitHub raw content)

πŸ›  Tech Stack

Layer Technology
Language Java 24
Framework Spring Boot 4.0.6
AI Model Google Gemini 2.5 Flash
Database PostgreSQL (Hibernate / Spring Data JPA)
Security Spring Security 6 Β· JWT (JJWT 0.11.5) Β· BCrypt
HTTP Client Spring WebFlux WebClient (reactive)
Build Tool Gradle 9
Frontend Vanilla HTML/CSS/JS (single-page, no framework)

πŸ“Έ Screenshots

Code Review GitHub URL Tab Review History
Code Review GitHub Tab History

Add your own screenshots to docs/screenshots/ to populate this section.


πŸš€ Getting Started

Prerequisites

  • Java 24 (or later)
  • PostgreSQL 14+ running locally
  • A Google Gemini API key β€” get one free at aistudio.google.com

1 β€” Clone the repository

git clone https://github.com/your-username/codesense-ai.git
cd codesense-ai

2 β€” Create the database

CREATE DATABASE code_reviewer;

Tables are created automatically on first run via Hibernate ddl-auto=update.

3 β€” Configure environment variables

Copy the example properties file and fill in your values:

cp src/main/resources/application.properties.example src/main/resources/application.properties

See the Environment Variables section for all required keys.

4 β€” Run the application

./gradlew bootRun

The server starts on http://localhost:8080.

5 β€” Open in browser

Navigate to http://localhost:8080 and create an account to start reviewing code.


βš™οΈ Environment Variables

All configuration lives in src/main/resources/application.properties.

Property Description Example
spring.datasource.url PostgreSQL JDBC URL jdbc:postgresql://localhost:5432/code_reviewer
spring.datasource.username Database username postgres
spring.datasource.password Database password yourpassword
gemini.api.key Google Gemini API key AIzaSy...
gemini.api.url Gemini model endpoint https://generativelanguage.googleapis.com/...
jwt.secret HMAC-SHA256 signing secret (β‰₯ 32 chars) MyS3cr3tK3y...
jwt.expiration Token validity in milliseconds 86400000 (24 hours)

⚠️ Never commit real secrets. Add application.properties to .gitignore and use environment variable substitution or a secrets manager in production.


πŸ“‘ API Endpoints

Authentication

Method Endpoint Body Description
POST /api/auth/register { username, email, password } Create a new account, returns JWT
POST /api/auth/login { email, password } Login, returns JWT

Code Review

All review endpoints require Authorization: Bearer <token> header.

Method Endpoint Body Description
POST /api/review { code, language } Review pasted code
POST /api/review/github { githubUrl } Fetch a GitHub file and review it
GET /api/reviews β€” Return the authenticated user's review history

Example β€” Review pasted code

curl -X POST http://localhost:8080/api/review \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token>" \
  -d '{
    "code": "public int divide(int a, int b) { return a / b; }",
    "language": "java"
  }'

Example response

{
  "summary": "Simple division method with no null-check or zero-division guard.",
  "bugs": ["Division by zero throws ArithmeticException when b = 0"],
  "security": [],
  "performance": [],
  "suggestions": ["Add input validation", "Consider returning Optional<Integer>"],
  "overallScore": 5.5,
  "fixedCode": "public int divide(int a, int b) {\n    if (b == 0) throw new IllegalArgumentException(\"Divisor cannot be zero\"); // FIXED: guard against division by zero\n    return a / b;\n}"
}

Example β€” Review from GitHub

curl -X POST http://localhost:8080/api/review/github \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token>" \
  -d '{
    "githubUrl": "https://github.com/user/repo/blob/main/src/Main.java"
  }'

🀝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m "Add amazing feature"
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Please make sure your code compiles cleanly (./gradlew build) before submitting.

Ideas for contributions

  • OAuth2 / GitHub login
  • Support for more languages (Scala, Dart, Elixir…)
  • Export review as PDF or Markdown
  • VS Code extension
  • Rate limiting per user
  • Webhook support for CI/CD pipelines

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built with β˜• and πŸ€– by Abood170

⭐ Star this repo if you find it useful!

About

An AI-powered code review platform that analyzes your code for bugs, security vulnerabilities, and performance issues using Google Gemini AI. Supports multiple programming languages with instant fixes and suggestions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors