Inspiration
In July 2023, BotDefense — a tool that silently protected over 3,650 subreddits from known bad actors — shut down overnight. No replacement existed. Overnight, thousands of mod teams lost their only cross-subreddit protection layer and went back to fighting spam, bots, and scammers in isolation.
That gap never got filled. Reddit's native tooling still has no answer for the fundamental problem: subreddits are islands. When a spammer gets banned from r/technology, they immediately move to r/science, r/gaming, and r/AskReddit — and every one of those mod teams has to discover the threat from scratch, manually, on their own time.
Moderators are unpaid volunteers. Every minute spent re-banning someone who was already flagged elsewhere is a minute stolen from actual community building. I built ModShield to give that time back.
The question that drove the entire build was simple: what if a ban in one subreddit automatically protected every other subreddit? Reddit's Developer Platform (Devvit) finally made that possible — without external servers, without bot accounts, without any infrastructure burden on moderators.
What it does
ModShield is a cross-subreddit ban intelligence network that runs entirely inside Reddit's own infrastructure. It connects every subreddit that installs it into a shared protection layer.
The core loop
$$ \text{Ban in Sub}_A \rightarrow \text{Network Record} \rightarrow \text{Alert in Sub}_B, \text{Sub}_C, \text{Sub}_D \ldots $$
In Simple Words:
- A moderator bans a user in any participating subreddit (for spam, scam, bot activity, or harassment). ModShield detects this automatically — no extra mod action required.
- The ban is written to a shared Redis database scoped across all ModShield installs.
- The moment that same account posts or comments anywhere in the network, ModShield fires an instant modmail alert to that subreddit's mod team with full context: what they were banned for, where, how many times, and a direct link to the new activity.
- If the subreddit has auto-ban enabled and the user's network score exceeds the configured threshold, ModShield bans them automatically — zero human intervention.
Key features
- 🌐 Shared ban network — one Redis database, all installs, real network effect
- 📬 Instant modmail alerts — rich, formatted, with full ban history
- ⚡ Auto-ban mode — configurable per ban category
- 🏷️ Per-category thresholds — bots, scams, spam, and harassment each have separate auto-ban thresholds because not all bans deserve equal weight
- ⭐ Trust system — mark specific subreddits as trusted; their bans count double in the network score
- 📋 Activity log — last 50 alerts stored per subreddit, viewable from the mod menu
- 🧹 Mop tool — bulk remove a comment thread or all comments on a post in one click
- 🔧 Developer tools — mock ban and quick unban for testing without real bans
- 🚫 Zero-friction install — no API keys, no external accounts, no servers, works on day one
Trust score formula
$$ \text{Network Score} = \text{Regular Flags} + \text{Trusted Flags} \times 2 $$
A user flagged by 1 trusted subreddit and 2 regular subreddits scores 4, not 3 — because well-moderated communities carry more signal.
Auto-ban decision
$$ \text{Auto-ban} = \begin{cases} \text{true} & \text{if Score} \geq \text{threshold}(\text{category}) \land \text{autoBanEnabled} \ \text{false} & \text{otherwise} \end{cases} $$
Default thresholds:
| Category | Default Threshold | Rationale |
|---|---|---|
| 🤖 Bot | 1 | Easy to verify; act immediately |
| 💸 Scam | 2 | High confidence after 2 reports |
| 🗑️ Spam | 3 | Common; require more signal |
| 🚨 Harassment | 3 | Context-dependent; err cautious |
How we built it
ModShield is built entirely on Devvit — Reddit's Developer Platform — using TypeScript in strict mode. No external servers. No databases outside Reddit. No third-party accounts.
Stack
| Layer | Technology |
|---|---|
| Platform | Devvit (Reddit Developer Platform) |
| Language | TypeScript (strict mode) |
| Routing | Hono (lightweight HTTP router) |
| Build | Vite |
| Database | Devvit Redis (cross-install scoped) |
| Linting | ESLint + Prettier |
Architecture
The app is structured around three event trigger types:
1. onModAction trigger — fires when a mod bans a user. ModShield calls
inferCategory() to parse the ban note for keywords (bot, scam, fraud,
harass, etc.) and categorizes the ban automatically. It then calls recordBan()
to write or update flagged:{username} in Redis.
2. onPostSubmit / onCommentSubmit triggers — fire on every new post and
comment across all participating subreddits. ModShield calls checkUser(username),
reads flagged:{username} from Redis, and if found, calculates effectiveScore().
If shouldAutoBan() returns true, it calls reddit.banUser(). Either way, it calls
sendModmailAlert() with the full context and appendAlert() to update the
activity log.
3. onAppInstall trigger — initializes default config for the subreddit on
first install, so it works immediately with no setup.
Redis key schema
flagged:{username} → BanRecord (global, shared across all installs) config:modshield → SubConfig (per-install, per-subreddit settings) log:alerts:{subName} → AlertRecord
The magic of ModShield's network effect is entirely in this key design:
flagged:{username} is a global key — every install reads and writes the same
record. This is what creates the shared intelligence layer with zero infrastructure.
Project structure
src/
├── index.ts # Hono server entry point
├── core/
│ ├── types.ts # All shared TypeScript types
│ ├── network.ts # All Redis reads/writes
│ ├── trust.ts # Trust scoring + auto-ban logic
│ ├── categories.ts # Ban category inference
│ ├── alerts.ts # Modmail formatting + sending
│ └── nuke.ts # Mop (bulk comment removal)
└── routes/
├── triggers.ts # Event handlers
├── menu.ts # Mod menu interactions
├── forms.ts # Form submission handlers
└── api.ts # Public API endpoints
Challenges we ran into
1. Cross-install Redis scoping
The biggest architectural question was: how do you share data across subreddits
in Devvit? Devvit Redis is scoped per-app, not per-install — which means all
installs share the same keyspace. This is what enables the network, but it also
means key collisions are a real risk. The solution was a deliberate key schema:
global keys (like flagged:{username}) are intentionally shared, while per-install
keys (like config:modshield and log:alerts:{subName}) are namespaced by
subreddit name to remain isolated.
2. Ban category inference without raw note access
Devvit's onModAction trigger exposes ban notes, but the text is freeform and
inconsistent across mod teams. Building a reliable inferCategory() function meant
accepting that no classifier is perfect — and designing the system to default to
spam (the most common category) when no keywords match, rather than failing or
guessing wrongly.
3. Alert fatigue vs. alert value
Early testing showed that sending a modmail for every flagged user appearance —
even users flagged only once — would generate noise that mods would start ignoring.
This led to the alertOnFirstFlag config option: subreddits that want maximum
coverage can enable it, while subreddits that prefer higher-signal alerts can
require at least 2 flags before receiving modmail.
4. Auto-ban trust and safety
Auto-banning users is a serious action. The system needed multiple safeguards: per-category thresholds (so harassment — which requires more human judgment — has a higher default than bots), the trust system (so bans from well-moderated subreddits carry more weight), and alert-only mode as the default (so new installs never auto-ban without a conscious opt-in decision from the mod team).
5. Zero-friction install constraint
The hardest UX constraint was: it must work on day one, with zero configuration.
This meant every default had to be safe and sensible out of the box — alert-only
mode on, conservative thresholds, no trusted subreddits pre-set. The onAppInstall
trigger writes default config immediately so the first post or comment after install
already has a working config to read.
Accomplishments that we're proud of
Live and deployed — ModShield is on the App Directory at
developers.reddit.com/apps/modshield-botand running on a public test community (r/modshield_bot) today.Zero external infrastructure — the entire system runs inside Reddit's platform. No servers to maintain, no external databases, no API keys. This is only possible because of Devvit's Redis and trigger system — ModShield could not have existed before this platform.
The network effect works — the shared Redis key design means every new subreddit that installs ModShield immediately benefits from every ban ever recorded by every other participating subreddit. Day-one installs get protection from the entire network history instantly.
TypeScript strict mode throughout — every file type-checks cleanly. No
anyescapes. Production-grade code that a team could maintain.10 distinct features shipped — shared ban network, modmail alerts, auto-ban, per-category thresholds, trust system, config dashboard, activity log, Mop tool, developer tools, and zero-friction install — all in a single cohesive app.
Directly fills the BotDefense gap — ModShield does everything BotDefense did, adds features BotDefense never had (trust system, per-category thresholds, activity log, mobile-compatible config), and requires zero external infrastructure.
What we learned
Devvit Redis scoping is the key to cross-subreddit apps. The realization that Redis is per-app (not per-install) was the architectural unlock for the entire project. Once that clicked, the network design became straightforward.
Defaults are a product decision. Every default value in ModShield's config is a judgment call about mod team trust, false positive risk, and community safety. Getting defaults right matters more than getting features right — a tool that auto-bans incorrectly out of the box will be uninstalled immediately.
Hono is an excellent fit for Devvit apps. Using Hono as the internal router made the codebase dramatically cleaner than a single-file approach. Route groups for triggers, menus, and forms kept each concern isolated and testable.
Moderation is invisible until it breaks. The best moderation tools are ones you never notice — because threats were stopped before they became problems. ModShield is designed to be invisible to regular users and only surface to mods when there's a real signal worth their attention.
What's next for ModShield
- Manual user clearing — let mods remove a user from the network if a ban was made in error, with an audit trail
- More ban categories — vote manipulation, doxxing, ban evasion as distinct categories with their own thresholds
- Dashboard UI — a custom Devvit post type showing network stats, recent alerts, and flagged user lookup in a visual interface
- Subreddit reputation scoring — track which subreddits contribute the most accurate bans over time and weight their reports accordingly
- Ban export/import — let subreddits seed the network from their existing ban lists on first install
- Appeal workflow — a structured process for flagged users to contest a network ban through the originating subreddit
Built With
- developer
- devvit
- eslint
- hono
- node.js
- platform
- prettier
- redis
- typescript
- vite

Log in or sign up for Devpost to join the conversation.