TruthGuard AI is an AI-powered web application designed to help users analyze potentially misleading information, scams, and suspicious messages.
The platform combines Laravel-based backend architecture with Google Gemini AI to provide structured analysis including verdict, confidence score, risk level, explanation, and recommended actions.
TruthGuard AI helps users make more informed decisions before trusting or sharing suspicious information.
Online scams and misleading information continue to evolve rapidly, making it increasingly difficult to distinguish legitimate information from potentially harmful content.
TruthGuard AI provides an accessible first layer of analysis. Users can submit suspicious text and receive an AI-generated assessment in Indonesian.
The system is designed with a modular architecture so that AI providers can be extended or replaced without tightly coupling the application to a single provider.
| Feature | Description |
|---|---|
| Scam Detection | Analyze suspicious messages for potential scam indicators |
| Hoax Detection | Analyze potentially misleading or false information |
| AI Analysis | Powered by Google Gemini |
| Confidence Score | Indicates the AI's confidence in the classification |
| Risk Classification | Categorizes results into Low, Medium, or High |
| AI Explanation | Provides contextual reasoning behind the result |
| Recommendation | Gives users practical next-step recommendations |
| AI Chat | Conversational interface for discussing suspicious information |
| REST API | Backend API for analysis requests |
| Provider Architecture | AI integrations are separated through provider interfaces |
| Indonesian Output | Analysis results are generated in Indonesian |
┌──────────────────────┐
│ User │
│ │
│ Suspicious Message │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Laravel API │
│ │
│ AnalysisController │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ AI Analysis Service │
│ │
│ Business Logic │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ AI Provider Layer │
│ │
│ Gemini Provider │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Google Gemini │
│ AI Model │
└──────────┬───────────┘
│
▼
┌────────────────────────────┐
│ Structured Result │
│ │
│ Verdict │
│ Confidence │
│ Risk Level │
│ Explanation │
│ Recommendation │
└────────────────────────────┘
TruthGuard AI follows a service-oriented approach within the Laravel application.
HTTP Request
│
▼
Controller
│
▼
Service Layer
│
├── DTO
│
├── Contract
│
└── Provider
│
▼
External AI API
This separation makes the application easier to maintain and allows additional AI providers to be introduced in the future.
app/Services/AI/
│
├── Contracts/
│ ├── AIProvider.php
│ └── ChatProvider.php
│
├── DTO/
│ ├── AIAnalysisResponse.php
│ └── ChatResponse.php
│
├── Providers/
│ ├── GeminiProvider.php
│ ├── GeminiChatProvider.php
│ └── OpenAIChatProvider.php
│
├── AIAnalysisService.php
└── ChatService.php
- PHP 8.3+
- Laravel 12
- Laravel Eloquent
- Guzzle HTTP Client
- Blade
- JavaScript
- CSS
- Vite
- Google Gemini API
- Provider-based AI integration architecture
- SQLite for lightweight deployment
- MySQL supported for development environments
- Ubuntu 24.04
- Nginx
- PHP-FPM
- Composer
- Node.js / npm
app/
├── Enums/
│ ├── AnalysisStatus.php
│ ├── AnalysisType.php
│ ├── AnalysisVerdict.php
│ └── RiskLevel.php
│
├── Http/
│ └── Controllers/
│ └── Api/
│ ├── AnalysisController.php
│ └── ChatController.php
│
├── Models/
│ ├── Analysis.php
│ ├── AnalysisResult.php
│ └── User.php
│
├── Services/
│ └── AI/
│ ├── Contracts/
│ ├── DTO/
│ ├── Providers/
│ ├── AIAnalysisService.php
│ └── ChatService.php
│
database/
├── migrations/
└── seeders/
resources/
├── css/
├── js/
└── views/
routes/
├── api.php
├── web.php
└── console.php
Before installing TruthGuard AI, make sure your environment has:
- PHP 8.3 or newer
- Composer
- Node.js and npm
- SQLite or MySQL
- Google Gemini API key
git clone https://github.com/MasMuham24/TruthGuard-AI.git
cd TruthGuard-AIcomposer installnpm installcp .env.example .envGenerate the Laravel application key:
php artisan key:generateAdd the following variables to .env:
GEMINI_API_KEY=your_gemini_api_key
GEMINI_BASE_URL=https://generativelanguage.googleapis.com
GEMINI_MODEL=gemini-3.5-flashNever commit
.envor expose your API key in the repository.
For SQLite:
touch database/database.sqliteThen run:
php artisan migratenpm run buildphp artisan serveOpen:
http://127.0.0.1:8000
POST /api/analyze{
"type": "scam",
"message": "Selamat! Anda mendapatkan hadiah. Klik link berikut untuk mengambil hadiah Anda."
}| Parameter | Type | Required | Values |
|---|---|---|---|
type |
string | Yes | hoax, scam |
message |
string | Yes | Minimum 5 characters |
{
"verdict": "scam",
"confidence": 99,
"risk_level": "high",
"explanation": "Pesan memiliki karakteristik yang umum ditemukan pada pola penipuan.",
"recommendation": "Jangan memberikan informasi pribadi atau mengikuti instruksi dari pesan tersebut."
}TruthGuard AI returns a structured assessment consisting of:
Possible classifications:
safe
hoax
scam
uncertain
A numerical score representing the AI's confidence in the classification.
low
medium
high
A contextual explanation describing why the AI reached the given classification.
A recommendation intended to help users decide what to do next.
TruthGuard AI follows several basic security practices:
- API credentials are stored in environment variables.
.envis excluded from version control.- Application secrets are not hardcoded into source files.
- Production debugging should be disabled.
- HTTPS should be used in production.
- API access should be appropriately restricted for production deployments.
APP_ENV=production
APP_DEBUG=falseLaravel caches can then be optimized using:
php artisan config:cache
php artisan route:cache
php artisan view:cacheA production deployment can use the following architecture:
Internet
│
▼
┌───────────┐
│ Nginx │
└─────┬─────┘
│
▼
┌───────────┐
│ PHP-FPM │
└─────┬─────┘
│
▼
┌───────────┐
│ Laravel │
└─────┬─────┘
│
┌─────────┴─────────┐
▼ ▼
Database Gemini API
Run the frontend development server:
npm run devRun Laravel:
php artisan serveFor a production build:
npm run buildFuture development may include:
- URL analysis
- News article analysis
- Integration with trusted fact-checking sources
- Analysis history
- User authentication and profiles
- Advanced analytics dashboard
- Multi-language analysis
- Additional AI providers
- Browser extension
- Progressive Web App
- Real-time scam intelligence
TruthGuard AI is an AI-assisted analysis tool, not an authoritative fact-checking service.
AI-generated results may contain errors or incomplete interpretations. Users should verify important information through reliable sources before making decisions or sharing information.
Status: Active Development
TruthGuard AI was developed as an AI-focused project for exploring practical applications of artificial intelligence in digital safety and information verification.
Full Stack Engineer
- 🏆 1st Place — LKS Web Technology Kabupaten Demak 2026
- 💻 Laravel • PHP • JavaScript • AI Integration
- 🚀 Focused on building practical web applications and AI-powered systems
This project is open-sourced under the MIT License.
TruthGuard AI
Analyze before you trust. Verify before you share.