Trueplexity - Project Details

Inspiration

In today's digital age, misinformation spreads faster than ever before. We've all seen misleading claims go viral on social media, watched friends and family share dubious "facts," and struggled to determine what's true in an ocean of content. Traditional fact-checking is slow, manual, and can't keep pace with the volume of information being created every second.

We were inspired to build Trueplexity after recognizing that while AI has made tremendous advances in understanding language and searching information, these capabilities hadn't been fully harnessed for real-time fact verification accessible to everyone. The rise of powerful APIs like Perplexity's Search and Sonar presented a unique opportunity: what if we could combine state-of-the-art web search with advanced language models to create an intelligent fact-checking assistant?

Our vision was simple but ambitious: empower every person to verify information instantly, transparently, and confidently.


What it does

Trueplexity is an AI-powered fact verification platform that transforms how people verify claims and combat misinformation.

Core Functionality:

  1. Instant Claim Verification: Users submit any claim they want to verify - from social media posts to news articles to casual conversations. Trueplexity immediately begins analyzing.

  2. Intelligent Web Search: Using Perplexity's Search API, the platform searches the web for relevant, credible sources related to the claim. It performs multiple targeted searches (up to 10 per claim) to gather comprehensive evidence.

  3. AI-Powered Analysis: Perplexity Sonar language models analyze all discovered sources, understanding context, identifying contradictions, and assessing the claim's veracity with sophisticated reasoning.

  4. Trueplexity Score: The platform generates a proprietary 0-100 score indicating the claim's credibility based on:

    • Strength of evidence from sources
    • Credibility of source domains
    • Consistency across multiple sources
    • Confidence in the AI analysis
  5. Transparent Results: Users see not just a score, but:

    • All sources used in the analysis
    • Credibility ratings for each source
    • Detailed explanation of the reasoning
    • Direct citations and quotes from sources
  6. Conversational Follow-up: Users can ask follow-up questions, request additional sources, or dive deeper into specific aspects of the claim through a natural chat interface.

  7. Multi-Language Support: Full support for English and French, making fact-checking accessible to more users.

  8. User Dashboard: Track past verifications, review history, and provide feedback on analysis quality.

Real-World Use Cases:

  • Journalists verify sources before publishing
  • Researchers fact-check academic claims
  • Social media users verify viral posts before sharing
  • Educators teach students critical thinking and source evaluation
  • Anyone navigating daily information wants to verify what they read

How we built it

Trueplexity was built with a modern, scalable architecture leveraging cutting-edge technologies:

Backend Architecture

FastAPI Framework: We chose FastAPI for its excellent async support, automatic API documentation, and Python type safety. This was crucial for handling streaming responses and maintaining high performance.

Perplexity API Integration:

  • Search API: Implemented PerplexityWebSearchService with exponential backoff and rate limiting (3 req/sec) to discover and rank sources
  • Sonar API: Integrated via OpenAI-compatible client for seamless LLM access, supporting multiple models (sonar, sonar-pro, sonar-reasoning)
  • Custom SSL Support: Added corporate certificate support for enterprise deployments

Analysis Orchestration: Built AnalysisOrchestrator as the brain of the system:

  • Manages multi-turn search-analyze cycles (up to 10 iterations)
  • Coordinates between LLM and web search services
  • Handles streaming responses for real-time user feedback
  • Implements sophisticated prompt engineering for optimal results

Data Layer:

  • PostgreSQL 13 with async SQLAlchemy for robust data persistence
  • Repository pattern for clean separation of concerns
  • Alembic migrations for database version control
  • Domain models separate from database models for flexibility

Authentication & Security:

  • Auth0 integration for enterprise-grade authentication
  • JWT token validation middleware
  • Secure credential management via environment variables
  • CORS configuration for cross-origin requests

Frontend Architecture

Next.js 15 + React 19: Leveraged the latest features:

  • App Router for modern routing patterns
  • Server-side rendering for performance
  • Streaming for real-time analysis updates
  • React 19's enhanced concurrent features

TypeScript Throughout: Ensured type safety across the entire frontend codebase, reducing bugs and improving developer experience.

