Environment Configuration
Relevant source files
The following files were used as context for generating this wiki page:
The Environment Configuration for TrueLens defines the runtime parameters, architectural connections, and styling tokens required to operate the AI-powered content verification platform. It encompasses the setup for the Next.js frontend, the proxying logic for the Python/FastAPI backend, and the CSS variables that maintain visual consistency across the application.
This configuration ensures that the application can transition between development and production environments, specifically managing external API endpoints and build-time dependencies.
Backend Connectivity
The application relies on an external FastAPI service for its heavy ML processing. The connection to this backend is managed via environment variables and internal API proxies.
API Proxy Configuration
The Next.js route handlers act as a bridge between the client and the backend service. This configuration prevents Cross-Origin Resource Sharing (CORS) issues and allows for uniform data mapping.
const BACKEND_URL = process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8000";
Sources: truelens-app/src/app/api/v1/scans/route.ts:3
Backend Integration Flow
The configuration facilitates a flow where frontend requests are validated, proxied to the backend, and then transformed back into frontend-friendly camelCase formats.
This diagram represents how the environment variable NEXT_PUBLIC_API_URL dictates the destination of processed scan requests.
Sources: truelens-app/src/app/api/v1/scans/route.ts:5-65
Build and Runtime Environment
The project is structured as a Next.js application using TypeScript and Tailwind CSS. The configuration for the runtime environment is primarily defined in the package.json and README.md files.
Script Configurations
The following scripts define the entry points for different environment stages:
| Script | Command | Purpose |
|---|---|---|
dev | next dev | Starts the development server with hot reloading at localhost:3000. |
build | next build | Compiles the application for production deployment. |
start | next start | Runs the compiled production build. |
lint | eslint | Executes static code analysis. |
Sources: truelens-app/package.json:6-11, truelens-app/README.md:5-20
Key Dependencies
The environment depends on several critical libraries for its core functionality:
- Next.js (16.2.6): The core framework for the application.
- React (19.2.4): The underlying UI library.
- Tailwind CSS (4): Used for styling and layout via design tokens.
- Framer Motion: Powering the high-performance animations throughout the UI.
Sources: truelens-app/package.json:13-35
Design System Configuration (CSS Variables)
TrueLens uses a centralized configuration for its visual identity through CSS variables (design tokens). These are defined in the global stylesheet and integrated into the Tailwind theme.
Color Tokens and Branding
The environment defines a specific palette for brand identity and status indicators:
| Variable | Value | Usage |
|---|---|---|
--bg-primary | #09090B | Main application background. |
--brand-mid | #7C3AED | Primary brand color for buttons and icons. |
--text-primary | #FAFAFA | Primary text color for readability on dark backgrounds. |
--success | #10B981 | Color used for "Authentic" verdicts. |
--danger | #EF4444 | Color used for "AI-Generated" or "Flagged" content. |
Sources: truelens-app/src/app/globals.css:5-40
Typography and Layout
The environment configures specific font families for different content types:
- Sans-serif: Uses 'Inter' for UI elements and general text.
- Monospace: Uses 'JetBrains Mono' for scan IDs, hashes, and code examples.
Sources: truelens-app/src/app/layout.tsx:39-44, truelens-app/src/app/globals.css:48-55
Analysis Engine Logic
While much of the analysis is handled by the backend, the frontend configuration includes logic for "Stylometry features" and "Ensemble Scoring" weights to simulate or augment backend results during processing.
Signal Weights
The relative importance of different analysis signals is configured as a constant:
| Signal Type | Weight | Description |
|---|---|---|
text | 0.40 | Stylometry and AI detection patterns. |
domain | 0.25 | WHOIS and TLD reputation checks. |
image | 0.20 | Forensic analysis of visual assets. |
review | 0.10 | Behavioral patterns in reviews. |
provenance | 0.05 | Historical context and archive matches. |
Sources: truelens-app/src/lib/analysis.ts:167-173
Verdict Thresholds
The logic for determining the final authenticity label is configured with the following score boundaries:
- Authentic: $\ge 70$
- Suspicious: $40 \le x < 70$
- AI-Generated: $< 40$
Sources: truelens-app/src/lib/analysis.ts:251-254
Metadata and SEO Configuration
The application environment includes a global metadata configuration for search engine optimization and browser identification, located in the root layout.
export const metadata: Metadata = {
title: "TrueLens — Verifying Authenticity in the Age of AI",
description: "TrueLens is an AI-powered platform that detects AI-generated content...",
keywords: ["AI detection", "fake news detector", "trust score", ...],
};
Sources: truelens-app/src/app/layout.tsx:7-25
Summary
The Environment Configuration of TrueLens serves as the foundational layer that connects the Next.js user interface with the FastAPI machine learning backend. By utilizing environment variables for API routing, a strict set of CSS design tokens for visual consistency, and a well-defined script lifecycle for development and production, the system maintains a robust and scalable architecture for content verification.