Skip to content

boubli/TruthLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TruthLens Logo

TruthLens ๐Ÿ”๐Ÿฅ—

The Ultimate AI-Powered Nutrition Assistant

Live Demo

Next.js TypeScript Firebase AI Powered License


TruthLens isn't just a calorie counter. It's an intelligent nutrition companion that helps you "see the truth" behind the food you eat.

Built as a modern Progressive Web App (PWA), it combines the power of cloud AI (Groq, Gemini) with self-hosted privacy (Ollama, SearXNG) to instantly analyze products, decode ingredients, and generate personalized health quests.

๐ŸŒŸ Key Features

๐Ÿฅ— Smart Food Analysis

  • ๐Ÿ”Ž Instant Grading: Our proprietary Smart Grade algorithm evaluates products from A (Excellent) to E (Avoid) based on ingredients, processing, and nutrition.
  • ๐Ÿงช Ingredient Decoder: Instantly identifies harmful additives, allergens, and hidden sugars.
  • ๐Ÿ“ท Scanner v2: Built on Native Barcode Detection API (Android/iOS) for instant, 60fps scanning. Features zero-lag redirection, continuous focus, and offline-first detection.

๐Ÿค– "AI Swarm v2" Intelligence

TruthLens uses a unique AI Swarm architecture to race multiple AI providers:

  • Self-Hosted Power: Defaults to your own Azure VM (Llama 3.2) for fast, private, and unlimited inference.
  • Cloud Fallback: Seamlessly switches to Groq (Llama 3) or Gemini 1.5 for complex reasoning.
  • Context-Aware: The /ai-chat remembers your dietary preferences and health goals.

๐Ÿ’Ž Flexible & Lifetime Access

  • Fair Pricing: Monthly subscriptions or a unique Lifetime Deal.
  • Tiered Features:
    • Explorer (Free):
      • Basic AI (Azure Ollama - completely free, no key needed)
      • AI Chat: Available with Bring Your Own Key (BYOK) for Groq/Gemini
      • 10 messages/day with your own API key
      • Basic product scanner (5 scans/day)
      • Limited history (10 items)
    • Plus ($4.99/mo):
      • Everything in Free
      • Platform AI keys included (no BYOK needed)
      • 20 scans/day
      • Global search enabled
    • Pro ($9.99/mo):
      • Unlimited scans & AI chat
      • All premium AI models included
      • Visual search & meal planning
      • PC Builder access
      • Priority support
    • Ultimate ($19.99/mo):
      • All Pro features
      • White label reports
      • Beta access to new features

๐Ÿ’ก Tip for Free Users: You can use AI Chat by adding your own free API keys from Groq or Google AI Studio. Or upgrade to Plus to get platform keys included!

๐Ÿ› ๏ธ Powerful Admin Dashboard

  • Control Center: Manage users, subscriptions, and app config in real-time.
  • Dynamic Logic: Toggle maintenance mode or adjust pricing without redeploying.
  • Infrastructure Config: Configure your self-hosted AI endpoints directly from the UI.

๐Ÿ  Self-Hosted Infrastructure

TruthLens is designed to run its own AI infrastructure for zero API costs and unlimited usage.

Service Purpose Model/Engine Status
Ollama LLM Inference tinyllama (1.1B) โœ… Integrated
SearXNG Web Search Metasearch โœ… Integrated
  • ๐Ÿ”’ Privacy First: Your queries stay on your server when using self-hosted models.
  • ๐Ÿ’ฐ Zero Recurring Costs: No per-token billing.
  • ๐Ÿš€ Configurable: Update URLs in Admin > Settings.

๐Ÿ’ป Developer API Guide

TruthLens exposes a modular service architecture. Here's how to interact with the core systems:

1. AI Service (services/aiService.ts)

The central hub for all intelligence.

import { getSwarmResponse } from '@/services/aiService';

