Skip to content

shivamshukla028/Sentinel-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Sentinel AI

Advanced Real-Time Deepfake Detection & Digital Content Authentication Platform

Built for the Kanad S.H.I.E.L.D. Hackathon β€” Problem Statement PS-69E9C82813D10

Node.js TypeScript React OpenAI GPT-4o PostgreSQL


πŸ” Overview

Sentinel AI is a cyber-intelligence platform designed for law enforcement, cyber investigation teams, and digital forensics analysts. It leverages OpenAI GPT-4o vision to perform deep forensic analysis of uploaded images and media, detecting synthetic generation artifacts, face swaps, GAN fingerprints, and digital manipulation at scale.

The platform provides a professional Security Operations Center (SOC)-style dashboard with real-time statistics, a cinematic verdict reveal system, and detailed per-analysis forensic reports with six independent forensic sub-scores.


✨ Features

πŸ–₯️ Operations Center Dashboard

  • Live statistics: deepfakes detected, suspicious media, authentics confirmed, accuracy rate
  • Threat breakdown chart with category distribution
  • Real-time activity feed of recent analyses

πŸ“€ Upload & Analyze

  • Drag-and-drop image/video/audio upload
  • Base64 encoding with secure transmission
  • Asynchronous AI analysis with live progress indicator
  • Cinematic verdict reveal animation on completion

πŸ“‹ Analysis History

  • Full searchable table of all past analyses
  • One-click delete for record management
  • Status and verdict indicators per entry

πŸ”¬ Forensic Report

  • Animated confidence gauge (0–100%)
  • Six forensic sub-scores:
    • Face Consistency β€” facial feature coherence
    • Lighting Analysis β€” shadow and light source consistency
    • Compression Artifacts β€” natural vs. synthetic compression patterns
    • Frequency Analysis β€” frequency-domain anomaly detection
    • Temporal Consistency β€” frame-to-frame stability (video)
    • Noise Pattern β€” statistical noise distribution analysis
  • Manipulation indicators list
  • Metadata flags
  • AI-generated forensic summary

🧠 How the AI Works

  1. User uploads an image via the browser
  2. The image is converted to a base64 data URL client-side
  3. The API server receives the payload and immediately returns a 201 with status: analyzing
  4. Asynchronously, the server sends the image to OpenAI GPT-4o vision with a detailed forensic prompt
  5. GPT-4o returns structured JSON with verdict, confidence score, forensic sub-scores, and indicators
  6. The frontend polls GET /api/analyses/:id every 2 seconds until status === "complete"
  7. The verdict is revealed with a cinematic animation

Video and audio files receive a heuristic-based suspicious verdict with a recommendation for deeper codec-level analysis, since GPT-4o processes only image inputs.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Browser (React)                    β”‚
β”‚  Dashboard β”‚ Upload & Analyze β”‚ History β”‚ Forensic Reportβ”‚
β”‚            TanStack Query + Orval-generated hooks        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ HTTP (via proxy)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Express 5 API Server (Node.js)             β”‚
β”‚  POST /api/analyses  β†’  fire-and-forget OpenAI call     β”‚
β”‚  GET  /api/analyses/:id  ←  polling                     β”‚
β”‚  GET  /api/stats/dashboard                              β”‚
β”‚  GET  /api/stats/recent-activity                        β”‚
β”‚  GET  /api/stats/threat-breakdown                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   PostgreSQL DB β”‚        β”‚  OpenAI GPT-4o    β”‚
β”‚  (Drizzle ORM)  β”‚        β”‚  Vision API       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Layer Technology
Frontend React 19, Vite, TanStack Query, wouter, Tailwind CSS, framer-motion, Recharts
Backend Express 5, Node.js 24, TypeScript 5.9
AI OpenAI GPT-4o Vision (image analysis with JSON structured output)
Database PostgreSQL 16 + Drizzle ORM
Validation Zod v4 + drizzle-zod
API Contract OpenAPI 3.1 + Orval codegen (React Query hooks + Zod schemas)
Package Manager pnpm workspaces (monorepo)
Build esbuild (server), Vite (frontend)

πŸ“ Project Structure

