Stop Cyberviolence

Data for Good - Saison 13

Last updated: 2026-05-08

This page contains an introduction and the technical documentation for the project Stop Cyberviolence as a part of season 13 hosted by Data for Good France.


What is Monstermessenger?

Monstermessenger is a multilingual AI-powered chatbot designed to help young people (10–13 years) and parents address cyberbullying and online safety concerns. It supports two user audiences and six languages, offering context-aware conversations backed by curated educational documents.

The system is built on LangGraph, FastAPI, and React, with a persistent session layer, an IDP-based authentication flow, and remote feature-flag management via OpenFeature.

Dual-Variant Architecture

A single codebase serves two audiences, selected at deployment time via CHATBOT_VARIANT:

Variant Target Address style
teenager Children/teens (10–13 years) Direct (“tu”, “you”)
parent Parents of children Formal (“votre enfant”, “your child”)

Each variant gets its own:

  • Set of context-collection questions and system prompts (via the i18n layer)
  • RAG knowledge-base collection (docs_youth / docs_adult)
  • Frontend deployment (separate GCS bucket)
  • Feature-flag context (some flags are variant-specific)

Key Features

🗣️ Multilingual Support (6 Languages)

French (FR, default), English (EN), Spanish (ES), Italian (IT), German (DE), Portuguese (PT).
All prompts, questions, and UI strings are in YAML files under api/i18n/, with a two-layer in-memory cache.

🤖 Intelligent Conversation Flow

  1. Context Collection — Structured questions gather the situation. An optional AI-driven dynamic follow-up mode (feature-flagged) generates additional questions based on the user’s answers.
  2. AI Advice — The give_advice node, driven by gemini-3.1-flash-lite-preview, produces empathetic, age-appropriate guidance.
  3. RAG — Educational documents are retrieved from PGVectorStore using multi-query parallelised search, filtered by an LLM relevance score, and injected into the advice prompt. A two-level semantic cache (embedding cache + cosine-similarity query cache) keeps latency low.
  4. Ongoing Support — Follow-up conversation supported by a rolling summary persisted via the MemoryLake async queue.

👥 Collective & Invitation System

Groups of users (families, classes) are managed through the Collective entity. Parents can create invitation links or QR codes for teenagers, which automatically grant implicit parental consent and add them to the collective. See Backend API for endpoints and Onboarding Tutorial for the authorization flow.

🎛️ Feature Flags (OpenFeature)

Runtime toggle of UI and backend behaviour via GET /features. The ApiFeatureProvider on the frontend fetches flags on startup. See Backend API for the full flag catalogue.

📱 Modern Tech Stack

Layer Technologies
Backend FastAPI, LangGraph, SQLAlchemy async, Alembic, psycopg3
AI Google Gemini (via langchain_google_genai), LangGraph tool nodes
Data PostgreSQL (multi-schema: app, langgraph, rag, cache)
Frontend React 18, TypeScript, Vite, Tailwind CSS, OpenFeature
Deployment Google Cloud Run (backend) + Cloud Storage (frontend), GitHub Actions

System Architecture

┌───────────────────┐   ┌────────────────────┐   ┌──────────────────────┐
│   React Frontend  │   │  FastAPI Backend   │   │  LangGraph AI Agent  │
│                   │   │                    │   │                      │
│ • AuthContext     │   │ • /auth/login      │   │ • collect_context    │
│ • BrandScreen     │◄──┤ • /chat/init       ├──►│ • give_advice        │
│ • MonsterAvatar   │   │ • /chat            │   │ • research_tools     │
│ • HistoryModal    │   │ • /features        │   │ • ongoing_support    │
│ • OpenFeature     │   │ • /chat/history    │   │ • summarize          │
└───────────────────┘   └─────────┬──────────┘   └──────────────────────┘
                                  │
                    ┌─────────────▼─────────────┐
                    │        PostgreSQL           │
                    │  schema: app               │
                    │    Users, AppSessions,     │
                    │    Conversations,          │
                    │    FeatureFlags            │
                    │  schema: langgraph         │
                    │    Checkpoint store        │
                    │  schema: rag               │
                    │    PGVectorStore            │
                    │  schema: cache             │
                    │    Semantic query cache    │
                    └────────────────────────────┘

Project Structure (Top-Level)

stopcyberviolences-chatbot/
├── api/                    # Backend — FastAPI + LangGraph
│   ├── agents/service1/    # Conversation agent (nodes, memory, tools, manifests)
│   ├── i18n/               # YAML prompts, questions, UI strings
│   ├── database/           # Multi-schema models, engines, Alembic
│   ├── services/           # AppDataService, FeatureFlagService, RAG, Chat
│   ├── routers/            # auth, chat, features, contacts, files, feedback
│   ├── core/               # Logging, dependency singletons
│   └── main.py
├── frontend/               # React SPA
│   └── src/
│       ├── components/     # BrandScreen, MonsterAvatar, HistoryModal, …
│       ├── context/        # AuthContext
│       ├── providers/      # ApiFeatureProvider (OpenFeature)
│       └── hooks/          # useChat
├── rag/                    # Document indexing scripts + raw PDFs
├── deployment/             # deploy.py CLI, Dockerfiles, shell scripts
├── discord_bot/            # Discord bot client
└── doc/                    # This documentation (Quarto .qmd files)

Use the sidebar to navigate between documentation sections.