Complete instructions to run TruthStream locally with backend, frontend, and all features working.
- Python 3.11+
- Node.js 18+
- npm or yarn
- Git
# 1. Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 2. Install dependencies
pip install -e '.[dev]'
# 3. Run tests
pytest
ruff check .
# 4. Start API server
uvicorn truthstream.api:app --reloadBackend runs at: http://127.0.0.1:8000
Test health: curl http://127.0.0.1:8000/health
# 1. Navigate to frontend
cd frontend
# 2. Install dependencies
npm install
# 3. Start dev server
npm run devFrontend runs at: http://127.0.0.1:5173
- Open http://127.0.0.1:5173 in your browser
- You should see the TruthStream landing page
- Displays tagline: "Verify claims with sources, confidence, and context."
- Has "Verify a claim" and "Learn how it works" buttons
- Shows example stats
- Click "Verify a claim" or navigate to Verify
- Input field accepts claim text
- Example:
"India banned AI systems" - Click "Verify claim"
- Backend returns results with confidence, evidence, status
- Try:
"Country X has banned AI systems." - Expected: Confidence ~0%, status "likely_false", 2 contradicting evidence items
- Evidence shows: Official Government Registry, Trusted News Wire
- Green cards for supporting evidence
- Red cards for contradicting evidence
- Blue cards for neutral evidence
- Each shows: title, snippet, source, credibility %, link
- Large percentage displayed (0-100%)
- Gradient bar from red → amber → green
- Status badge (Likely True, Mixed, Likely False, Insufficient Evidence)
- Click "Open source ↗" on evidence cards
- Opens source in new tab (where applicable)
- Verify a claim first (enables history)
- Click "History" in nav
- Previous verification appears with timestamp
- Shows full result panel
- "Clear history" button works
- API base URL field: shows
/api(proxy) - Can change to direct backend URL (e.g.,
http://127.0.0.1:8000) - Dark mode toggle: switches theme
- Save history toggle: controls local history
- Settings persist in localStorage
- Default: enabled (dark background)
- Toggle in Settings
- All pages respect theme
- Text, cards, backgrounds adjust
- Smooth transition
- Resize browser window
- Mobile (< 640px): stacked layout
- Tablet (640-1024px): 2-column where applicable
- Desktop (> 1024px): full width
- Navigation wraps on mobile
- All buttons and inputs remain accessible
- Explains 4-step verification flow
-
- Extract claims
-
- Retrieve evidence
-
- Score confidence
-
- Show the work
- Backend port 8000 in use?
uvicorn truthstream.api:app --reload --port 8001
- Frontend port 5173 in use?
cd frontend && npm run dev -- --port 5174
- Update Settings page API URL to match new backend port
- Python:
pip install --upgrade pip setuptools wheel - Node:
npm installagain, deletenode_modules/and.npmcache - TypeScript errors:
cd frontend && npm run build
- Verify backend is running:
curl http://127.0.0.1:8000/health - Check Settings page API URL is correct
- Check browser console (F12) for CORS errors
- Vite proxy should handle it automatically
- Frontend TypeScript:
npm run buildshows all errors - Backend:
pytestvalidates all imports
Default mode uses deterministic demo evidence. Enable real providers (Wikipedia, Crossref, OpenAlex):
TRUTHSTREAM_EVIDENCE_MODE=real uvicorn truthstream.api:app --reloadResults will include real scholarly and encyclopedic evidence (slower, requires network).
# Basic verification
truthstream "India banned AI systems."
# Pretty-print output
truthstream --pretty "India banned AI systems."
# Real evidence mode
truthstream --evidence real --pretty "Recent AI research increased in 2024."
# Read from stdin
echo "Country X has banned AI systems." | truthstream --prettyTruthstream/
├── src/truthstream/ # Backend
│ ├── api.py # FastAPI app
│ ├── cli.py # CLI entrypoint
│ ├── pipeline.py # Verification orchestration
│ ├── extraction.py # Claim extraction
│ ├── evidence.py # Retriever abstractions
│ ├── providers.py # Real evidence providers
│ ├── scoring.py # Confidence scoring
│ ├── models.py # Domain models
│ └── settings.py # Config
├── tests/ # Backend tests
├── frontend/ # Frontend
│ ├── src/
│ │ ├── pages/ # React pages (Home, Verify, History, About, Settings)
│ │ ├── components/ # Reusable UI components
│ │ ├── lib/ # Utilities (API, storage, formatting)
│ │ ├── types/ # TypeScript types
│ │ └── styles.css # Tailwind + custom CSS
│ ├── vite.config.ts # Vite configuration + proxy
│ └── tailwind.config.js # Tailwind theme
├── pyproject.toml # Python dependencies and config
├── README.md # Project overview
└── SETUP.md # This file
Incoming Claim
↓
Frontend (React)
↓
/verify API
↓
Verification Pipeline
├── Claim Extraction (heuristic)
├── Evidence Retrieval (demo or real providers)
├── Confidence Scoring (credibility + recency weighted)
└── Explanation Generation
↓
VerificationResult
↓
API Response (JSON)
↓
Frontend Rendering
├── Confidence Meter
├── Evidence Cards
├── Source Links
└── Explanation
↓
User sees result
# Run all tests
pytest
# Run with coverage
pytest --cov=src/truthstream
# Run specific test
pytest tests/test_api.py::test_verify_endpoint
# Lint
ruff check .
ruff format src/ tests/- Verify all 12 features above work
- Try different claims to see how confidence changes
- Enable real providers for more evidence
- Explore the codebase architecture
- Consider adding features (e.g., persistent database, auth, more providers)
If something breaks:
- Check Prerequisites (Python 3.11+, Node 18+)
- Delete virtual env and node_modules, reinstall
- Run
pytestandnpm run buildto catch errors - Check issue descriptions in the codebase