Skip to content

smirk-dev/TrustNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ TrustNet - AI-Powered Misinformation Detection Platform

A comprehensive fullstack application that empowers users to identify misinformation and build digital immunity through AI-powered content analysis, educational insights, and real-time verification.

TrustNet React FastAPI TypeScript

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Python 3.11+
  • Modern web browser

1. Clone & Setup

git clone https://github.com/smirk-dev/TrustNet.git
cd TrustNet

2. Start Backend Server

cd services/api-python
pip install fastapi uvicorn pydantic
python basic_server.py

Backend will run on: http://localhost:8000

3. Start Frontend Server

cd mind-guard-toolkit-main
npm install
npm run dev

Frontend will run on: http://localhost:8080

4. Open Application

Navigate to http://localhost:8080 in your browser and start analyzing content!

πŸ—οΈ Architecture

Fullstack Application Structure:

TrustNet/
β”œβ”€β”€ mind-guard-toolkit-main/          # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/               # UI Components
β”‚   β”‚   β”œβ”€β”€ hooks/                    # React Hooks & API Integration
β”‚   β”‚   β”œβ”€β”€ lib/                     # API Client & Configuration
β”‚   β”‚   └── pages/                   # Application Pages
β”‚   └── package.json                 # Frontend Dependencies
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ api-python/                  # FastAPI Backend
β”‚   β”‚   β”œβ”€β”€ app/                     # Application Logic
β”‚   β”‚   β”œβ”€β”€ basic_server.py          # Simplified API Server
β”‚   β”‚   └── requirements.txt         # Backend Dependencies
β”‚   └── workers/                     # Background Processing
β”œβ”€β”€ infra/                           # Infrastructure as Code
└── docs/                           # Documentation

Technology Stack:

  • Frontend: React 18.3.1, TypeScript, Vite, TanStack Query, shadcn/ui
  • Backend: Python FastAPI, Pydantic, Uvicorn
  • Styling: Tailwind CSS with animations and dark mode
  • State Management: TanStack Query for server state
  • Build Tool: Vite for fast development and optimized builds

See ARCHITECTURE.md for detailed system design and deployment instructions.

✨ Features

πŸ” Real-Time Content Analysis

  • Instant Trust Scoring: Get immediate credibility assessment (0-100% scale)
  • Manipulation Detection: Identifies emotional appeals, urgency tactics, and bias
  • Educational Insights: Learn why content is flagged with detailed explanations
  • Source Verification: Automatic checking of URLs and domain reputation

🎨 Modern User Interface

  • Responsive Design: Works seamlessly on desktop, tablet, and mobile
  • Dark/Light Mode: Automatic theme switching with user preference
  • Real-time Feedback: Live analysis with progress indicators
  • File Upload Support: Analyze documents, images, and text files

🧠 Digital Immunity Building

  • Pattern Recognition: Learn to identify manipulation techniques
  • Educational Tips: Context-aware guidance for each analysis
  • Progressive Learning: Build critical thinking skills over time
  • Safe Testing Environment: Practice with various content types

πŸ”„ Seamless Integration

  • RESTful API: Easy integration with external applications
  • Real-time Processing: Immediate results with streaming updates
  • Cross-platform: Works on all modern browsers and devices
  • No Registration Required: Start analyzing content immediately

πŸ”§ API Documentation

Endpoints

Health Check

GET http://localhost:8000/health
# Response: {"status": "healthy"}

Content Analysis

POST http://localhost:8000/v1/analysis
Content-Type: application/json

{
  "content": "Your content to analyze here",
  "content_type": "text",
  "user_id": "anonymous"
}

Response Format

{
  "analysis_id": "test_1234567890",
  "trust_score": {
    "overall_score": 0.75,
    "credibility": 0.78,
    "bias_score": 0.5,
    "emotional_manipulation": 0.25,
    "source_reliability": 0.75
  },
  "analysis_summary": "Content analysis results...",
  "manipulation_techniques": [],
  "educational_content": "Educational insights...",
  "metadata": {
    "word_count": 10,
    "sources": ["Source 1"]
  },
  "timestamp": 1234567890.123
}

Frontend API Integration

The frontend uses TanStack Query for efficient API state management:

import { useAnalysis } from '@/hooks/useApi';

const { analyzeContent, isAnalyzing, data, error } = useAnalysis();

// Analyze content
analyzeContent({
  content: "Text to analyze",
  content_type: "text",
  user_id: "user123"
});

πŸ’» Development

Frontend Development

cd mind-guard-toolkit-main

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Run linting
npm run lint

Backend Development

cd services/api-python

# Install dependencies
pip install fastapi uvicorn pydantic pydantic-settings

# Start development server
python basic_server.py

# Run with auto-reload
python -m uvicorn basic_server:app --reload --port 8000

Environment Configuration

Create environment files for different environments:

Frontend (.env.development)

VITE_API_BASE_URL=http://localhost:8000
VITE_NODE_ENV=development
VITE_ENABLE_DEBUG=true

Backend Configuration

The backend uses pydantic-settings for configuration management. Key settings include CORS origins, API endpoints, and feature flags.

Testing

# Frontend tests
cd mind-guard-toolkit-main
npm test

# Backend tests  
cd services/api-python
python -m pytest

# API testing
curl http://localhost:8000/health

πŸš€ Deployment

Production Build

# Build frontend
npm run build

# Serve static files or deploy to CDN

Environment Variables

  • VITE_API_BASE_URL: Backend API URL
  • VITE_ENABLE_ANALYTICS: Enable/disable analytics
  • VITE_ENABLE_DEBUG: Debug mode toggle

🀝 Contributing

We welcome contributions to TrustNet! Here's how you can help:

Getting Started

  1. Fork the repository

    git clone https://github.com/your-username/TrustNet.git
    cd TrustNet
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Set up development environment

    # Install frontend dependencies
    cd mind-guard-toolkit-main
    npm install
    
    # Install backend dependencies
    cd ../services/api-python
    pip install -r requirements.txt
  4. Make your changes

    • Follow the existing code style
    • Add tests for new features
    • Update documentation as needed
  5. Test your changes

    # Test frontend
    npm run build
    npm test
    
    # Test backend
    python basic_server.py
  6. Commit and push

    git add .
    git commit -m 'Add amazing feature'
    git push origin feature/amazing-feature
  7. Open a Pull Request

    • Describe your changes clearly
    • Reference any related issues
    • Wait for review and feedback

Development Guidelines

  • Code Style: Follow TypeScript/Python best practices
  • Testing: Add tests for new functionality
  • Documentation: Update README and code comments
  • Performance: Consider impact on load times and user experience
  • Accessibility: Ensure UI components are accessible

Areas for Contribution

  • 🎨 UI/UX Improvements: Better animations, responsive design
  • πŸ” Analysis Features: New detection algorithms, better scoring
  • πŸ“± Mobile Experience: PWA features, offline capability
  • 🌍 Internationalization: Multi-language support
  • πŸ§ͺ Testing: Unit tests, integration tests, E2E tests
  • πŸ“š Documentation: Tutorials, API documentation, examples

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

  • React and FastAPI communities for excellent frameworks
  • shadcn/ui for beautiful component library
  • TanStack Query for efficient state management
  • All contributors and users of TrustNet

Built with ❀️ for digital literacy and misinformation resistance

About

AI to rectify the spread of misinformation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •