Tagline: A student-built, AI-powered investigative mini-newspaper for spotting false claims. Built solo, polished, and ready to work.
The Truth Gazette helps students, teachers, and community members quickly assess short claims, headlines, URLs, and images. It uses server-side prompt engineering with a generative model (Gemini) and server-side trusted source grounding to produce:
- A verdict: REAL / FAKE / UNCERTAIN
- Confidence % (human-readable explanation)
- A short investigation report divided into readable paragraphs
- Key findings and a list of authoritative clickable sources (government, research orgs, academic journals). Community-driven sites (e.g., Reddit, Quora) are used only for internal cross-checks and are never exposed in the public sources list.
- Text, URL, and image inputs (image OCR for text-in-image claims)
- Structured, human-readable JSON output from the model (verdict, confidence, sources)
- Server-side proxy for API calls (no keys in the frontend)
- Upstash-based rate limiting, caching, and daily quota support (server-side)
- Source filtering to show only authoritative public sources
- A "lights-out" flashlight easter egg (Shift+L)
- Install dependencies:
cd TruthGazette npm ci - Start the dev server (Vercel CLI recommended):
vercel dev --listen 3000(requires Vercel CLI)- or run your preferred serverless dev environment
- Run tests (against your running dev server):
TEST_BASE_URL=http://localhost:3000 npm test
Notes:
- The frontend no longer contains API keys. All AI calls must go through
/api/investigatewhich reads keys from environment variables on the server. - The client sends an
X-Session-Idheader (stored inlocalStorage) to enable session-based rate limiting. Optionally setREQUIRE_SESSION_ID=1in staging/production to require session IDs for all requests.
Environment variables used:
GEN_API_KEY,GEN_MODEL(required for model access)UPSTASH_REDIS_REST_URL,UPSTASH_REDIS_REST_TOKEN(optional, enable server-side rate limiting)REQUIRE_SESSION_ID(optional, set to1to enforce session header)DAILY_QUOTA(optional, default200)RATE_LIMIT_PER_MIN(optional, default20)ALLOW_TEST_HEADERS(optional, set to1to allowX-TEST-RL-LIMITheader for local tests)RUN_RATE_LIMIT_TEST(used by test harness to run the rate-limit test)- You can run the test harness in
test/run_tests.jsto validate behavior for the test cases inTEST_CASES.md. - The test runner also checks for accidental hardcoded keys in front-end files within this directory to prevent leaks.
- Licensed under the MIT License (see
LICENSE). - If you'd like to contribute or adapt, follow
CONTRIBUTING.md.