sentinel-ai/
β”œβ”€β”€ artifacts/
β”‚   β”œβ”€β”€ api-server/          # Express API server
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ routes/
β”‚   β”‚       β”‚   β”œβ”€β”€ analyses.ts   # Deepfake analysis routes + OpenAI
β”‚   β”‚       β”‚   β”œβ”€β”€ stats.ts      # Dashboard statistics routes
β”‚   β”‚       β”‚   └── health.ts     # Health check
β”‚   β”‚       └── app.ts
β”‚   └── sentinel-ai/         # React frontend (Vite)
β”‚       └── src/
β”‚           β”œβ”€β”€ pages/
β”‚           β”‚   β”œβ”€β”€ Dashboard.tsx
β”‚           β”‚   β”œβ”€β”€ Analyze.tsx
β”‚           β”‚   β”œβ”€β”€ History.tsx
β”‚           β”‚   └── Report.tsx
β”‚           └── App.tsx
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api-spec/
β”‚   β”‚   └── openapi.yaml     # API contract (source of truth)
β”‚   β”œβ”€β”€ api-client-react/    # Generated React Query hooks
β”‚   β”œβ”€β”€ api-zod/             # Generated Zod validation schemas
β”‚   └── db/                  # Drizzle ORM schema + migrations
β”‚       └── src/schema/
β”‚           └── analyses.ts
└── pnpm-workspace.yaml

πŸš€ Getting Started

Prerequisites

  • Node.js 20+
  • pnpm 9+
  • PostgreSQL 14+
  • OpenAI API key with GPT-4o access

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/sentinel-ai.git
cd sentinel-ai

2. Install Dependencies

pnpm install

3. Configure Environment Variables

cp .env.example .env

Edit .env and fill in your values:

DATABASE_URL=postgresql://user:password@localhost:5432/sentinel_ai
OPENAI_API_KEY=sk-...your-key-here...
SESSION_SECRET=your-random-secret-string

4. Set Up the Database

pnpm --filter @workspace/db run push

5. Start Development Servers

# Terminal 1 β€” API Server (port 8080)
pnpm --filter @workspace/api-server run dev

# Terminal 2 β€” Frontend (port 23148)
pnpm --filter @workspace/sentinel-ai run dev

Open http://localhost:23148 in your browser.


πŸ”§ Development Commands

# Full typecheck across all packages
pnpm run typecheck

# Regenerate API hooks and Zod schemas from OpenAPI spec
pnpm --filter @workspace/api-spec run codegen

# Push DB schema changes (dev only)
pnpm --filter @workspace/db run push

# Build all packages
pnpm run build

🌐 API Reference

Method Endpoint Description
POST /api/analyses Submit image/video for deepfake analysis
GET /api/analyses List all analyses
GET /api/analyses/:id Get single analysis (poll for completion)
DELETE /api/analyses/:id Delete an analysis
POST /api/analyses/:id/reanalyze Re-run analysis
GET /api/stats/dashboard Dashboard statistics
GET /api/stats/recent-activity Recent activity feed
GET /api/stats/threat-breakdown Threat category breakdown
GET /api/healthz Health check

Analysis Object

{
  "id": 1,
  "fileName": "suspect_image.jpg",
  "fileType": "image",
  "verdict": "deepfake",
  "confidenceScore": 94.5,
  "status": "complete",
  "forensicDetails": {
    "faceConsistency": 87.2,
    "lightingAnalysis": 91.0,
    "compressionArtifacts": 23.1,
    "frequencyAnalysis": 88.5,
    "temporalConsistency": 75.0,
    "noisePattern": 82.3
  },
  "manipulationIndicators": [
    "GAN-generated facial features detected",
    "Unnatural boundary artifacts around facial region",
    "Frequency domain shows non-natural patterns"
  ],
  "metadataFlags": ["No EXIF data present", "Unusual compression signature"],
  "summary": "High-confidence deepfake detected. The facial region exhibits classic GAN generation artifacts...",
  "createdAt": "2026-05-24T18:00:00.000Z"
}

πŸ” Environment Variables

Variable Required Description
DATABASE_URL βœ… PostgreSQL connection string
OPENAI_API_KEY βœ… OpenAI API key (needs GPT-4o access)
SESSION_SECRET βœ… Random secret for session signing
PORT Auto API server port (default: 8080)
NODE_ENV Auto development or production

πŸ† Hackathon Context

Event: Kanad S.H.I.E.L.D. β€” Security Hackathon for Intelligence, Encryption, Law Enforcement and Defence

Problem Statement: PS-69E9C82813D10 β€” Sentinel AI: Advanced Real-Time Deepfake Detection and Digital Content Authentication

Category: Startups, Industry Partners, Companies with Tech Solutions, and Innovators/Researchers

Target Users: Law enforcement agencies, cyber crime investigation units, digital forensics teams, intelligence agencies


πŸ“„ License

MIT License β€” see LICENSE for details.


Built with precision for national security. Every pixel analyzed. Every threat identified.

About

Advanced Real-Time Deepfake Detection & Digital Content Authentication Platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors