A comprehensive full-stack plagiarism detection tool for large codebases that uses AST analysis, token-based similarity, and semantic embeddings to detect code plagiarism.
- Multiple Input Sources: GitHub repository URLs, file uploads, and ZIP file uploads
- Advanced Code Analysis: AST parsing and code normalization for multiple languages
- Similarity Detection:
- Jaccard similarity for token-based comparison
- Semantic similarity using HuggingFace
all-MiniLM-L6-v2embeddings - FAISS vector storage for efficient similarity search
- Comprehensive Results: File-to-file and function-to-function similarity analysis
- RESTful API: Clean API endpoints for all operations
- Modern UI: Beautiful, responsive interface with NextUI components
- Multiple Analysis Methods: GitHub repo analysis and file upload
- Interactive Results: Sortable table with similarity scores and visual indicators
- Detailed Comparison: Diff viewer with highlighted similar lines and functions
- Filtering & Sorting: Advanced filtering by similarity threshold and sorting options
- PDF Export: Generate comprehensive PDF reports
- Real-time Updates: Live progress tracking during analysis
- Python (.py)
- JavaScript (.js)
- TypeScript (.ts)
- Java (.java)
- C/C++ (.c, .cpp, .h, .hpp)
- C# (.cs)
- Go (.go)
- Rust (.rs)
- PHP (.php)
- Ruby (.rb)
- Swift (.swift)
- Kotlin (.kt)
- And more...
- Python 3.8+
- Node.js 18+
- Git
The current workflow is to run the backend and frontend directly from their own folders in separate terminals.
- Open a terminal in the backend folder:
cd backend- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Start the API server:
uvicorn main:app --reloadThe API will be available at http://localhost:8000.
- Open a second terminal in the frontend folder:
cd frontend- Install dependencies:
npm install- Start the Next.js dev server:
npm run devThe frontend will be available at http://localhost:3000
- Open the web interface at
http://localhost:3000 - Select the "GitHub Repo" tab
- Enter a GitHub repository URL
- Click "Analyze Repository"
- Wait for the analysis to complete
- View results in the interactive table
- Select the "Upload Files" tab
- Drag and drop code files or click to select
- Alternatively, upload a ZIP file containing code
- Click "Upload & Analyze Files"
- View results and export PDF reports
- Overall Similarity: Combined score from token and semantic similarity
- Token Similarity: Jaccard similarity based on code tokens
- Semantic Similarity: AI-powered similarity using embeddings
- Similar Functions: Matching functions between files
- Similar Code Blocks: Identical or near-identical code sections
Click the "Export PDF" button to generate a comprehensive report including:
- Summary statistics
- Detailed similarity analysis
- Similar functions and code blocks
- Visual similarity indicators
POST /analyze/github- Analyze GitHub repositoryPOST /analyze/upload- Analyze uploaded filesPOST /analyze/zip- Analyze ZIP file
GET /analysis/{analysis_id}- Get analysis status and resultsGET /analysis/{analysis_id}/similarities- Get filtered similarity resultsDELETE /analysis/{analysis_id}- Delete analysis results
backend/
├── main.py # FastAPI application
├── models/
│ └── similarity_result.py # Data models
├── services/
│ ├── code_analyzer.py # AST parsing and code analysis
│ ├── embedding_service.py # Semantic similarity using embeddings
│ └── similarity_engine.py # Similarity computation engine
├── utils/
│ └── file_utils.py # File handling utilities
└── requirements.txt # Python dependencies
frontend/
├── app/
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Main page
│ ├── providers.tsx # NextUI providers
│ └── globals.css # Global styles
├── components/
│ ├── FileUpload.tsx # File upload component
│ ├── ResultsTable.tsx # Results display table
│ └── DiffViewer.tsx # Detailed comparison viewer
├── utils/
│ └── pdfGenerator.ts # PDF report generation
└── package.json # Node.js dependencies
- Jaccard Similarity: Token-based similarity using set intersection
- Semantic Similarity: HuggingFace sentence transformers for code understanding
- Combined Score: Weighted average (30% Jaccard + 70% Semantic)
- FAISS Index: Efficient vector similarity search
- Background Processing: Non-blocking analysis for large codebases
- Caching: Embedding caching to avoid recomputation
- Parallel Processing: Concurrent file analysis
- CORS Protection: Configured for local development
- File Validation: Type checking for uploaded files
- Error Handling: Comprehensive error handling and user feedback
# Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000
# Frontend
cd frontend
npm run build
npm start- Port Already in Use: Change ports in the respective configuration files
- Memory Issues: Reduce batch sizes for large repositories
- Model Download: First run may take time to download the embedding model
- Use smaller repositories for initial testing
- Monitor memory usage during analysis
- Consider using GPU acceleration for large-scale analysis
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License. See LICENSE for the full text.
Note: This tool is designed for educational and legitimate plagiarism detection purposes. Always respect intellectual property rights and use responsibly.