SCSS Modules: Component-scoped styling for maintainable, conflict-free CSS with modern Sass features.

Chart.js Integration: Built interactive visualizations for:

  • Trueplexity Score displays
  • Source credibility breakdowns
  • Historical analysis trends

Internationalization: Implemented next-intl for seamless English/French switching with proper locale management.

DevOps & Deployment

Containerization: Docker and Docker Compose for:

  • Consistent development environments
  • Easy local setup
  • Production-ready deployments
  • PostgreSQL database orchestration

Testing Strategy:

  • pytest for backend unit and integration tests
  • Target >90% code coverage
  • Mock external API calls for reliable tests
  • Test fixtures for database state management

API Documentation:

  • Automatic OpenAPI/Swagger documentation
  • Interactive API testing via Swagger UI
  • ReDoc for beautiful, browsable documentation

Development Process

  1. Requirements Analysis: Defined clear EARS notation requirements for all features
  2. Architecture Design: Created comprehensive technical design documents
  3. Iterative Development: Built features incrementally with continuous testing
  4. Integration: Connected frontend and backend with streaming SSE
  5. Testing & Refinement: Comprehensive testing of edge cases and error scenarios
  6. Documentation: Created extensive documentation for developers and users

Challenges we ran into

1. Real-Time Streaming Complexity

Challenge: Implementing Server-Sent Events (SSE) for real-time analysis streaming was more complex than anticipated. We needed to coordinate between multiple async operations (LLM streaming, database updates, search API calls) while maintaining a clean, uninterrupted stream to the frontend.

Solution: Built a sophisticated event generation system in AnalysisOrchestrator that yields structured events (status, content, complete) and carefully managed async context to prevent premature session closures.

2. Rate Limit Management

Challenge: Perplexity Search API has a 3 requests/second rate limit. During multi-turn analysis (up to 10 searches), we risked hitting rate limits and degrading user experience.

Solution: Implemented exponential backoff with jitter and configurable retry logic. Added intelligent search query generation to minimize unnecessary searches while maintaining analysis quality.

3. LLM Response Parsing

Challenge: Extracting structured data (Trueplexity Score, confidence metrics) from LLM responses proved difficult. Models sometimes returned JSON, sometimes plain text, and occasionally malformed responses.

Solution: Implemented dual parsing strategies - primary JSON parsing with regex fallback. Added robust error handling and validation to ensure we always extract meaningful scores even from imperfect responses.

4. Source Credibility Scoring

Challenge: Determining domain credibility objectively is inherently subjective. We needed a system that could assess sources without hardcoding biases.

Solution: Built a dynamic domain service that tracks historical accuracy, allows user feedback, and aggregates credibility scores over time. Started with neutral scores and let the system learn from usage patterns.

5. Database Session Management

Challenge: Async SQLAlchemy sessions in streaming contexts caused connection leaks and transaction issues when errors occurred mid-stream.

Solution: Implemented careful session lifecycle management with proper cleanup in finally blocks and context managers. Added comprehensive error handling to ensure sessions always close properly.

6. Frontend Authentication Flow

Challenge: Coordinating Auth0 authentication between Next.js frontend and FastAPI backend, especially handling token refresh and session management.

Solution: Used @auth0/nextjs-auth0 for frontend session management and built custom middleware in backend to validate tokens. Implemented proper CORS configuration and credential handling.

7. Multi-Language Prompt Engineering

Challenge: Creating prompts that work effectively for both English and French required different phrasing and cultural context awareness.

Solution: Developed language-specific prompt templates with native speaker input. Implemented conditional prompt selection based on detected language and extensive testing with bilingual test cases.

8. Corporate SSL Certificates

Challenge: Deploying in enterprise environments with custom SSL certificates caused HTTPS request failures for Perplexity API calls.

Solution: Added configurable SSL certificate support allowing custom CA bundle injection for both LLM and Search API clients. Documented clearly for enterprise deployments.


Accomplishments that we're proud of

๐ŸŽฏ Seamless Perplexity Integration

We successfully integrated both Perplexity Search and Sonar APIs into a cohesive system that feels natural and responsive. The combination of real-time web search with intelligent LLM analysis creates a powerful fact-checking experience that neither could achieve alone.

