Skip to content

jakubholik90/skillExtractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SkillExtractor πŸš€

SkillExtractor is an AI-powered application that analyzes Java projects to identify programming skills and assess knowledge levels through automated quizzes.

Java Spring Boot PostgreSQL OpenAI


πŸ“‹ Table of Contents


🎯 Overview

SkillExtractor helps developers:

  • Discover programming skills used in their Java projects
  • Assess knowledge level through AI-generated quizzes
  • Track skill progression across multiple projects
  • Build a comprehensive skill portfolio

How It Works

  1. Upload your Java project (up to 20 files)
  2. Analyze code using OpenAI GPT-4
  3. Extract skills mapped to predefined categories
  4. Quiz yourself to determine proficiency level
  5. Track your skills in a personal dashboard

✨ Features

MVP (v1.0)

  • βœ… User registration and authentication (Basic Auth + Custom UserDetailsService)
  • βœ… Java project upload and validation
  • βœ… AI-powered skill extraction (15 predefined categories)
  • βœ… Automated quiz generation for each skill
  • βœ… Skill level assessment (Unknown β†’ Basic β†’ Good β†’ Expert)
  • βœ… Personal skill dashboard with real-time updates
  • βœ… Project management (upload, list, delete)
  • βœ… Response caching to optimize API usage
  • βœ… JSON serialization protection (@JsonIgnore patterns)

Upcoming Features

  • πŸ”œ Python project support
  • πŸ”œ GitHub repository integration
  • πŸ”œ PDF/JSON skill export
  • πŸ”œ Visual skill radar charts
  • πŸ”œ Learning path recommendations
  • πŸ”œ Achievement badges

πŸ› οΈ Tech Stack

Backend

  • Java 17 with Spring Boot 3.2
  • Spring Security (Basic Auth + Custom UserDetailsService)
  • Spring Data JPA + Hibernate
  • PostgreSQL 15
  • OpenAI Java SDK
  • Caffeine Cache

Key Patterns & Solutions

  • @JsonIgnore for preventing infinite recursion (User ↔ Project ↔ Skill)
  • @Transactional(readOnly = true) for LazyInitializationException prevention
  • Custom @Query annotations for complex JPA queries
  • XSS protection with HTML escaping

Frontend

  • HTML5 + CSS3 + Bootstrap 5
  • Vanilla JavaScript (Fetch API)
  • Real-time dashboard updates

Deployment

  • Local Development (PostgreSQL + Maven)
  • Railway.app (Production - optional)

πŸ“ Project Structure

skillextractor/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/skillextractor/
β”‚   β”‚   β”‚   β”œβ”€β”€ SkillExtractorApplication.java
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SecurityConfig.java            # Spring Security + UserDetailsService
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CacheConfig.java               # Caffeine cache
β”‚   β”‚   β”‚   β”‚   └── OpenAIConfig.java              # OpenAI client
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ controller/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AuthController.java            # Registration/Login
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProjectController.java         # CRUD operations (@Transactional)
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SkillController.java           # Skill retrieval
β”‚   β”‚   β”‚   β”‚   └── QuizController.java            # Quiz generation/submission
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ UserService.java               # User management
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CustomUserDetailsService.java  # ⭐ NEW: Spring Security integration
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProjectService.java            # Project operations
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SkillAnalysisService.java      # AI-powered analysis
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ OpenAIService.java             # OpenAI API integration
β”‚   β”‚   β”‚   β”‚   └── QuizService.java               # Quiz logic
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ UserRepository.java
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProjectRepository.java         # Custom @Query methods
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SkillRepository.java
β”‚   β”‚   β”‚   β”‚   └── QuizResultRepository.java
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ model/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ User.java                      # @JsonIgnore for security
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Project.java                   # @JsonIgnore for circular refs
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Skill.java
β”‚   β”‚   β”‚   β”‚   └── QuizResult.java
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ dto/                               # 7 DTOs
β”‚   β”‚   β”‚   β”œβ”€β”€ enums/                             # SkillCategory, SkillLevel
β”‚   β”‚   β”‚   └── exception/                         # Global exception handling
β”‚   β”‚   β”‚
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ application.properties
β”‚   β”‚       β”œβ”€β”€ application-dev.properties
β”‚   β”‚       β”œβ”€β”€ application-prod.properties
β”‚   β”‚       β”‚
β”‚   β”‚       └── static/
β”‚   β”‚           β”œβ”€β”€ index.html
β”‚   β”‚           β”œβ”€β”€ login.html
β”‚   β”‚           β”œβ”€β”€ register.html
β”‚   β”‚           β”œβ”€β”€ dashboard.html                 # Real-time updates
β”‚   β”‚           β”œβ”€β”€ css/style.css
β”‚   β”‚           └── js/
β”‚   β”‚               β”œβ”€β”€ app.js
β”‚   β”‚               └── dashboard.js               # Delete + auto-refresh
β”‚
β”œβ”€β”€ pom.xml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml
└── README.md

