# haneesh-m/fraud-detection-and-plagarism-checker architecture

> Architecture diagram of the GitHub repository haneesh-m/fraud-detection-and-plagarism-checker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haneesh-m/fraud-detection-and-plagarism-checker
- Repository: https://github.com/haneesh-m/fraud-detection-and-plagarism-checker

## Overview

##### Project type and purpose
- This is a full-stack web application aimed at allowing teachers and students to upload assignments, perform plagiarism checks, and detect potential fraud.
- It consists of two distinct modules:
– myproject-frontend (React)
– myproject-backend (Node.js/Express)

##### File structure
Top-level
- README.md – Project title and brief description
- SQL schema files (e.g., assignments table.txt, plagarism table.txt, login page.sql, teachers table.txt)
- myproject-backend/
– server.js (main Express server)
– package.json (dependencies)
– uploads/assignments (persisted user files)
- myproject-frontend/
– public/ (static HTML & manifest)
– src/ (React components: Login, Signup, Dashboard, TeacherDashboard, AssignmentUpload, PlagiarismChecker, etc.)
Patterns & clues
- A classic MVC-style split: React (View), Express endpoints (Controller), SQL database (Model)
- File uploads stored on disk under /uploads/assignments
- PlagiarismChecker component suggests an algorithm or service invoked from backend

##### Extract insights from README
- Project name: “fraud-detection-and-plagarism-checker”
- Purpose: “fraud detection and plagarism checker”

a. Main components
1. Client (Web Browser)
– React UI (myproject-frontend)
– Routes: /login, /signup, /dashboard, /upload, /plagiarism-report, etc.
2. API Layer (myproject-backend)
– Express server (server.js)
– Endpoints:
- POST /api/login
- POST /api/signup
- POST /api/upload-assignment
- GET /api/view-assignments
- POST /api/check-plagiarism
3. File Storage
– Local filesystem at /uploads/assignments
4. Database
– Relational DB (MySQL/PostgreSQL)
– Tables: users (students, teachers), assignments, plagiarism_records
5. (Optional) Plagiarism/Fraud Engine
– Internal module or external service invoked by backend to process uploaded files and generate reports

b. Relationships & data flow
- User interacts with React UI → sends HTTP request to Express
- Express authenticates via DB → returns JWT or session token
- For uploads: Express uses Multer to save file to disk → records metadata in DB → (optionally) invokes plagiarism-engine
- Plagiarism-engine reads files from disk → runs comparison algorithm → outputs similarity score → backend saves results in DB
- Frontend fetches report via API → displays results

c. Architectural patterns & principles
- Separation of concerns: UI vs API vs Data
- RESTful API design
- Stateless authentication (JWT or sessions)
- Modular React components
- Single responsibility for each Express route
- Local file storage decoupled from DB (could be replaced with S3 or similar in future)

d. Key technologies & libraries
- React, React Router
- Node.js, Express, Multer
- SQL database (MySQL/Postgres) via a driver or ORM (e.g., Sequelize)
- Plagiarism checker algorithm (in-house module or npm library)
- CSS modules for styling

##### Details to capture
- All frontend routes/components (Login, Dashboard, AssignmentUpload, PlagiarismChecker)
- All backend endpoints and their responsibilities
- Database schema entities and relationships
- File storage path and its purpose
- Any asynchronous flows (e.g., background plagiarism processing)
- Error handling or retry mechanisms (optional annotations)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "React Frontend"
        direction TB
        ReactFrontend["React Frontend"]:::client
        App["App.js"]:::client
        Login["Login.js"]:::client
        Signup["Signup.js"]:::client
        ForgotPwd["ForgotPassword.js"]:::client
        ResetPwd["ResetPassword.js"]:::client
        RoleSel["Roleselection.js"]:::client
        TeacherLogin["TeacherLogin.js"]:::client
        TeacherSignup["TeacherSignup.js"]:::client
        Dashboard["Dashboard.js"]:::client
        TeacherDashboard["TeacherDashboard.js"]:::client
        AssignmentUpload["AssignmentUpload.js"]:::client
        ViewAssignments["view_assignments.js"]:::client
        PlagiarismChecker["PlagiarismChecker.js"]:::client
        IndexHTML["index.html"]:::client
        Manifest["manifest.json"]:::client
    end

    %% Backend Side
    subgraph "Express Backend"
        direction TB
        Server["server.js"]:::backend
        Package["package.json"]:::backend
    end

    %% Storage & Data
    FileStorage["File Storage (/uploads/assignments)"]:::storage
    DB["Relational Database"]:::db
    Engine["Plagiarism Engine"]:::engine

    %% Data Flows
    Browser["Web Browser"]:::client
    Browser -->|"load App"| App
    App -->|"API calls (HTTP)"| Server
    Server -->|"store/read files"| FileStorage
    Server -->|"CRUD operations"| DB
    Server -->|"invoke check"| Engine
    Engine -->|"read files"| FileStorage
    Engine -->|"save results"| DB
    DB -->|"data response"| Server

    %% Click Events
    click ReactFrontend "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/tree/main/myproject-frontend/"
    click App "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/App.js"
    click Login "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/Login.js"
    click Signup "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/Signup.js"
    click ForgotPwd "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/ForgotPassword.js"
    click ResetPwd "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/ResetPassword.js"
    click RoleSel "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/Roleselection.js"
    click TeacherLogin "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/TeacherLogin.js"
    click TeacherSignup "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/TeacherSignup.js"
    click Dashboard "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/Dashboard.js"
    click TeacherDashboard "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/TeacherDashboard.js"
    click AssignmentUpload "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/AssignmentUpload.js"
    click ViewAssignments "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/view_assignments.js"
    click PlagiarismChecker "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/src/PlagiarismChecker.js"
    click IndexHTML "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/public/index.html"
    click Manifest "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-frontend/public/manifest.json"
    click Server "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-backend/server.js"
    click Package "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/blob/main/myproject-backend/package.json"
    click FileStorage "https://github.com/haneesh-m/fraud-detection-and-plagarism-checker/tree/main/myproject-backend/uploads/assignments/"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
    classDef db fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef engine fill:#FFB6C1,stroke:#333,stroke-width:1px
```