๐Ÿ“Š The Trueplexity Score Algorithm

Developed a proprietary scoring system that meaningfully combines source credibility, evidence strength, and AI confidence into a single, interpretable 0-100 score. Users consistently report that the score aligns with their intuition while providing valuable new insights.

โšก Real-Time Streaming Experience

Built a streaming analysis system that keeps users engaged throughout the verification process. Instead of waiting for a loading spinner, users see sources being discovered, analyzed, and scored in real-time - creating transparency and trust.

๐Ÿ—๏ธ Clean, Maintainable Architecture

Implemented a repository pattern, dependency injection, and clear separation of concerns throughout the backend. The codebase is highly testable, extensible, and maintainable - setting a strong foundation for future development.

๐Ÿ”’ Enterprise-Ready Security

Integrated Auth0 authentication, secure credential management, and proper authorization checks throughout the application. The platform is production-ready for enterprise deployment.

๐Ÿ“– Comprehensive Documentation

Created extensive documentation including:

  • Complete README with setup instructions
  • API documentation with interactive Swagger UI
  • Architecture diagrams and design documents
  • Inline code comments explaining complex logic
  • This detailed project story

๐ŸŒ Internationalization Support

Successfully implemented full bilingual support (English/French) across the entire stack - from LLM prompts to UI text to analysis results. This makes fact-checking accessible to millions more users.

๐Ÿงช High Test Coverage

Achieved >90% test coverage for critical services including web search, analysis orchestration, and data repositories. Comprehensive tests ensure reliability and catch regressions early.


What we learned

Technical Learnings

  1. Streaming Async Patterns: Mastered complex async generator patterns in Python for coordinating streaming LLM responses with database operations and client updates.

  2. LLM Prompt Engineering: Discovered that effective prompts require iterative refinement, language-specific customization, and clear structural markers (like "READY" signals) for reliable parsing.

  3. Rate Limit Strategies: Learned that naive retry logic isn't enough - exponential backoff with jitter prevents thundering herd problems and improves overall system stability.

  4. Domain-Driven Design: Separating domain models from database models and implementing repository patterns significantly improved code testability and maintainability.

  5. Next.js 15 Features: Explored cutting-edge features like App Router, Server Components, and React 19's concurrent features for optimal performance.

Product Learnings

  1. Transparency Builds Trust: Users want to see how conclusions are reached, not just the final score. Showing sources, credibility ratings, and reasoning dramatically increased user confidence.

  2. Conversational UX: The ability to ask follow-up questions transformed single-shot fact-checking into an engaging investigative experience. Users appreciated the flexibility.

  3. Real-Time Feedback: Streaming analysis updates kept users engaged and patient during longer analyses. Static loading spinners would have created abandonment.

  4. Score Interpretation: A simple 0-100 score is more accessible than complex multi-dimensional credibility metrics, but requires clear explanation of methodology.

Process Learnings

  1. Requirements First: Writing clear EARS-formatted requirements before coding prevented scope creep and ensured we built what was actually needed.

  2. Incremental Integration: Building services incrementally and testing integrations early caught API compatibility issues before they became architectural problems.

  3. Documentation as Development: Writing documentation alongside code clarified thinking and identified edge cases we hadn't considered.

  4. Error Handling is Critical: In a system integrating external APIs, comprehensive error handling isn't optional - it's the difference between a demo and a product.

API Integration Learnings

  1. Perplexity Search Quality: The Search API's results consistently provided higher-quality, more relevant sources than we expected, validating our choice of provider.

  2. Sonar Model Differences: Different Sonar models (sonar, sonar-pro, sonar-reasoning) have distinct strengths. Configurable model selection lets users choose speed vs. depth.

  3. OpenAI Compatibility: Using OpenAI-compatible APIs meant we could leverage familiar client libraries while using Perplexity's infrastructure - best of both worlds.


What's next for Trueplexity

Immediate Enhancements (Next 1-3 Months)

1. Multi-Provider Search Fallback

  • Add additional search providers (Bing, Google Custom Search) as fallbacks
  • Implement automatic failover when Perplexity API is unavailable
  • Compare results across providers for enhanced reliability

