Skip to content

edycutjong/toxzen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ToxZen 🧘

AI-shielded ban appeal processor that protects moderators from toxic content while helping them make faster, fairer decisions β€” all inside Reddit native UI.

Built for Devpost Reddit Demo Community Watch Demo Video

Devvit React Hono Gemini TypeScript Redis


πŸ“Έ See it in Action

πŸ“Ί Watch the 60-second video demo on YouTube!

Toxic wall of text β†’ AI-shielded summary with severity badge β†’ one-click verdict. The mod never reads a single slur.


πŸ’‘ The Problem & Solution

A volunteer moderator of a 2-million-member subreddit opens their 47th ban appeal of the day β€” another wall of slurs, threats, and personal attacks β€” and wonders if it's worth continuing.

Moderator burnout is real. Studies show content moderators experience PTSD-like symptoms from prolonged toxic exposure. AutoMod can't summarize appeal content, assess remorse, or shield mods from emotional harm. Until now.

ToxZen uses Gemini Flash AI to create a protective shield between toxic content and moderators:

  1. πŸ“ User submits appeal β†’ Raw text stored in Redis with 30-day TTL
  2. πŸ€– AI analyzes β†’ Generates clean, neutral summary + toxicity score + remorse signal
  3. πŸ›‘οΈ Mod reviews shielded summary β†’ Makes verdict without reading toxic content
  4. βœ… One-click verdict β†’ Accept (auto-unban), Deny (auto-response), or Escalate

Key Features:

  • πŸ›‘οΈ AI Content Shield: Gemini Flash generates clinical summaries β€” never reproduces toxic language
  • 🎯 Severity Scoring: 0–100 toxicity scale with color-coded badges (🟒 Low / 🟑 Medium / πŸ”΄ High / β›” Extreme)
  • 🧠 Remorse Detection: Genuine βœ… vs. Performative ⚠️ vs. Absent ❌ β€” AI identifies manipulation
  • ⚑ One-Click Verdicts: Accept, Deny, Escalate with configurable auto-response templates
  • πŸ‘ Raw Reveal (2-step): Content warning dialog before showing unfiltered text β€” opt-in only
  • πŸ“Š Wellness Dashboard: "You've been shielded from 1,847 words of toxic content today"
  • πŸ”’ 30-Day TTL: All data auto-expires per Reddit's user-deletion compliance policies
  • ⏱️ Cooldown Enforcement: 24-hour appeal cooldown prevents spam
  • πŸ” Manual Review Fallback: If AI analysis fails after 3 retries, the appeal is flagged for manual review β€” mods can still issue verdicts without the AI summary
  • ⚠️ Low Confidence Warning: When AI confidence is below 60%, a visual warning prompts the mod to verify manually before deciding

πŸ—οΈ Architecture & Tech Stack

Layer Technology
Platform Devvit Web (Client/Server)
Frontend React 19 + Vanilla CSS
Server Hono (TypeScript)
AI Engine Google Gemini 1.5 Flash (responseMimeType: "application/json")
Storage Devvit Redis (KV Store) with sorted sets
Build Vite + @devvit/start plugin
Testing Vitest
graph LR
    A[Banned User] -->|Submit Appeal| B[Devvit Form]
    B -->|Store raw text| C[Redis KV Store]
    B -->|Schedule job| D[Scheduler]
    D -->|Analyze| E[Gemini Flash API]
    E -->|JSON response| F[Shielded Summary]
    F -->|Display| G[Mod Queue UI]
    G -->|Accept/Deny| H[Verdict Engine]
    H -->|Auto-response| I[Reddit API]
    
    style E fill:#4285F4,color:#fff
    style F fill:#8b5cf6,color:#fff
    style G fill:#06b6d4,color:#fff
Loading

Server Endpoints (14 Hono routes)

Endpoint Type Purpose
/internal/menu/appeal-form Menu Show appeal submission form
/internal/menu/open-queue Menu Create queue Custom Post
/internal/menu/wellness Menu Open wellness dashboard
/internal/form/appeal-submit Form Process appeal + schedule AI
/internal/form/verdict-submit Form Record mod verdict
/internal/form/reveal-raw Form Raw reveal confirmation handler
/internal/scheduler/analyze-appeal Scheduler Gemini API call with retry (3Γ— exponential backoff)
/api/appeals API List pending appeals
/api/appeal/:id API Single appeal detail
/api/appeal/:id/verdict API Submit verdict from UI
/api/appeal/:id/reveal API Reveal raw text (opt-in)
/api/appeal/:id/retry API Retry failed Reddit actions (unban/modmail)
/api/stats API Daily wellness stats
/api/seed API Load demo appeals for playtesting

πŸ† Hackathon Track Alignment

Track Alignment
Best New Mod Tool ($10,000) βœ… Novel capability AutoMod cannot do β€” AI content shielding + remorse detection
Moderator's Choice ($10,000) βœ… Every moderator feels this pain personally β€” burnout from toxic appeals

Why Devvit is Load-Bearing