**Total: 48+ files** (including CustomUserDetailsService)

πŸš€ Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.8+
  • PostgreSQL 15 (or use Docker)
  • OpenAI API Key (Get one here)

Installation

1. Clone the repository

git clone https://github.com/yourusername/skillextractor.git
cd skillextractor

2. Setup PostgreSQL

CREATE DATABASE skillextractor;
CREATE USER skillextractor_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE skillextractor TO skillextractor_user;

3. Configure application

Edit src/main/resources/application.properties:

spring.datasource.url=jdbc:postgresql://localhost:5432/skillextractor
spring.datasource.username=your_username
spring.datasource.password=your_password

# OpenAI API Key
openai.api.key=${OPENAI_API_KEY}

4. Set OpenAI API Key

export OPENAI_API_KEY=your_openai_api_key

Or add to application-dev.properties:

openai.api.key=sk-your-key-here

5. Build and run

mvn clean install
mvn spring-boot:run

6. Access the application

  • Frontend: http://localhost:8080
  • API: http://localhost:8080/api

Using Docker Compose (Alternative)

# 1. Set environment variable
export OPENAI_API_KEY=your_openai_api_key

# 2. Run with Docker Compose
docker-compose up --build

# 3. Access application
http://localhost:8080

πŸ“– Usage

1. Register Account

Navigate to /register and create your account.

2. Upload Project

  • Go to Dashboard β†’ "Upload Project"
  • Select local folder containing your Java project
  • Supported files: .java, pom.xml, .properties
  • Max: 20 files, 10MB total

3. View Extracted Skills

Skills are automatically extracted and categorized into 15 categories:

  • Syntax Basics, OOP, Collections, Streams & Lambdas
  • Exception Handling, File Handling, Database
  • Frameworks, Clean Code, Algorithms
  • Testing, Build Tools, Design Patterns
  • Concurrency, REST API

4. Take Quiz

  • Click on any skill to generate a quiz
  • Answer 3-5 AI-generated questions
  • Receive skill level assessment:
    • πŸŸ₯ Unknown (0-40%)
    • 🟨 Basic (41-60%)
    • 🟩 Good (61-85%)
    • 🟦 Expert (86-100%)

5. Manage Projects

  • View all your projects in the dashboard
  • Delete projects (with cascade delete of skills)
  • Track skill progression across projects

πŸ› Common Issues & Solutions

Issue 1: "Unable to locate Attribute [userId]"

Problem: JPA query method name doesn't match entity structure.

Solution: Use @Query annotation:

@Query("SELECT p FROM Project p WHERE p.user.id = :userId")
List<Project> findByUserId(@Param("userId") Long userId);

Issue 2: "LazyInitializationException"

Problem: Hibernate tries to load relationships outside session.

Solution: Add @Transactional(readOnly = true):

@GetMapping
@Transactional(readOnly = true)
public ResponseEntity<List<Project>> getUserProjects() { ... }

Issue 3: JSON Infinite Recursion (User ↔ Project)

