A fullstack Fake News Detector using FastAPI as backend and Svelte as frontend for scoring news, highlighting token contributions, and a fact-checking agent.
pydantic-ai detector-backend/: FastAPI app (app/main.py) plus classifier, fact-check agent, pipelines, and tests.detector-frontend/: Svelte single-page UI; Nginx config proxies /api to the backend.docker-compose.yml: Local stack (frontend, backend, Mongo).docker-compose.prod.yml: prebuilt GHCR images.The default compose file builds everything locally and exposes the frontend on port 80 and backend on port 8000.
Clone the repo.
Start the stack:
docker compose up --build
Open http://localhost for the UI. The backend API is at http://localhost:8000.
The prod compose file uses prebuilt GHCR images
cd detector-backend
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
cd detector-frontend
npm install
VITE_API_URL=http://localhost:8000/api npm run dev -- --host
npm run build && npm run previewBase URL /api.
POST /predict body: { "text": "..." } classifier label (fake|real) with confidence.POST /highlight body: { "text": "..." } token list with SHAP scores (score_normalized for heatmap).POST /fact-check body: { "text": "..." } structured fact-check (fake_score, summary_analysis, checked_claims).GET /health simple { "status": "ok" }.Example:
curl -X POST http://localhost:8000/api/predict \
-H "Content-Type: application/json" \
-d '{"text":"Example news paragraph"}'
docker-compose.prod.yml uses published images (ghcr.io/kon-drees/fake-news-detector-{backend,frontend}:latest).OPENAI_API_KEY on the backend service.