--- Inspiration
Misinformation doesn't spread through long articles. It spreads through screenshots, forwarded messages, and out-of-context headlines that people see for three seconds before sharing. By the time a human fact-checker publishes a correction, the damage is done.
I wanted to build something that works at the speed misinformation actually travels - paste a claim or drop a screenshot and get an honest, source-backed verdict in seconds, not days.
What it does
TruthLens analyzes any piece of content - text, a URL, or a screenshot - and returns a credibility verdict backed by real-time web sources. It extracts key claims, scores each one, detects political bias, flags red flags, and cites the actual sources it used to reach its conclusion.
There's also a Chrome extension that adds a fact-check badge to any article or news page you visit, so you never have to leave the site to verify what you're reading.
How I built it
The core is a Next.js 15 API route that passes user input to Gemini 2.5 Flash with the Google Search grounding tool enabled. This means every analysis is backed by live web results fetched at the moment of the request - not just training data. Gemini returns a structured JSON verdict that the frontend renders into a readable result.
For image analysis, I pass the screenshot directly as a base64 inline image to Gemini's multimodal endpoint. It reads the text in the image and fact-checks it the same way it would text input.
The Chrome extension uses Manifest V3, injects a floating badge into article pages via a content script, and calls the same API endpoint. Shareable results are encoded as base64 URL parameters so anyone can open a link and see the full analysis with no database required.
Challenges I ran into
The biggest surprise was hitting a wall with model deprecations mid-build. gemini-2.0-flash returned a 404 for new API keys with no warning - had to dig through the error response and pivot to gemini-2.5-flash. Similarly, the googleSearchRetrieval tool had been replaced by googleSearch in newer models, but the SDK types hadn't caught up, so TypeScript was throwing errors for valid API calls.
Getting the Chrome extension to communicate with the API was also trickier than expected. Content scripts follow the same CORS rules as regular web pages, so direct API calls were blocked. The fix was adding proper CORS headers to the Next.js API route.
What I learned
Gemini's multimodal capabilities are more powerful than I expected. Feeding a screenshot of a tweet and getting back a structured, sourced fact-check in one API call is genuinely impressive. The Google Search grounding feature is what makes the tool trustworthy - it's not just an LLM guessing, it's actively searching for evidence.
I also learned that the hardest part of building a fact-checking tool isn't the AI - it's the prompt engineering. Getting the model to return consistent, parseable JSON with the right level of nuance (not just "true" or "false" but actual claim-by-claim breakdowns) took a lot of iteration.
What's next for TruthLens
- Publish the extension to the Chrome Web Store for one-click installs
- Add a history log so users can review past analyses
- Highlight suspicious sentences directly inside articles without needing to open a popup
- Build a public API so developers can integrate TruthLens into their own apps
Built With
- chrome-extension-api
- gemini-2.5-flash
- google-generative-ai-sdk
- google-search-grounding
- lucide-react
- next.js
- playwright
- react
- tailwind-css
- typescript
- vercel

Log in or sign up for Devpost to join the conversation.