// Races Ollama, Groq, and Gemini to answer
const response = await getSwarmResponse("Is Red Dye 40 bad for kids?");

2. Product Search (app/actions.ts)

Unified interface for OpenFoodFacts + External Search.

import { getProductAction } from '@/app/actions';

// Fetches from DB or scrapes web via SearXNG
const product = await getProductAction("barcode_or_name");

3. System Config (services/systemService.ts)

Dynamic configuration engine backed by Firestore.

import { getSystemSettings } from '@/services/systemService';

// Get dynamic API keys (including self-hosted URLs)
const settings = await getSystemSettings();
console.log(settings.apiKeys.ollamaUrl);

๐Ÿ› ๏ธ Getting Started

  1. Clone the Repo:

    git clone https://github.com/boubli/TruthLens.git
    cd TruthLens
  2. Install Dependencies:

    npm install
  3. Environment Setup: Create .env.local:

    NEXT_PUBLIC_FIREBASE_API_KEY=...
    NEXT_PUBLIC_GEMINI_API_KEY=...
    NEXT_PUBLIC_GROQ_API_KEY=...
  4. Run Development Server:

    npm run dev

๐Ÿ“„ License

Copyright ยฉ 2025 Youssef Boubli. Licensed under the AGPL-3.0.

This project is open source for collaboration. You are welcome to:

  • โœ… Use, study, and modify the code
  • โœ… Contribute via pull requests
  • โœ… Fork for personal/educational use

You may NOT:

  • โŒ Rebrand and redistribute as your own product
  • โŒ Use commercially without open-sourcing your modifications

๐Ÿ—บ๏ธ Roadmap & Future Plans

We're building TruthLens to be the most comprehensive nutrition assistant. Here's what's plannedโ€”contributions welcome!

๐Ÿ”ฅ High Priority

Feature Description Difficulty
๐ŸŒ Multi-language Support i18n for Arabic, French, Spanish, German Medium
๐Ÿ“Š Nutrition Dashboard Weekly/monthly intake charts & insights Medium
๐Ÿฝ๏ธ Meal Planning AI Generate personalized meal plans based on goals Hard
๐Ÿ‹๏ธ Fitness Integration Sync with Apple Health / Google Fit Hard

โญ Feature Ideas

Feature Description Difficulty
๐Ÿ“ธ Visual Food Recognition AI to identify food from photos Hard
๐Ÿ›’ Shopping List Generator Auto-generate lists from meal plans Medium
๐Ÿ‘ฅ Family Profiles Track nutrition for multiple users Medium
๐ŸŽฎ Gamification Achievements, streaks, health quests Easy
๐Ÿ“ฑ Native Mobile Apps React Native iOS/Android apps Hard
๐Ÿ”” Smart Reminders Hydration, meal timing notifications Easy

๐Ÿ› ๏ธ Technical Improvements

  • Unit tests & E2E testing (Jest, Playwright)
  • CI/CD pipeline improvements
  • Performance optimization
  • Offline-first PWA enhancements
  • API documentation (OpenAPI/Swagger)

๐Ÿ’ก Want to work on something? Open an issue first to discuss your approach!


๐Ÿค Contributing

Contributions are welcome! Here's how to get started:

How to Contribute

  1. Fork the repository
  2. Create a branch: git checkout -b feature/your-feature-name
  3. Make changes and commit: git commit -m "feat: add your feature"
  4. Push to your fork: git push origin feature/your-feature-name
  5. Open a Pull Request to main

Contribution Guidelines

  • ๐Ÿ“ Open an issue first for major changes
  • โœ… Follow existing code style (TypeScript, ESLint)
  • ๐Ÿงช Test your changes before submitting
  • ๐Ÿ“– Update docs if needed
  • ๐Ÿ”’ Never commit secrets or API keys

Good First Issues

Look for issues labeled good first issue or help wanted to get started!


Empowering healthier choices, one scan at a time.

About

TruthLens is an advanced AI-powered nutrition assistant

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages