CyShield is a real time cyberbullying detection platform designed to empower parents and guardians to take timely action when their child is at risk of being bullied online. This project is composed of several microservices, each responsible for a specific part of the CyShield platform. The architecture is designed for scalability, modularity, and ease of maintenance. In order to access the following services remotely, you must use a domain. This project was tested under the CyShield.org domain, and service mapping has been configured at that address using Cloudflare's secure tunneling and SSL/TLS encryption.
| Layer | Technologies Used |
|---|---|
| Backend | Node.js, Python, Docker, Redis |
| Frontend | Flutter, Bloc |
| Storage | Firestore, SQLite |
| Authentication | Firebase Authentication |
| Notifications | Firebase Cloud Messaging (FCM) |
| Messaging APIS | Telethon, Signal-CLI |
- Location:
microservices/CyShield-central/ - Role: Central orchestrator and API gateway. Handles message routing, queue management, and notification delivery.
- Key Technologies: Node.js, Express, BullMQ (Redis), Firebase Admin SDK.
- Responsibilities:
- Receives messages from various platforms (Telegram, Signal).
- Enqueues messages for classification.
- Interacts with the ML service for cyberbullying detection.
- Sends notifications to guardians via FCM.
- Manages user and notification data in Firestore.
- Parallel Architecture:
TheCyShield-centralcontainer is designed to handle multiple tasks in parallel using BullMQ queues and Node.js worker clustering. Incoming messages are processed asynchronously, allowing classification, notification delivery, and database operations to run concurrently. This ensures high throughput and responsiveness, even under heavy load.
- Location:
microservices/message_classifier/ - Role: Containerized inference service for the Greek BERT model.
- Key Technologies: Python, FastAPI, PyTorch.
- Responsibilities:
- Exposes an HTTP API for message classification.
- Runs the inference pipeline in a Docker container.
- Location:
microservices/signal/signal-docker/ - Role: Handles Signal messaging integration.
- Key Technologies: Node.js, WebSockets, Express.
- Responsibilities:
- Manages Signal device linking and message relay.
- Listens for incoming Signal messages and forwards them to the central service.
- Location:
microservices/telegram/telethon-docker/ - Role: Handles Telegram messaging integration.
- Key Technologies: Flutter (for UI), FastAPI (backend), Telethon (Python Telegram API).
- Responsibilities:
- Provides a UI for Telegram login and code verification.
- Relays Telegram messages to the central service.
-
Message Flow:
- Messages from Telegram and Signal are received by their respective microservices.
- Messages are forwarded to
CyShield-centralvia HTTP. CyShield-centralenqueues messages for classification and interacts with the ML service.- Classification results are processed, and notifications are sent to guardians if necessary.
-
Communication:
- Internal communication uses HTTP and Redis queues.
- Notifications are sent using Firebase Cloud Messaging (FCM).
-
Data Storage:
- User and notification data are stored in Firestore.
- Signal device links are stored in a local SQLite database.
- Docker and Docker Compose installed
- Node.js (for development)
- Python 3.8+ (for ML services)
- Redis (for BullMQ queues)
- Firebase service account credentials
-
Clone the repository:
git clone https://github.com/giwrgosisf/CyShield.git cd CyShield/backend -
Set up environment variables:
- Copy
.env.exampleto.envin each microservice as needed and fill in the required values (e.g., Firebase credentials, Redis host).
- Copy
-
Start all services using Docker Compose:
docker-compose up --build
This will build and start all microservices, including the ML model, central orchestrator, and messaging integrations.
-
Accessing Services:
- Central API: http://localhost:8000/message
- Message Classifier API: http://localhost:9090/predict
- Signal Link UI: http://localhost:3000/link
- Telegram API: http://localhost:7000/send-code
- Telegram API: http://localhost:7000/login
-
Logs and Debugging:
- Use
docker-compose logs -fto view logs for all services. - Each microservice can also be run and debugged individually if needed.
- Use
-
Stopping Services:
docker-compose down
CyShield features two main frontend applications, each serving a distinct user group and purpose:
- Purpose:
Designed for parents and guardians, this app allows them to monitor their child's online interactions, receive real-time alerts about potential cyberbullying incidents, and manage notification preferences. Parents can view only toxic messages that threir kid recives or sents not entire converstios respecting chlids privacy - Structure:
Cross-platform mobile application. - Technologies:
- Flutter (Dart): For cross-platform mobile development
- Bloc: For state management and separation of UI from business logic
- Firebase Authentication: For secure login
- Firestore Database: For retrieving essential user and notification data
- Firebase Cloud Messaging (FCM): For real-time notifications
- Purpose:
Installed on the child's device, this app connects the child's messaging applications with the backend, enabling real-time monitoring of messages. It facilitates the backend's ability to listen for and analyze messages as they are sent or received, ensuring timely detection of potential cyberbullying incidents. - Structure:
Cross-platform mobile application. - Technologies:
- Bloc: For state management and separation of UI from
- Flutter (Dart): For cross-platform mobile development
- Firebase Authentication: For secure login
- Background Services Connection: For credentials collection and linking messaging accounts to the backend
- Secure Communication: Ensures all data sent to the backend is encrypted and privacy-respecting
To better understand how CyShield operates in practice, you can watch an example workflow video here.
Scenario Overview:
-
Child App Setup:
The child installs the Kids App, pairs with a guardian and links their telegram account to the CyShield backend. -
Guardian App Setup:
The parent or guardian installs the Guardians App and connects to their account and motitors toxic activity. -
Message Flow:
- The child receives three messages from telegram: two containing cyberbullying content and one normal message.
- The backend detects in real-time the two cyberbullying messages.
- The parent receives real-time alerts for the toxic messages via the Guardians App, while the normal message is not flagged.
- Ensure your Firebase service account key is placed in the correct location as referenced in
CyShield-central. - For development, you may run individual services using
npm startorpython ...as appropriate. - The ML service requires a GPU for optimal performance. Using a CPU is not recommended, as it has not been tested yet.
- Notice:
The Signal CLI and Telethon libraries used for messaging integration are not official APIs; they are used for learning purposes only!
-
Christos Stamoulos
GitHub Profile -
Dejvid Isufaj
GitHub Profile
