(Quickly Vibe-coded project for fun & testing)
A web application that fact-checks social media posts using AI. Paste any social media link and get an AI-powered analysis of its truthfulness.
- π Multi-platform support - Instagram, Twitter/X, TikTok, Facebook, YouTube, and more
- π€ AI-powered vision analysis - Mistral Pixtral analyzes images for claims
- πΌοΈ Parallel image processing - Multiple images analyzed simultaneously for speed
- π Real-time progress - Server-Sent Events (SSE) for live updates
- β Comprehensive verdicts - Verified, False, Misleading, Partially True, Unverifiable, Satire, No Claim
- π Claims breakdown - Individual analysis of each claim with evidence
- π Source references - Reputable sources cited for verification
- π¨ Beautiful dark UI - Mysterious black/blue/white theme with smooth animations
βββββββββββββββ
β Frontend β React + TypeScript + Tailwind
β (Port 5173)β
ββββββββ¬βββββββ
β HTTP/SSE
βΌ
βββββββββββββββββββββββ
β Backend (Go) β Chi router + concurrent processing
β (Port 8080) β
ββββββββ¬βββββββββββββββ
β
βββΊ Mistral AI (Vision + Reasoning)
β β’ Pixtral Large (image analysis)
β β’ Mistral Large (fact-checking)
β
βββΊ Instagram Service (Python/Flask)
β’ Port 5001
β’ Downloads Instagram media
β’ Returns base64-encoded images
| Component | Technology | Purpose |
|---|---|---|
| Frontend | React + TypeScript | User interface with real-time updates |
| Backend | Go 1.21+ | Fact-checking orchestration, parallel processing |
| AI Provider | Mistral AI | Vision analysis (Pixtral) + reasoning (Large) |
| Instagram Service | Python/Flask | Instagram-specific scraping using Instaloader |
- Go 1.21+ - Install Go
- Python 3.9+ - Install Python
- Node.js 18+ - Install Node.js
- Mistral API Key - Get one here
cd instagram-service
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the service
python app.pyThe Instagram service will be running at http://localhost:5001
cd backend
# Set up environment
cp .env.example .env
# Edit .env and add your MISTRAL_API_KEY
# Install dependencies
go mod tidy
# Run the server
go run main.goThe API will be running at http://localhost:8080
cd frontend
# Install dependencies
npm install
# Start dev server
npm run devThe app will be running at http://localhost:5173
Open your browser and go to http://localhost:5173
fact-checker-web/
βββ backend/ # Go API server
β βββ main.go # Entry point
β βββ go.mod # Go dependencies
β βββ .env.example # Environment template
β βββ config/
β β βββ config.go # Environment config loader
β βββ handlers/
β β βββ handlers.go # HTTP handlers (REST + SSE)
β βββ models/
β β βββ models.go # Data structures
β βββ prompts/ # AI prompt templates
β β βββ loader.go # Template loader (uses embed)
β β βββ assets/ # Prompt .txt files
β β βββ image_analysis.txt
β β βββ condense_system.txt
β β βββ evaluate_system.txt
β βββ services/
β βββ ai/ # AI providers (modular architecture)
β β βββ factory.go # Provider factory + auto-detection
β β βββ types/
β β β βββ types.go # Config + Provider interface
β β βββ mistral/
β β βββ types.go # Mistral API types
β β βββ client.go # HTTP client
β β βββ provider.go # Provider implementation
β βββ scrapers/ # Platform-specific scrapers
β β βββ scraper.go # Scraper interface
β β βββ instagram.go # Instagram (via Python service)
β β βββ generic.go # Generic meta-tag scraper
β βββ aiservice.go # High-level AI orchestration
β βββ factcheck.go # Main workflow engine
β βββ scraper.go # Scraper registry
β
βββ instagram-service/ # Python Flask service
β βββ app.py # Flask application
β βββ requirements.txt # Python dependencies
β βββ config.py # Configuration
β βββ routes/
β β βββ instagram_routes.py # API routes
β βββ utils/
β βββ instagram_utils.py # Instaloader wrapper
β
βββ frontend/ # React app
βββ package.json
βββ vite.config.ts
βββ tailwind.config.js
βββ src/
βββ App.tsx # Main component
βββ index.css # Global styles
βββ api/
β βββ factcheck.ts # API client
βββ components/
β βββ BackgroundEffects.tsx # Animated background
β βββ LoadingView.tsx # Progress display
β βββ ResultView.tsx # Fact-check results
βββ types/
βββ index.ts # TypeScript types
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
POST |
/api/check |
Start a new fact-check |
GET |
/api/check/{id} |
Get check status and result |
GET |
/api/check/{id}/stream |
SSE stream for real-time progress |
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
POST |
/fetch |
Download Instagram post media |
curl -X POST http://localhost:8080/api/check \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.instagram.com/p/ABC123/",
"caption": "Optional manual caption"
}'Response:
{
"id": "uuid-here",
"status": "processing",
"progress": 0,
"currentStep": "Initializing..."
}const eventSource = new EventSource(
'http://localhost:8080/api/check/{id}/stream'
);
eventSource.onmessage = (event) => {
const update = JSON.parse(event.data);
console.log(update.step, update.progress, update.message);
};Create .env in backend/ directory:
# Server Configuration
PORT=8080
HOST=0.0.0.0
DEBUG=false
# AI Provider (required)
AI_PROVIDER=mistral
MISTRAL_API_KEY=your_mistral_api_key_here
# External Services
INSTAGRAM_SERVICE_URL=http://localhost:5001
# Future providers (auto-detected):
# OPENAI_API_KEY=your_openai_key
# ANTHROPIC_API_KEY=your_anthropic_keyThe Instagram service is configured via instagram-service/config.py:
class Config:
SERVICE_NAME = "instagram-service"
PORT = 5001
# Instaloader settings
DOWNLOAD_VIDEOS = False
DOWNLOAD_VIDEO_THUMBNAILS = False
DOWNLOAD_GEOTAGS = False
DOWNLOAD_COMMENTS = False
SAVE_METADATA = False1. URL Submission
β
2. Platform Detection
β (Instagram β Python service, Others β Generic scraper)
3. Content Scraping
β (Extract caption, author, images as base64)
4. Parallel Image Analysis β‘
β (Multiple images analyzed simultaneously)
βββΊ Image 1 β Mistral Pixtral β Analysis 1
βββΊ Image 2 β Mistral Pixtral β Analysis 2
βββΊ Image 3 β Mistral Pixtral β Analysis 3
β
5. Information Condensing
β (Extract key claims from all analyses)
6. Truthfulness Evaluation
β (Fact-check claims with reasoning)
7. Result Compilation
β (Build structured response with verdicts + sources)
8. Complete β
Performance: A post with 3 images typically completes in 10-15 seconds (with parallel processing, images are analyzed in ~2-4s instead of ~6-12s sequentially).
| Verdict | Color | Meaning |
|---|---|---|
| β Verified | Green | Confirmed as true by reliable sources |
| β False | Red | Proven false by evidence |
| Orange | Contains truth but missing critical context | |
| β Partially True | Yellow | Some parts true, some false |
| β Unverifiable | Gray | Cannot be verified with available sources |
| π Satire | Purple | Intentional satire/parody |
| β No Claim | Blue | No factual claims made |
-
Create provider package:
backend/services/ai/openai/ βββ types.go # API types βββ client.go # HTTP client βββ provider.go # Provider implementation -
Implement the
types.Providerinterface:type Provider interface { Name() string Chat(message string) (string, error) ChatWithSystem(systemPrompt, message string) (string, error) AnalyzeImage(imageData string, prompt string) (string, error) SupportsVision() bool }
-
Register in factory (
services/ai/factory.go):case "openai": return openai.NewProvider(config), nil
-
Add to auto-detection:
if key := os.Getenv("OPENAI_API_KEY"); key != "" { return NewProvider(Config{Provider: "openai", APIKey: key}) }
See backend/README.md for detailed extension documentation.
-
Create scraper file (
services/scrapers/tiktok.go):func (s *TikTokScraper) CanHandle(url string) bool { return strings.Contains(url, "tiktok.com") } func (s *TikTokScraper) Scrape(url string) (*models.ContentInfo, error) { // Your implementation }
-
Register in scraper service (
services/scraper.go):scrapers: []scrapers.Scraper{ scrapers.NewInstagramScraper(), scrapers.NewTikTokScraper(), // Add here scrapers.NewGenericScraper(), // Keep last }
# Backend tests
cd backend
go test ./...
go test -cover ./...
# Frontend tests
cd frontend
npm test
npm run test:coverage# Backend
cd backend
go build -ldflags="-s -w" -o factchecker
# Frontend
cd frontend
npm run build# Example Dockerfile for backend
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY backend/ .
RUN go build -o factchecker .
FROM alpine:latest
COPY --from=builder /app/factchecker /factchecker
EXPOSE 8080
CMD ["/factchecker"]Typical Processing Times:
- Instagram scraping: 1-3s (network + Python service)
- Image analysis: 2-4s per image (parallel, so max time not sum)
- Claim condensing: 2-3s
- Fact evaluation: 3-5s
- Total: ~10-15s for a post with 3 images
Bottlenecks:
- Instagram service (network latency)
- AI vision requests (image size matters)
- AI reasoning (complex claims take longer)
Optimizations Applied:
- β Parallel image analysis (3x speedup for 3 images)
- β Base64 encoding (faster than URL fetching)
- β Goroutines for concurrent processing
- β Connection pooling for HTTP clients
- β API keys loaded from environment
- β CORS configured for frontend origin
- β No credentials in version control
β οΈ No rate limiting (add for production)β οΈ No authentication (add for production)
Production Checklist:
- Add rate limiting middleware
- Add API key authentication
- Validate and sanitize URLs
- Configure HTTPS
- Restrict CORS to specific origins
- Add request timeout handling
# Check if service is running
curl http://localhost:5001/health
# Check logs
cd instagram-service
python app.py # Run in foreground to see errors# Verify API key
echo $MISTRAL_API_KEY
# Test with curl
curl https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"mistral-large-latest","messages":[{"role":"user","content":"test"}]}'# Check environment
cd backend
cat .env
# Check logs
go run main.go # Look for configuration errors- Go Backend Architecture: See
backend/README.mdfor detailed documentation - Mistral AI Docs: https://docs.mistral.ai/
- Instaloader Docs: https://instaloader.github.io/
- React Documentation: https://react.dev/
This is a test/demo project, but contributions are welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project for learning or as a starting point for your own fact-checker!
- Add OpenAI provider (GPT-4 Vision)
- Add Anthropic provider (Claude 3)
- Support video content (TikTok, YouTube)
- Add result caching (Redis)
- Add user authentication
- Add historical fact-check database
- Add browser extension
- Add API rate limiting
- Add Prometheus metrics
- Deploy to production (AWS/GCP)
Built with β€οΈ using Go, Python, React, and AI