๐ Open App โ satark-deepfake.vercel.app
Satark-AI is a production-grade, full-stack deepfake detection and speaker verification platform. Built as a scalable microservices monorepo, it combines advanced audio forensics (MFCC, Spectral Analysis, Zero Crossing Rate), image deepfake detection via Hugging Face Inference API, and deep learning speaker biometrics (ECAPA-TDNN) to identify synthetic media and verify speaker identities in real time โ across audio, video, and image inputs.
| Dashboard | Mobile View |
|---|---|
![]() |
![]() |
| Live Monitor | Speaker Identity |
|---|---|
![]() |
![]() |
- Wav2Vec2 Model: Transformer-based deep learning model fine-tuned for synthetic speech detection.
- Multi-Feature Forensics: Analyzes MFCC coefficients, Spectral Rolloff, and Zero Crossing Rate (ZCR) for composite risk scoring.
- Multi-Format Support: Upload MP3, WAV, or extract audio from MP4 video files โ handled via
moviepyfallback. - Explainable AI (XAI): Returns structured
analysisDetailswith per-feature reasoning (e.g.,"Anomalous zero crossing rate (0.214)"). - Confidence Scoring: 4-decimal precision confidence score returned per scan.
- Smart Deduplication: SHA-256 file hashing prevents redundant re-processing of identical files.
Image analysis runs on an entirely separate, serverless pipeline โ independent of the Python engine.
- Models:
prithivMLmods/deepfake-detector-model-v1(face deepfake) +umm-maybe/ai-image-detector(general AI-image) via Hugging Face Inference API โ specialized models analyzing facial artifacts and AI-generation patterns. - Cloudflare Worker Proxy: A dedicated Cloudflare Worker (
satark-image-proxy) sits between the frontend and Hugging Face's API โ handling CORS, secret management, size enforcement, and timeout control. - Input Formats: Supports
multipart/form-datafile upload or raw binary body. Images are forwarded to Hugging Face Inference API as binary. - 5MB Size Limit: Enforced both via
content-lengthheader (pre-read) and actualbyteLengthpost-read โ double-layer enforcement. - 30s Timeout:
AbortControllercancels hung Hugging Face requests after 30 seconds, returning504gracefully. - Output Schema:
{ isDeepfake: boolean, confidenceScore: float (0โ1), details: string }โ normalized and validated before returning to client. - Robust JSON Parsing: Normalizes response, clamps
confidenceScoreto[0, 1], falls back gracefully if API returns unexpected format. - CORS Whitelisting: Strict origin whitelist (
satark-deepfake.vercel.app,localhost:5173,localhost:3000) โ no wildcard*.
- Enrollment System: Enroll a speaker by uploading a reference audio sample. ECAPA-TDNN extracts a 192-dim voice embedding stored securely in PostgreSQL.
- Verification: Match an unknown voice against all enrolled speakers using Cosine Similarity (threshold: 0.75).
- Scoped Isolation: Users only verify against their own enrolled speakers โ cross-user data access is prevented at the query level.
- Auto-History Logging: Every verification attempt is saved to the scan history table with identity details.
- Real-Time Protection: Continuously captures microphone input and processes it in 5-second chunks.
- Instant Feedback: Each chunk is scanned and flagged as real or synthetic with confidence score.
- Auto-Persistence: All detected threats are saved to the history database automatically.
- Detection Ratio Chart: Donut chart (Recharts PieChart) visualizing Real vs. Fake scan breakdown.
- Confidence Bucketing: Bar chart grouping scans into High (>80%), Medium (50โ80%), and Low (<50%) confidence bands.
- Summary Cards: Total Scans, Deepfakes Detected, Real Audio count, and Average Confidence โ animated with Framer Motion.
DeepfakeGamecomponent โ an interactive challenge mode that tests the user's ability to distinguish real from AI-generated audio samples.
- Users can submit feedback on any scan via
FeedbackWidget. - Stored in the
scans.feedbackcolumn and retrievable via/scans/:id/feedback.
- Progressive Web App: Installable on Android/iOS and Desktop via
InstallPWAcomponent. Powered by Workbox service worker with precaching and network-only strategies. - Dark / Light Mode: Full theme toggle via
theme-providerandmode-toggle. - Multilingual Support: Language context (
LanguageContext.tsx) with a language toggle component. - History & Playback: Review all past scans, listen back to saved audio, and export detailed PDF reports.
Satark-AI is structured as a Turborepo monorepo with three independent microservices and one shared package:
satark-ai/
โโโ apps/
โ โโโ web/ โ React + Vite (Frontend)
โ โโโ api/ โ Hono + Node.js (API Gateway)
โ โโโ engine/ โ FastAPI + Python (AI Engine โ Audio/Speaker)
โโโ packages/
โ โโโ shared/ โ Shared Zod schemas & TypeScript types
โโโ cloudflare-worker/ โ satark-image-proxy (Hugging Face image proxy)
โโโ docker-compose.yml
โโโ turbo.json
| Service | Runtime | Role | Port |
|---|---|---|---|
apps/web |
React 18 + Vite | User interface, PWA shell | 5173 |
apps/api |
Node.js + Hono | Auth, DB, orchestration | 3000 |
apps/engine |
Python 3.11 + FastAPI | Audio deepfake + speaker inference | 8000 |
cloudflare-worker |
Cloudflare Workers (V8) | Image deepfake proxy โ Hugging Face API | Edge |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Browser (React PWA) โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ โ
Audio/ โ โ Image Upload
Speaker โ โ
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ
โ Hono API โ โ Cloudflare Worker โ
โ Gateway โ โ (satark-image-proxy)โ
โ (Node.js) โ โโโโโโโโโโโโฌโโโโโโโโโโโโ
โโโโโโโโฌโโโโโโโโ โ
โ โผ
โผ โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ โ Hugging Face โ
โ FastAPI โ โ Inference API โ
โ AI Engine โ โ Deepfake Models โ
โ (Python) โ โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโโโดโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ PostgreSQL โ โ PyTorch Models โ
โ (Drizzle ORM)โ โ Wav2Vec2 + โ
โโโโโโโโโโโโโโโโ โ ECAPA-TDNN โ
โโโโโโโโโโโโโโโโโโโโ
Complete technical documentation for the Satark-AI platform:
| Document | Description |
|---|---|
docs/AI_DISCOVERABILITY_FRAMEWORKS.md |
AI discoverability & search optimization (AEO, GEO, LLMO, AISEO, E-E-A-T, SEO) |
docs/API.md |
Complete REST API reference (20+ endpoints across 3 services) |
docs/ARCHITECTURE.md |
System design, service map, request flows, C4 diagrams |
docs/DB_SCHEMA.md |
PostgreSQL schema with field-level documentation (Drizzle ORM) |
docs/DEPLOYMENT.md |
Production deployment guide (Vercel + Render + Docker) |
docs/EDGE_CASES.md |
Error handling, graceful degradation, failure modes |
docs/TECH_STACK.md |
Complete technology inventory (40+ packages) |
docs/WORKFLOW.md |
Development workflow, testing strategy, CI/CD pipeline |
| Signal | Feature Extracted | Anomaly Trigger |
|---|---|---|
| Raw waveform | Wav2Vec2 classifier | Model confidence > threshold |
| Frequency domain | Spectral Rolloff | Rolloff < 2500 Hz |
| Time domain | Zero Crossing Rate | ZCR > 0.12 |
| Combined | Composite risk score | Weighted multi-feature fusion |
| Step | Technology | Detail |
|---|---|---|
| Audio loading | Librosa | Resampled to 16 kHz mono |
| Embedding extraction | SpeechBrain ECAPA-TDNN | 192-dimensional vector |
| Similarity scoring | Cosine Similarity (TypeScript) | Computed server-side in API |
| Match decision | Threshold (0.75) | score > 0.75 โ Identity Confirmed |
| Step | Component | Detail |
|---|---|---|
| Request intake | Cloudflare Worker | Accepts multipart/form-data or raw binary |
| Size enforcement | Worker (double-check) | Pre-read via content-length, post-read via byteLength โ 5MB cap |
| Image encoding | Worker | ArrayBuffer โ Base64 โ Data URI |
| Vision inference | Hugging Face API | prithivMLmods/deepfake-detector-model-v1 + umm-maybe/ai-image-detector analyze artifacts |
| Response parsing | extractJSON() |
Strips markdown fences, extracts {}, clamps score to [0,1] |
| Timeout control | AbortController |
30s hard timeout โ 504 response |
| Output | Normalized JSON | { isDeepfake, confidenceScore, details } |
src/
โโโ api/
โ โโโ client.ts โ Typed API client (scanAudio, scanUpload, scanImage,
โ enrollSpeaker, verifySpeaker, getHistory, submitFeedback)
โโโ components/
โ โโโ AnalyticsStats.tsx โ Recharts pie + bar dashboard
โ โโโ AudioUpload.tsx โ File picker with drag-drop for audio
โ โโโ AudioVisualizer.tsx โ Real-time waveform canvas
โ โโโ ConfidenceMeter.tsx โ Animated confidence score bar
โ โโโ DeepfakeGame.tsx โ Interactive detection challenge game
โ โโโ ErrorBoundary.tsx โ React error boundary wrapper
โ โโโ FakeHeatmap.tsx โ Feature-level heatmap visualization
โ โโโ FeatureChart.tsx โ Per-feature forensic breakdown chart
โ โโโ FeedbackWidget.tsx โ User feedback submission UI
โ โโโ Footer.tsx
โ โโโ ImageUpload.tsx โ Image deepfake upload โ Cloudflare Worker โ Hugging Face API
โ โโโ InstallPWA.tsx โ PWA install prompt handler
โ โโโ LandingNavbar.tsx โ Public landing page navigation
โ โโโ language-toggle.tsx โ i18n language switcher
โ โโโ LiveMonitor.tsx โ Real-time mic monitoring (5s chunks)
โ โโโ mode-toggle.tsx โ Dark/light theme switch
โ โโโ Navbar.tsx โ Authenticated app navigation
โ โโโ ScanHistory.tsx โ History list with audio playback
โ โโโ SpeakerIdentity.tsx โ Enrollment + verification UI
โ โโโ theme-provider.tsx โ Global theme context
โโโ context/
โ โโโ LanguageContext.tsx โ i18n context provider
โโโ lib/
โ โโโ utils.ts โ Shared utility helpers
โโโ pages/
โ โโโ History.tsx โ Full scan history page
โ โโโ Landing.tsx โ Public marketing landing
โโโ utils/
โ โโโ pdfGenerator.ts โ jsPDF-powered report generation
โโโ App.tsx โ Root router + Clerk provider
โโโ AuthenticatedShell.tsx โ Protected app shell wrapper
Key Libraries:
| Library | Version | Purpose |
|---|---|---|
| React | 18 | Core UI framework |
| Vite | โ | Build tool + HMR |
| TypeScript | 5.3 | Type safety |
| Tailwind CSS | โ | Utility-first styling |
| Framer Motion | โ | Animations |
| Clerk | โ | Auth (JWT) |
| Recharts | โ | Analytics charts |
| Lucide React | โ | Icon set |
| Workbox | 7.3 | PWA / Service Worker |
src/
โโโ db/
โ โโโ index.ts โ Drizzle + pg connection pool (max 20, timeout 5s, idle 30s)
โ โโโ schema.ts โ PostgreSQL schema definitions
โโโ middleware/
โ โโโ auth.ts โ Clerk JWT verification middleware (authMiddleware + requireAuth)
โโโ routes/
โ โโโ speaker.ts โ /speaker/enroll + /speaker/verify endpoints
โโโ index.ts โ Main Hono app, all route registration
Database Schema:
// scans table
{
id: serial (PK),
userId: text (NOT NULL), // Clerk user ID
audioUrl: text (NOT NULL),
isDeepfake: boolean,
confidenceScore: float8,
fileHash: text, // SHA-256 for deduplication
audioData: text, // Base64 encoded audio (for playback)
analysisDetails: text, // Human-readable XAI output
createdAt: timestamp (default now),
feedback: text
// Indexes: userId, createdAt, fileHash
}
// speakers table
{
id: uuid (PK, random),
userId: text (NOT NULL), // Clerk user ID (scoped isolation)
name: text (NOT NULL),
embedding: json (NOT NULL), // 192-dim ECAPA-TDNN float array
createdAt: timestamp (NOT NULL)
// Index: userId
}API Endpoints:
| Method | Path | Auth | Description |
|---|---|---|---|
POST |
/upload |
โ | Upload audio file for deepfake scan |
POST |
/scan |
โ | Scan audio from URL |
GET |
/scans |
โ | Get user's scan history |
GET |
/audio/:id |
โ | Stream audio blob for playback |
POST |
/scans/:id/feedback |
โ | Submit feedback on a scan |
POST |
/speaker/enroll |
โ | Enroll speaker voice print |
POST |
/speaker/verify |
โ | Verify speaker identity |
apps/engine/
โโโ main.py โ FastAPI app, endpoint definitions, lifespan context
โโโ detect.py โ Deepfake detection pipeline (Wav2Vec2 + spectral)
โโโ detect_image.py โ Image deepfake detection
โโโ speaker.py โ ECAPA-TDNN embedding generation + HF patches
โโโ schemas.py โ Pydantic models (AudioUpload, ScanResult)
โโโ dummy_custom.py โ SpeechBrain HuggingFace 404 fallback patch
โโโ requirements.txt โ Pinned Python dependencies
โโโ Dockerfile โ Python 3.11-slim, non-root user (appuser)
Engine Endpoints:
| Method | Path | Description |
|---|---|---|
GET |
/ |
Health check โ {"status": "AI Engine Running"} |
POST |
/scan |
Scan audio via URL (async download โ analyze) |
POST |
/scan-upload |
Scan uploaded audio file |
POST |
/analyze |
Video/audio analysis with moviepy fallback |
POST |
/embed |
Generate ECAPA-TDNN speaker embedding vector |
Performance Notes:
- Lazy Model Loading: Models load on first request (not at startup) to prevent OOM crashes on free-tier Render instances.
- Thread Executor: CPU-bound inference runs in
loop.run_in_executor()to keep FastAPI async event loop non-blocking. - Temp File Cleanup: All uploaded/extracted files are deleted in
finallyblocks โ no disk leaks.
Shared Zod validation schemas and TypeScript types (ScanResultType, AudioUploadSchema, etc.) consumed by both apps/api and apps/web.
GitHub Actions cron job that pings both Render services every 14 minutes to prevent cold starts on the free tier.
schedule:
- cron: "*/14 * * * *"Pings:
- API:
https://satark-ai-f5t7.onrender.com/ - Engine:
https://satark-ai-es1v.onrender.com/
| Requirement | Version |
|---|---|
| Node.js | v18+ |
| Python | 3.11+ |
| PostgreSQL | 14+ |
| Docker (optional) | Latest |
1. Clone the Repository
git clone https://github.com/theunstopabble/Satark-AI.git
cd Satark-AI2. Install Node.js Dependencies
npm install # installs all workspaces via Turborepo3. Install Python Dependencies (AI Engine)
cd apps/engine
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt4. Configure Environment Variables
Create .env files in each app directory:
apps/web/.env
VITE_CLERK_PUBLISHABLE_KEY=pk_test_xxxx
VITE_API_URL=http://localhost:3000apps/api/.env
DATABASE_URL=postgresql://user:password@localhost:5432/satark_db
CLERK_SECRET_KEY=sk_test_xxxx
CLERK_PUBLISHABLE_KEY=pk_test_xxxx
ALLOWED_ORIGINS=http://localhost:5173
ENGINE_URL=http://localhost:8000apps/engine/.env
# No required vars โ models download from HuggingFace on first run5. Run Database Migrations
cd apps/api
npx drizzle-kit push6. Start All Services
| Terminal | Command |
|---|---|
| Terminal 1 โ Frontend | cd apps/web && npm run dev |
| Terminal 2 โ API Gateway | cd apps/api && npm run dev |
| Terminal 3 โ AI Engine | cd apps/engine && uvicorn main:app --reload --port 8000 |
Or run everything at once from root:
npm run dev # Turborepo orchestrates all three concurrently# Copy and fill in your .env values first
cp .env.example .env
docker-compose up --buildServices will start at:
- Frontend:
http://localhost:5173 - API Gateway:
http://localhost:3000 - AI Engine:
http://localhost:8000
Docker security hardening included:
- Non-root user (
appuser) in the engine container no-new-privileges:truesecurity option on all servicestmpfsmount for/tmpin API and web containers
| Service | Platform | URL |
|---|---|---|
Frontend (apps/web) |
Vercel | satark-deepfake.vercel.app |
API Gateway (apps/api) |
Render | satark-ai-f5t7.onrender.com |
AI Engine (apps/engine) |
Render | satark-ai-es1v.onrender.com |
| Image Proxy (Worker) | Cloudflare Workers | satark-image-proxy.gautamkumar43421.workers.dev |
| Database | Supabase / Neon / Railway | PostgreSQL (SSL enabled) |
Vercel config (apps/web/vercel.json) โ SPA routing rewrites all paths to index.html.
| Layer | Mechanism | Detail |
|---|---|---|
| Authentication | Clerk JWT | All protected routes verify token server-side |
| Authorization | Context-scoped userId | userId extracted from auth token โ never trusted from request body |
| Speaker isolation | DB-level scoping | Verify queries filter by userId โ no cross-user voice data access |
| Speaker threshold | Cosine similarity โฅ 0.75 | Strict match threshold prevents false identity confirmations |
| File handling | UUID-prefixed temp files | Uploaded files stored with random UUID prefix, deleted post-processing |
| Container | Non-root user | Engine runs as appuser โ no root privileges inside Docker |
| Connection pool | pg Pool | Max 20 connections, 5s timeout, graceful error recovery |
| Image proxy CORS | Origin whitelist | Worker rejects requests from unlisted origins โ no wildcard * |
| Image size limit | Double-layer check | Enforced via content-length header + actual byteLength post-read (5MB cap) |
| HF key isolation | Cloudflare Secrets | HF_API_TOKEN never exposed to frontend โ stored in Worker environment only |
| Variable | App | Required | Description |
|---|---|---|---|
VITE_CLERK_PUBLISHABLE_KEY |
web | โ | Clerk frontend public key |
VITE_API_URL |
web | โ | Backend API base URL |
DATABASE_URL |
api | โ | PostgreSQL connection string |
CLERK_SECRET_KEY |
api | โ | Clerk backend secret key |
CLERK_PUBLISHABLE_KEY |
api | โ | Clerk public key (for validation) |
ALLOWED_ORIGINS |
api | โ | CORS allowed origins (comma-separated) |
ENGINE_URL |
api | โ | FastAPI engine base URL |
IMAGE_API_URL |
api | โ | Cloudflare Worker URL for image deepfake proxy |
HF_API_TOKEN |
cloudflare-worker | โ | Hugging Face API token โ set as Cloudflare Worker Secret |
Note on
HF_API_TOKEN: This is stored viawrangler secret put HF_API_TOKENand is never in source code or.envfiles. It lives exclusively in Cloudflare's encrypted secret store. Get one free at https://huggingface.co/settings/tokens
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create a feature branch (
git checkout -b feat/your-feature) - Commit your changes (
git commit -m 'feat: add your feature') - Push to the branch (
git push origin feat/your-feature) - Open a Pull Request
Gautam Kumar โ Full-Stack Developer | Solo-shipped SaaS Products | AI Integration
๐ From Sitamarhi, Bihar ยท Currently in Jaipur, Rajasthan
This project is licensed under the MIT License โ see the LICENSE file for details.
Satark-AI โ Because the truth still matters.
| Project | Description | Link |
|---|---|---|
| Portfolio | Personal portfolio & developer profile | gautam-kr.vercel.app |
| InterviewMinds | Production-grade AI Mock Interview Platform | interviewminds.vercel.app |
| SwadKart | Multi-vendor food delivery platform with AI chatbot | swadkart.vercel.app |
| TexFolio | AI-powered LaTeX resume builder with RBAC | texfolio.vercel.app |