ToxZen cannot be rebuilt as a generic server app or swapped for a generic frontend stack. The Devvit platform is load-bearing in several critical areas:

  1. Interactive Custom Posts: Renders the queue UI and wellness stats inside Reddit's native feed using Custom Post components, removing the friction of navigating to external dashboards.
  2. Reddit API Integration: Unbans users and sends modmails securely via native platform primitives, avoiding external authentication complex scripts.
  3. Scheduler Service: Handles the async execution of the Gemini Flash toxicity analysis without maintaining a separate message queue or server.
  4. Redis KV Store & Sorted Sets: Stores raw appeals, analysis results, and daily wellness logs with a strict 30-day TTL policy, ensuring compliance with Reddit user data deletion policies.

πŸš€ Getting Started

Fetch Domains Disclosure

This application makes outgoing HTTP requests to:

  • generativelanguage.googleapis.com (Google Gemini Flash API for toxicity assessment)

Please ensure this domain is whitelisted/allowed in your environment settings (disclosed in accordance with Devvit review guidelines).

Prerequisites

Installation & Playtesting

  1. Clone the repository:

    git clone https://github.com/edycutjong/toxzen.git
    cd toxzen
  2. Install dependencies:

    npm install
  3. Log in to your Reddit developer account:

    npx devvit login
  4. Set your Google Gemini API key:

    npx devvit settings set geminiApiKey
  5. Start playtesting on your test subreddit:

    # Build frontend assets
    npm run build
    
    # Start playtest
    npx devvit playtest <subreddit_name>

For Judges: The app uses Devvit's built-in settings system. Set the Gemini API key via npx devvit settings set geminiApiKey after installing.

Demo mode: Seed appeals (loaded via the "Seed Demo Data" button in the queue) skip live Reddit API calls (unban + modmail) since demo usernames don't exist on Reddit. All other app logic β€” AI analysis, shielding, wellness stats β€” runs normally on seeded data.

Subreddit Installation

To install and deploy the app directly to your subreddit:

# Upload and register the app
npx devvit upload

# Install the app to your subreddit
npx devvit install <subreddit_name>

πŸ§ͺ Testing & CI

npm run typecheck       # TypeScript strict mode
npm run test            # Vitest
npm run test:coverage   # Coverage report
npm run ci              # Full CI pipeline (typecheck + test + build)

CI runs on every push/PR against Node.js [20, 22, 24] matrix.

πŸ“ Project Structure

ToxZen/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   β”œβ”€β”€ ci.yml                    # CI pipeline (typecheck + test + build)
β”‚   β”‚   └── codeql.yml                # Security scanning
β”‚   └── dependabot.yml                # Dependency updates
β”œβ”€β”€ data/
β”‚   └── fixtures/
β”‚       └── appeals.json              # 5 seed appeals (demo data)
β”œβ”€β”€ docs/                             # README assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ client/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ AppealCard.tsx        # Queue list card
β”‚   β”‚   β”‚   β”œβ”€β”€ QueueView.tsx         # Appeal queue page
β”‚   β”‚   β”‚   β”œβ”€β”€ RevealRawDialog.tsx   # 2-step content warning
β”‚   β”‚   β”‚   β”œβ”€β”€ SeverityBadge.tsx     # Color-coded toxicity badge
β”‚   β”‚   β”‚   β”œβ”€β”€ ShieldedReview.tsx    # Full appeal review
β”‚   β”‚   β”‚   β”œβ”€β”€ VerdictButtons.tsx    # Accept/Deny/Escalate/Reveal
β”‚   β”‚   β”‚   └── WellnessDashboard.tsx # Mod wellness stats
β”‚   β”‚   β”œβ”€β”€ styles.css                # Dark SOC theme (500+ lines)
β”‚   β”‚   β”œβ”€β”€ App.tsx                   # Main app with view routing
β”‚   β”‚   β”œβ”€β”€ main.tsx                  # React entry point
β”‚   β”‚   β”œβ”€β”€ queue.html                # Inline Custom Post entry
β”‚   β”‚   β”œβ”€β”€ review.html               # Expanded review entry
β”‚   β”‚   └── wellness.html             # Wellness dashboard entry
β”‚   β”œβ”€β”€ server/
β”‚   β”‚   └── index.ts                  # Hono server (14 endpoints)
β”‚   └── shared/
β”‚       └── types.ts                  # TypeScript interfaces
β”œβ”€β”€ devvit.json                       # Devvit app config
β”œβ”€β”€ package.json                      # Dependencies & scripts
β”œβ”€β”€ vite.config.ts                    # Vite + React + Devvit plugin
β”œβ”€β”€ .env.example                      # Environment template
β”œβ”€β”€ PRIVACY.md                        # Privacy policy
β”œβ”€β”€ TERMS.md                          # Terms of service
β”œβ”€β”€ LICENSE                           # MIT
└── README.md                         # You are here

πŸ“„ License

MIT Β© 2026 Edy Cu

πŸ™ Acknowledgments

Built for the Devpost Mod Tools Migration Hackathon 2026. Thank you to Reddit for the Devvit platform and Google for the Gemini API.


🧘 Protecting the people who protect your community.

About

🧘 AI-shielded ban appeal processor that protects moderators from toxic content while helping them make faster, fairer decisions β€” all inside Reddit native UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors