Skip to content

anand7771-dev/CodeInsight-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CodeInsight AI — Java Code Review Assistant

CodeInsight AI React Spring Boot Java Vite

AI-Powered Java static code analysis platform. Analyze, optimize, and improve Java code quality instantly.


✨ Features

  • Monaco Code Editor — Full-featured editor with Java syntax highlighting, line numbers, drag-and-drop upload
  • 15+ Analysis Rules across 4 categories: Style, Performance, Best Practice, Complexity
  • Quality Score — 0–100 animated score with Excellent/Good/Average/Poor grades
  • Warnings Panel — Expandable categorized warnings with severity badges
  • Suggestions Panel — Actionable improvement recommendations
  • Performance Insights — Cyclomatic complexity, maintainability, and readability scores
  • Export Report — Download full analysis as JSON
  • Animated UI — Framer Motion transitions, glassmorphism cards, loading overlay

🛠️ Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS v4, Framer Motion, Axios
Editor Monaco Editor (@monaco-editor/react)
Icons Lucide React
Backend Java 17, Spring Boot 3.2, Maven
Analysis Custom regex-based static analysis rule engine
Deployment Vercel (frontend) · Render/Railway (backend)

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • Java 17+
  • Maven 3.8+

1. Clone the repository

git clone https://github.com/yourusername/codeinsight-ai.git
cd codeinsight-ai

2. Start the Backend

cd backend
mvn spring-boot:run

Backend starts at http://localhost:8080

3. Start the Frontend

cd frontend
npm install
npm run dev

Frontend starts at http://localhost:5173


📁 Project Structure

codeinsight-ai/
├── backend/
│   ├── pom.xml
│   └── src/main/java/com/codeinsight/
│       ├── CodeInsightApplication.java
│       ├── config/CorsConfig.java
│       ├── controller/AnalysisController.java
│       ├── service/CodeAnalysisService.java
│       ├── analyzer/
│       │   ├── RuleSet.java
│       │   ├── ScoreCalculator.java
│       │   └── rules/
│       │       ├── StyleRules.java
│       │       ├── PerformanceRules.java
│       │       ├── BestPracticeRules.java
│       │       └── ComplexityRules.java
│       ├── dto/
│       │   ├── AnalyzeRequest.java
│       │   └── AnalyzeResponse.java
│       └── model/
│           ├── Warning.java
│           └── Metrics.java
│
└── frontend/
    ├── vercel.json
    ├── .env
    └── src/
        ├── App.jsx
        ├── main.jsx
        ├── index.css
        ├── pages/
        │   ├── LandingPage.jsx
        │   └── Dashboard.jsx
        ├── components/
        │   ├── Navbar.jsx
        │   ├── CodeEditor.jsx
        │   ├── ScoreCard.jsx
        │   ├── WarningsPanel.jsx
        │   ├── SuggestionsPanel.jsx
        │   ├── MetricsCard.jsx
        │   └── LoadingOverlay.jsx
        ├── services/api.js
        ├── hooks/useAnalysis.js
        └── utils/helpers.js

🔌 API Reference

POST /api/analyze

Analyze Java source code.

Request:

{
  "code": "public class MyClass { ... }"
}

Response:

{
  "score": 74,
  "grade": "Good",
  "totalLines": 42,
  "issueCount": 5,
  "warnings": [
    {
      "type": "BestPractice",
      "message": "System.out.println() used at line 8. Use a Logger instead.",
      "severity": "MEDIUM",
      "line": 8,
      "ruleId": "SYSOUT_USAGE"
    }
  ],
  "suggestions": [
    "Replace System.out.println() with SLF4J Logger..."
  ],
  "metrics": {
    "complexityScore": 80,
    "maintainabilityScore": 65,
    "readabilityScore": 72,
    "cyclomaticComplexity": 4,
    "methodCount": 3,
    "effectiveLines": 28
  }
}

GET /api/health

Returns {"status":"UP","service":"CodeInsight AI"}


📊 Analysis Rules

Category Rule Severity
Style Short variable names (≤ 1 char) LOW
Style Missing Javadoc on public members LOW
Style Method > 30 lines MEDIUM
Style Class > 200 lines MEDIUM
Performance Nested loops HIGH
Performance String += in loops HIGH
Performance Unnecessary boxing (new Integer) MEDIUM
BestPractice System.out.println usage MEDIUM
BestPractice Magic numbers LOW
BestPractice Hardcoded credentials CRITICAL
BestPractice Empty catch blocks HIGH
BestPractice Catching generic Exception MEDIUM
BestPractice Returning null LOW
Complexity Deep nesting (depth ≥ 5) HIGH
Complexity High cyclomatic complexity (> 10) HIGH
Complexity Too many method parameters (> 5) MEDIUM

🌐 Deployment

Frontend → Vercel

  1. Push frontend/ folder to GitHub
  2. Import project in vercel.com
  3. Set environment variable: VITE_API_URL=https://your-backend.railway.app
  4. Deploy

Backend → Railway

  1. Push backend/ folder to GitHub
  2. Create new project at railway.app
  3. Select the backend/ directory
  4. Railway auto-detects Maven and deploys
  5. Copy the Railway URL and set it as VITE_API_URL in Vercel

📸 Screenshots

Landing Page Dashboard — Empty Dashboard — Results
Hero with gradient background Monaco editor ready Score + warnings + suggestions

📄 License

MIT License — free to use for educational and demo purposes.


Built with ❤️ using React + Spring Boot

About

AI-Powered Java Code Review Platform — Spring Boot + React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors