https://github.com/soumyadeep6845/code-review-assistant-backend
The AI-Based Code Review Assistant allows users to submit code, which is then analyzed by an AI model (like OpenAIβs GPT) for suggestions, optimizations, and best practices. Users can retrieve past reviews and insights from the system.
https://github.com/soumyadeep6845/code-review-assistant-backend
ai contribute contributions-welcome docker good-first-issue gpt-4 gradle java jwt mysql openai opensource spring spring-boot
Last synced: 2 months ago
JSON representation
The AI-Based Code Review Assistant allows users to submit code, which is then analyzed by an AI model (like OpenAIβs GPT) for suggestions, optimizations, and best practices. Users can retrieve past reviews and insights from the system.
- Host: GitHub
- URL: https://github.com/soumyadeep6845/code-review-assistant-backend
- Owner: soumyadeep6845
- License: mit
- Created: 2025-02-10T13:55:43.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-12T19:32:41.000Z (about 1 year ago)
- Last Synced: 2025-04-12T20:26:52.958Z (about 1 year ago)
- Topics: ai, contribute, contributions-welcome, docker, good-first-issue, gpt-4, gradle, java, jwt, mysql, openai, opensource, spring, spring-boot
- Language: Java
- Homepage:
- Size: 3.11 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AI Code Review Assistant
## π Overview
This is the **backend** of the Code Review Assistant, a powerful AI-driven system designed to analyze code snippets and provide intelligent feedback. The backend handles API requests, communicates with OpenAI's GPT models, caches responses using Redis, and stores submission data securely.
## π Tech Stack
- **Language:** Java (v17)
- **Framework:** Spring Boot
- **Database:** MySQL
- **API Communication:** REST (Spring MVC)
- **API Documentation:** Swagger (v3)
- **Build Tool:** Gradle
- **Security:** Spring Security
- **Authentication:** JWT (custom, with encryption)
- **Logging:** SLF4j
- **Cache Layer:** Redis
- **Unit Test:** JUnit, Mockito
- **Containerization:** Docker
## πΈ Application Screenshots
### πΉ Authentication Page

### πΉ Home Page

### πΉ About Page

### πΉ Code Review in Action


### πΉ API Documentation (Swagger)

### πΉ Contact Page

### πΉ MySQL Database (SQLYog)

### πΉ Local Cache (Redis)

### πΉ Containerization (Docker) - Backend

---
## π¦ Installation & Setup
### Prerequisites
- Java 17
- MySQL
- Redis
- Gradle
- Docker
- Docker Compose
### 1οΈβ£ Clone the Repository
```sh
git clone https://github.com/your-username/code-review-assistant-backend.git
cd code-review-assistant-backend
```
### 2οΈβ£ Set Up Environment Secrets
Create a `secrets.properties` file in the **root directory** of your backend project:
```properties
openai.api.key=
jwt.secret=
```
#### π Generate OpenAI API Key
Generate your OpenAI API key from the [OpenAI website](https://platform.openai.com/).
Copy the output and use it as the **openai.api.key** value in your `secrets.properties` file.
#### π Generate JWT Secret
To generate a secure JWT secret, open **Windows PowerShell as Administrator** and run the following command:
```powershell
[Convert]::ToBase64String((1..32 | ForEach-Object {Get-Random -Maximum 256}))
```
Copy the output and use it as the **jwt.secret** value in your `secrets.properties` file.
### 3οΈβ£ Start the Backend (using Docker Compose)
```sh
docker-compose up --build
```
> Note: Starting Redis server and MySQL database separately, is not required. It has already been integrated.
> If still required, run:
> ```
> docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=yourpassword -e MYSQL_DATABASE=code_review -p 3306:3306 -d mysql:latest
> docker run --name redis-container -p 6379:6379 -d redis
> ```
The backend will now be running on **http://localhost:8080**.
---
## π Features
β
AI-based code analysis using GPT-4o
β
Caching of responses using Redis
β
RESTful API for frontend communication
β
Secure authentication & authorization with JWT
β
MySQL database integration
β
Containerized using Docker
---
## π Folder Structure
```
code-review-assistant-backend/
β-- personal/
β β-- src/
β β βββ main/
β β β βββ java/com/example/personal/
β β β β βββ config/ # Configurations
β β β β βββ controllers/ # API Controllers
β β β β βββ models/ # Data Models
β β β β βββ repositories/ # Database Repositories
β β β β βββ security/ # Security Configuration
β β β β βββ services/ # Business Logic Services
β β β β βββ util/ # Helpers & Utilities
β β β βββ resources/
β β β βββ application.properties # Application Configuration
β β βββ test/ # Unit & Integration Tests
β β-- build.gradle # Gradle Build Configuration
β β-- Dockerfile # Docker Configuration
β β-- docker-compose.yml # Docker Compose Configuration
β β-- secrets.properties # Key Secrets (to be created separately)
β-- README.md
```
---
## π API Endpoints
### π Authentication Endpoints (`/auth`)
| Method | Endpoint | Description |
|--------|------------------|---------------------------------------------|
| POST | `/auth/register` | Registers a new user |
| POST | `/auth/login` | Authenticates a user and returns JWT token |
| GET | `/auth/verify` | Verifies the provided JWT token |
### π€ Code Review Endpoints (`/api/code-review`)
| Method | Endpoint | Description |
|--------|---------------------------|--------------------------------------|
| POST | `/api/code-review/submit` | Submits code for AI-based review |
---
## π Deployment
### Build Docker Image
```sh
docker build -t code-review-backend .
docker run -p 8080:8080 code-review-backend
```
> *βΉοΈ For local development with Redis and MySQL, itβs recommended to use docker-compose for convenience.*
---
## π― Contribution
If you'd like to contribute, feel free to **fork** the repository, create a **new branch**, and raise a **pull request** with changes you deem necessary!
## π Found this project interesting?
If you found this project useful, then please consider leaving a β on [GitHub](https://github.com/soumyadeep6845/code-review-assistant-backend). Thank you! π
## π¨ Project Maintained By
[Soumyadeep Das](https://www.linkedin.com/in/soumya0021/)