A template for building Reddit moderation tools using Devvit web. This template provides a complete foundation for creating custom moderation tools with bulk comment management capabilities.
This template includes a working mod tool called "Mop" that demonstrates:
- Bulk Comment Management: Remove or lock multiple comments at once
- Thread-level Actions: "Mop comments" - Remove/lock a comment and all its replies
- Post-level Actions: "Mop post comments" - Remove/lock all comments on a post
- Flexible Options:
- Remove comments, lock comments, or both
- Skip distinguished comments (moderator/admin posts)
- Permission Checks: Only moderators with proper permissions can use the tool
- User-friendly Forms: Interactive forms with clear options and validation
- Devvit: Reddit's platform for building and deploying apps
- Vite: Fast build tool for the web components
- Hono: Lightweight web framework for backend logic
- TypeScript: Type-safe development
- Clone this template or use it as a starting point for your mod tool
- Install dependencies:
npm install
- Configure your app in
devvit.json:- Update the app name
- Set your development subreddit
- Start developing:
npm run dev
- Test your changes in your development subreddit
src/
├── index.ts # Main server setup with Hono routes
├── core/
│ └── nuke.ts # Core moderation logic for bulk operations
└── routes/
├── api.ts # Public API endpoints
├── forms.ts # Form submission handlers
├── menu.ts # Context menu item handlers
└── triggers.ts # App lifecycle triggers
This template is designed to be easily customizable:
- Modify existing actions: Edit the nuke functionality in
src/core/nuke.ts - Add new menu items: Update
devvit.jsonand add handlers insrc/routes/menu.ts - Create new forms: Add form definitions and handlers in
src/routes/forms.ts - Add API endpoints: Extend
src/routes/api.tsfor external integrations
npm run dev: Starts development mode with live reload on your test subredditnpm run build: Builds your mod tool for productionnpm run deploy: Uploads a new version of your app to Redditnpm run launch: Publishes your app for review and public usenpm run login: Authenticates your CLI with Redditnpm run type-check: Runs TypeScript type checking, linting, and formatting
The template demonstrates Reddit mod tool development through the "Mop" feature:
- Context Menu Integration: Click on the Mod Shield icon in a comment to see custom mod actions
- Permission Validation: Automatically checks if the user has moderation permissions
- Interactive Forms: Presents options through Reddit's native form system
- Reddit API: Processes multiple comments using Reddit's API
- Permissions: The app requires
reddit: truepermission to access Reddit's API - User Types: Menu items are restricted to
moderatoruser type
- Test thoroughly in your development subreddit
- Run
npm run deployto upload your app - Use
npm run launchto submit for Reddit's app review process - Once approved, users can install your mod tool from Reddit's app directory
This template provides everything you need to build powerful, user-friendly moderation tools for Reddit communities.