Problem: Jackson tries to serialize circular references.

Solution: Add @JsonIgnore to relationships:

@Entity
public class Project {
    @ManyToOne
    @JsonIgnore  // Prevent recursion
    private User user;
}

Issue 4: Projects visible in API but not in frontend

Problem: Frontend doesn't refresh after operations.

Solution: Call loadProjects() after upload/delete:

await Promise.all([loadProjects(), loadSkills()]);

Issue 5: "httpBasic() is deprecated"

Problem: Using old Spring Security 5.x syntax.

Solution: Update to Spring Security 6.x:

.httpBasic(Customizer.withDefaults())  // New syntax

Issue 6: Delete button doesn't work

Problem: Function not globally accessible or wrong onclick.

Solution: Ensure deleteProject() is outside DOMContentLoaded:

// Global function
async function deleteProject(projectId) { ... }

For more troubleshooting, see:

  • DIAGNOSTIC_GUIDE.md - Complete diagnostic steps
  • FRONTEND_FIX_COMPLETE.md - Frontend issues
  • DELETE_FIX_GUIDE.md - Delete functionality

πŸ“‘ API Documentation

Authentication

All endpoints (except registration/login) require Basic Auth:

Authorization: Basic base64(username:password)

Key Endpoints

Projects

POST   /api/projects/upload          # Upload new project
GET    /api/projects                 # List user's projects
GET    /api/projects/{id}            # Get project details
DELETE /api/projects/{id}            # Delete project

Skills

GET    /api/skills                   # List all user skills
GET    /api/skills/category/{cat}    # Skills by category
GET    /api/skills/{id}              # Skill details

Quizzes

POST   /api/quiz/generate/{skillId}  # Generate quiz
POST   /api/quiz/submit              # Submit answers
GET    /api/quiz/results/{skillId}   # Get latest result

Full API documentation: docs/API.md


🌐 Deployment

Local Development

mvn spring-boot:run -Dspring-boot.run.profiles=dev

Railway.app (Production)

  1. Connect GitHub repository to Railway
  2. Add PostgreSQL database (Railway provides free tier)
  3. Set environment variables:
    • OPENAI_API_KEY
    • SPRING_PROFILES_ACTIVE=prod
  4. Deploy - Railway auto-builds and deploys

Railway provides a public URL: https://your-app.railway.app

Deployment guide: docs/DEPLOYMENT.md


🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Created as a learning project to practice:

  • Java & Spring Boot development
  • REST API design
  • OpenAI API integration
  • Database modeling with proper JPA patterns
  • Spring Security with custom authentication
  • Full-stack development with real-time updates
  • JSON serialization best practices

πŸ™ Acknowledgments


πŸ“š Additional Resources

Documentation

Troubleshooting Guides

  • DIAGNOSTIC_GUIDE.md - Step-by-step diagnostics
  • FRONTEND_FIX_COMPLETE.md - Frontend JSON issues
  • DELETE_FIX_GUIDE.md - Delete functionality
  • REPOSITORY_FIX.md - JPA query problems

Debug Tools

  • DebugController.java - Diagnostic endpoints (temporary)
  • test-api.html - Frontend API tester

πŸ”„ Recent Updates

Version 1.0.1 (Current)

  • βœ… Added CustomUserDetailsService for Spring Security
  • βœ… Fixed JSON infinite recursion with @JsonIgnore
  • βœ… Fixed LazyInitializationException with @Transactional
  • βœ… Updated to Spring Security 6.x syntax (Customizer.withDefaults())
  • βœ… Fixed JPA queries with @Query annotations
  • βœ… Added real-time dashboard updates
  • βœ… Improved delete functionality with proper cascade
  • βœ… Added XSS protection with HTML escaping
  • βœ… Enhanced error logging and debugging

⭐ Star this repo if you find it helpful!

πŸ’¬ Questions? Open an issue!

πŸ› Found a bug? Check troubleshooting guides first!

About

App to extract and verify your programming skills basing on your own projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors