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.
- 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
- Java 17
- MySQL
- Redis
- Gradle
- Docker
- Docker Compose
git clone https://github.com/your-username/code-review-assistant-backend.git
cd code-review-assistant-backendCreate a secrets.properties file in the root directory of your backend project:
openai.api.key=<your-openai-api-key>
jwt.secret=<your-jwt-secret>Generate your OpenAI API key from the OpenAI website.
Copy the output and use it as the openai.api.key value in your secrets.properties file.
To generate a secure JWT secret, open Windows PowerShell as Administrator and run the following command:
[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.
docker-compose up --buildNote: 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.
✅ 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
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
| 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 |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/code-review/submit |
Submits code for AI-based review |
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.
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!
If you found this project useful, then please consider leaving a ⭐ on GitHub. Thank you! 😄










