How sagnikbasak04/neuraldetect works
Project type and purpose
• Project name: NeuralDetect – a DeepFake Detection System
• Purpose: A full-stack web application that allows users to upload videos, runs them through an AI model to detect deep fakes, and presents results.
File structure
– Top-level directories:
· client/ → Production React + TypeScript front end (Vite, Tailwind)
· frontend-test/→ A standalone demo or integration test React app
· server/ → Node.js/Express API server, MongoDB integration, authentication, upload endpoints
· server_ai/ → Python AI microservice for deep-fake detection (Flask or similar), trained Keras models (.h5)
– Key patterns and files:
· client/src → Components (Feed, Login, VideoInput/Modal), Context (AuthContext), Hooks, Routes
· server/src → Controllers (auth, admin, upload), Routes, Models (User, Upload), Middlewares, DB connector
· server_ai/ → app.py entrypoint, model artifacts (final_model.h5), Jupyter notebooks
· Config & build → Vite configs, tsconfig.json, package.json in each module, requirements.txt in server_ai
· External integrations: Cloudinary (uploadToCloudinary util), MongoDB
README
– Very brief (“DeepFake Detection System”)
a. Main components:
1. Frontend (client) – React app served via static hosting or CDN
2. API Gateway / Backend (server) – Express endpoints for auth, upload, admin
3. AI Service (server_ai) – Python service exposing a predict endpoint
4. Database – MongoDB cluster for users & upload metadata
5. Cloud Storage – Cloudinary for video storage
6. (Optional) Frontend-test – Separate demo app or staging environment
b. Relationships & data-flow:
• User → Frontend → (via HTTPS REST) → API Server
• API Server:
– Auth endpoints ↔ MongoDB
– Upload endpoint: receives file or file URL, delegates to Cloudinary, stores metadata in MongoDB
– Detection endpoint: forwards video or URL to AI Service, receives prediction
• AI Service ↔ Model artifacts (.h5), returns DeepFake probability
• Cloudinary ↔ Stores raw videos, serves URLs
• Frontend polls or receives callback of detection result
c. Architectural patterns & principles:
– Separation of concerns: UI, API logic, AI logic, data storage are distinct services
– Microservice for AI detection (server_ai) – decoupled from main API
– RESTful API design, token-based auth (JWT via generateTokenAndSetCookie)
– MVC-like structure in server: Controllers → Routes → Models
– Context API + Hooks in client for state management (AuthContext, useLogin)
d. Key technologies/frameworks:
– Frontend: React, Vite, TypeScript, TailwindCSS, Context API
– Backend: Node.js, Express, TypeScript, Mongoose/MongoDB
– AI Service: Python (Flask/FastAPI), TensorFlow/Keras (.h5 models)
– External: Cloudinary for video uploads
– DevOps/build: Vite config, ESLint, tsconfig, requirements.txt