Project Description
๐ Project Overview
The proliferation of deepfakes and AI-synthesized media has created a massive challenge for cybersecurity, media authenticity, and digital forensics. This project offers an end-to-end web-based platform that allows users to upload media files and immediately inspect them for manipulation indicators.
The application is built using pure Node.js with zero external npm dependencies, showcasing how to construct complex features like custom multipart file uploading, modular file processing, dynamic canvas-based evidence visualization, local JSON-based database persistence, and raw PDF report generation using only standard library features.
The analysis engine utilizes an explainable, deterministic heuristic model that rates files across multiple signal categories. Its decoupled architecture makes it extremely simple to swap out the heuristic analyzer with active deep learning inference pipelines (such as PyTorch/TensorFlow, OpenCV face meshes, or Librosa audio processing).
๐จ Project Screenshots & UI Preview
Below are previews of the clean, modern dark-mode dashboard:
๐ Key Features
- Dual-Modality Analysis: Supports both video and audio files across multiple formats:
- Video:
.mp4,.mov,.avi,.mkv,.webm - Audio:
.mp3,.wav,.m4a,.aac,.ogg,.flac
- Video:
- Interactive Results Dashboard: Displays overall manipulation probability (%), classification result (e.g., Likely Manipulated vs Likely Authentic), and analysis confidence rating.
- Explainable Evidence (Visual Heatmaps & Charts):
- Frame Anomaly Heatmap: Visual representation overlay of facial/texture inconsistency regions.
- Audio Spectral Anomaly Map: Dynamic timeline chart illustrating anomalous frequencies and noise levels.
- Granular Detection Signals:
- Video Signals: Entropy Pressure, Texture Instability, Temporal Jitter, and Compression Artifacts.
- Audio Signals: Spectral Noise, Smoothness Anomaly, Phase Irregularity, and Silence Patterns.
- Automated PDF Report Generation: Creates a professional, detailed authenticity summary containing file metadata, analysis breakdown, suspicious timestamp lists, and embedded visual charts.
- Analysis History Archive: Persists uploads and results in a local database so users can browse historical checks and retrieve reports.
- Highly Decoupled Architecture: Clean separation of routes, controller layers, data storage, and the ML analyzer service, providing a direct upgrade path to a Python/PyTorch inference server.
- Zero npm Dependencies: Runs entirely on Node.js core modules. Extremely lightweight, fast, and secure.
๐ ๏ธ Technology Used
- Frontend:
- HTML5: Semantic layouts and upload zones.
- Vanilla CSS3: Modern dark-theme design with responsive flex/grid cards, glassmorphic inputs, transition animations, and sidebar navigation.
- Vanilla JavaScript (ES6): Upload progress tracking, dynamic DOM rendering of scores, and API call handlers.
- Backend:
- Node.js (v18+): Built-in modules only (
http,fs,path,crypto). - Custom Multipart Parser: Efficient streaming parser for handling large binary file uploads.
- Custom PDF Generator: Core-based binary writer that constructs and compiles clean, downloadable PDF files from scratch.
- Node.js (v18+): Built-in modules only (
- Database & File Storage:
- Flat JSON Database (
storage/db.json): Serves as a local document store for past results. - Structured Directories: Dynamic storage folders for uploads, evidence maps, and generated PDFs.
- Flat JSON Database (
- Testing Suite:
- Node.js Test Runner: Unit tests verifying multipart parsing, schema validators, scoring mathematical models, and report layout dimensions.
๐ File & Folder Structure
deepfake_detection_platform/
โโโ backend/
โ โโโ server.js # Entrypoint server (serves frontend, routes APIs)
โ โโโ services/
โ โโโ analyzer.js # Detection heuristic scoring & signals compiler
โ โโโ db.js # Database helper (JSON-based history reader/writer)
โ โโโ pdf.js # Custom PDF writer for reports
โโโ frontend/
โ โโโ index.html # Main single-page application dashboard
โ โโโ styles.css # Vanilla CSS styling with variable-based dark theme
โ โโโ app.js # Dynamic UI controllers & API request methods
โโโ storage/ # Local media & records directory (auto-created)
โ โโโ db.json # Database storage file
โ โโโ evidence/ # Visual heatmaps and audio charts
โ โโโ reports/ # Generated PDF authenticity reports
โ โโโ uploads/ # Original uploaded media files
โโโ tests/
โ โโโ index.test.js # Unit tests suite for validators, parsers, and scorings
โโโ package.json # Project details & npm start scripts
โโโ RUN_GUIDE.md # Detailed technical operations manual
โ๏ธ Installation & How to Run
๐ Prerequisites
- Node.js: Version 18.0.0 or higher.
- Operating system command-line (Terminal, Command Prompt, or PowerShell).
๐ง Step-by-Step Setup
-
Clone or Download the Source Code: Save the project folder locally, ensuring you have the following path structure:
deepfake_detection_platform/ -
Open your Terminal: Navigate into the project root directory:
cd path/to/deepfake_detection_platform -
Start the Application: Run the following command to start the server:
npm start(Alternatively, you can run
npm run devto start in development mode). -
Access the Dashboard: Open your web browser and navigate to:
http://localhost:3000
๐๏ธ Configurations & Environment Variables
The application runs seamlessly with default configurations. However, you can control port and size configurations using environment variables:
1. Custom Port Configuration
By default, the server listens on port 3000. To change it, set the PORT variable:
- Windows (PowerShell):
$env:PORT=8080 npm start - macOS / Linux:
PORT=8080 npm start
2. Maximum Upload Limit
The default maximum media size allowed for upload is 80 MB. To adjust the threshold:
- Windows (PowerShell):
$env:MAX_UPLOAD_BYTES=104857600 # Sets limit to 100 MB npm start - macOS / Linux:
MAX_UPLOAD_BYTES=104857600 npm start
๐งช Running Automated Tests
To execute the test runner and verify backend functionality:
npm test
The tests will run and output assertions covering:
- Multipart Boundary Parser: Ensures raw file uploads compile cleanly.
- Analyzer Scoring Model: Tests confidence mathematical bounds and anomalies.
- API Endpoints: Simulates requests and validates database logs.
๐งน Resetting Local Analysis History
If you want to clear your local dashboard history and delete previous uploads/reports:
- Stop the running server (
Ctrl + C). - Delete the contents inside the following folders (do not delete the folders themselves):
storage/uploads/storage/evidence/storage/reports/
- Open
storage/db.jsonand reset it to empty:{ "analyses": [] } - Restart the server.
๐ท๏ธ Why Buy This Project Template?
- Ideal for Academic Projects: Perfect foundation for final year college, university, or boot camp capstone projects.
- Production-Ready Extension: Easily replace the mock scoring system with advanced deep learning APIs (FastAPI + PyTorch/TensorFlow) without changing the frontend UI.
- Clean Code & Zero NPM Fat: Easy to audit, debug, and configure. No risk of broken or deprecated package dependencies.
- Comprehensive Documentation: Comes pre-packaged with setting guides and instructions.