2. Browser Extension

  • Chrome/Firefox extension for in-page fact-checking
  • Right-click any claim to verify without leaving the page
  • Automatic highlighting of dubious claims on news sites and social media

3. Historical Claim Database

  • Cache previously analyzed claims to provide instant results for common claims
  • Build a public database of verified claims for community benefit
  • Implement claim similarity matching to reuse relevant past analyses

4. Enhanced Visualizations

  • Timeline visualizations showing how claim evolved over time
  • Network graphs showing source relationships and citation patterns
  • Comparative analysis showing conflicting information across sources

5. Mobile Applications

  • Native iOS and Android apps for on-the-go fact-checking
  • Photo/screenshot analysis for verifying visual claims
  • Share directly from social media apps to Trueplexity

Medium-Term Goals (3-6 Months)

6. Advanced Source Credibility

  • Machine learning model for domain credibility prediction
  • Integration with fact-checking organization databases (Snopes, PolitiFact)
  • Expert verification system for community source rating

7. Batch Analysis

  • API endpoint for analyzing multiple claims simultaneously
  • Dashboard for journalists/researchers to verify entire articles
  • Export results to PDF/CSV for reporting

8. Collaborative Features

  • Share analyses with colleagues
  • Team workspaces for organizations
  • Annotation and commenting on specific sources or analysis sections

9. Additional Language Support

  • Spanish, German, Mandarin Chinese support
  • Automatic language detection
  • Cross-language source discovery (analyze English sources for French claims)

10. API Access Tiers

  • Public API for developers to integrate Trueplexity into their apps
  • Rate-limited free tier for individuals
  • Premium API access for businesses and news organizations
  • Webhook support for automated workflows

Long-Term Vision (6-12 Months)

11. Image and Video Verification

  • Reverse image search integration for visual claim verification
  • Deepfake detection for manipulated media
  • Video frame analysis for context verification
  • Metadata extraction and analysis

12. Real-Time Monitoring

  • Monitor social media for emerging misinformation trends
  • Alert users when previously verified claims resurface
  • Trending claims dashboard showing what's being verified globally

13. Educational Platform

  • Interactive tutorials on media literacy and source evaluation
  • Classroom tools for educators teaching critical thinking
  • Certification program for expert fact-checkers
  • Public datasets for research and training

14. AI Model Fine-Tuning

  • Train custom models on verified fact-checking data
  • Improve Trueplexity Score accuracy through feedback loops
  • Domain-specific models (medical, political, scientific)

15. Regulatory Compliance & Partnerships

  • EU Digital Services Act compliance for misinformation reporting
  • Partnerships with social media platforms for integrated fact-checking
  • News organization integrations for pre-publication verification
  • Academic partnerships for research validation

Research Initiatives

16. Source Diversity Metrics

  • Measure political/ideological diversity of source sets
  • Identify and mitigate confirmation bias in search results
  • Cross-reference claims across diverse perspectives

17. Claim Evolution Tracking

  • Track how claims mutate as they spread
  • Identify original sources vs. derivatives
  • Measure claim amplification patterns

18. Explainable AI

  • Improve transparency of AI reasoning process
  • Generate human-readable explanations for every decision
  • Allow users to challenge and refine AI assessments

Infrastructure Improvements

19. Performance Optimization

  • Implement Redis caching for frequently accessed data
  • CDN integration for global performance
  • Database query optimization and indexing
  • Horizontal scaling for high-traffic scenarios

20. Advanced Analytics

  • User behavior analytics for product improvement
  • A/B testing framework for UX optimization
  • Analysis quality metrics and continuous improvement
  • Cost optimization for API usage

Our Ultimate Goal

Trueplexity aims to become the trusted, go-to platform for instant fact verification - as natural as googling a question. We envision a world where:

  • Misinformation is caught before it spreads
  • Everyone has access to credible information
  • Critical thinking is enhanced by AI, not replaced by it
  • Source transparency is the norm, not the exception
  • Truth is accessible to all, regardless of technical expertise

We're building more than a tool - we're building a movement toward a more informed, skeptical, and truth-seeking society.

Join us in empowering truth in the age of information.

Built With

Share this project:

Updates