Skip to content

cnowdev/safeguard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafeGuard Thumbnail

# SafeGuard 🛡️

SafeGuard is an all-in-one, secure messaging platform designed to give kids a unified inbox while giving parents peace of mind. It aggregates messages from platforms like Discord, Instagram, Twitter, and WhatsApp into a single application. Behind the scenes, a powerful, custom-built AI filtering engine scans both text and images in real-time to blur and censor harmful content, cyberbullying, and NSFW media before the child ever sees it.

Parents have access to a dedicated dashboard featuring data visualizations, stranger-danger approval queues, and a "Privacy Mode" that respects the child's privacy by only showing flagged content.


🏗️ Architecture & App Sections

1. Frontend

The frontend is built for speed and responsiveness using React, TypeScript, and Vite. Styling is handled via Tailwind CSS.

  • Child View (/child-chat): A unified chat interface resembling popular messaging apps where kids can talk to approved contacts across multiple platforms.
  • Parent Dashboard (/parent-dashboard): A monitoring hub equipped with statistics (Safe Rate, 7-Day Activity), a queue for pending contact approvals, and real-time alerts for censored messages.
  • Content Checker: A lightweight, in-browser regex checker runs on the child's input to warn them before sending sensitive information (like addresses or SSNs) or profanity.

2. Backend

The backend is a fast, asynchronous REST API powered by Python and FastAPI.

  • Platform Integrations: It runs background tasks to poll and listen to platforms like Instagram (via instagrapi) and Discord (via discord.py-self).
  • Message Processing: It ingests incoming messages, passes them through the AI filtering pipeline, uploads media attachments securely, and saves the final processed data to the database.

3. Models (AI / Machine Learning)

SafeGuard uses a robust, in-house, multi-layered machine learning pipeline for real-time moderation:

  • Text Censoring: A custom-trained sequence classification model (using PyTorch and HuggingFace Transformers) detects nuanced inappropriate content, threats, harassment, profanity, slurs, and other harmful phrases.
  • Image Moderation: An approach using a SigLIP2 classifier. This pipeline accurately detects any harmful images or NSFW content.

4. Database (Firebase)

The application relies on Firebase for its real-time database and storage needs:

  • Cloud Firestore: Stores all messages, user settings, blocked users, and approved contacts. Messages are saved with detailed metadata, including whether they were censored and the specific words flagged.
  • Firebase Storage: Securely hosts intercepted media attachments and profile pictures, allowing the frontend to load them safely.

📦 Requirements & Packages

Frontend

  • Node.js (v16+) & npm
  • Dependencies: react, react-dom, react-router-dom, firebase, @phosphor-icons/react, tailwindcss

Backend & Models

  • Python (3.8+)
  • Core Packages: fastapi, uvicorn, python-dotenv, firebase-admin.
  • Platform Packages: discord.py-self, instagrapi.
  • Machine Learning Packages: torch, transformers, numpy, pandas, scikit-learn, opencv-python, joblib, Pillow.
  • Local LLM: Ollama installed locally with the llama3.2:3b model downloaded.

🚀 Setup & Installation Guide

Step 1: Clone the Repository

Clone the project to your local machine and navigate into the root directory.

Step 2: Firebase Configuration

  1. Go to the Firebase Console and create a new project with Firestore and Storage enabled.
  2. Generate a service account private key (JSON) and save it in the backend/ directory as serviceAccountKey.json.
  3. Get your Firebase Web App configuration keys.

Step 3: Environment Variables

Create .env files in both the root/frontend and backend/ directories.

  • Frontend (/.env): Add your Vite Firebase config (VITE_FIREBASE_API_KEY, VITE_FIREBASE_PROJECT_ID, etc.).
  • Backend (backend/.env): Add your Discord Token, Instagram credentials, and Firebase paths.

Step 4: Frontend Setup

Open a terminal in the root directory:

# Install frontend dependencies
npm install

# Start the Vite development server
npm run dev

About

Project for Hacklytics 2026. All your chat apps in one place with added AI protection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors