Inspiration

Subreddit moderation is challenging, and once a post or comment is removed, the original text and media references are lost forever. If a moderator needs to audit a team member's action, review a user ban appeal, or verify a spam report, they are left with no history. Existing third-party Reddit archives are frequently offline or missing data.

We wanted to build a simple, secure, and fully automated utility that gives subreddit moderation teams absolute ownership over their audit history by backing up removed content directly into a repository they control.

What it Does

RepoMod is a background utility that automatically archives deleted posts, comments, and media from your subreddit into a connected GitHub repository in real time.

  • Automated Archiving: The moment a moderator removes a post or comment, the app captures the full metadata—including title, body text, original author, flair, score, and timestamps—and commits it to GitHub.
  • Media Extraction: It automatically parses markdown text and post URLs to extract and preserve raw links to images or videos.
  • Privacy-Aware Compliance: If a user deletes their own post, the app respects their privacy by redacting all content and archiving only the transaction metadata (timestamps and IDs).
  • In-Reddit Diagnostic Logs: Subreddit moderators can test the repository connection and view a rolling log of the last 10 archival events directly inside Reddit's moderator tools.

How We Built It

We built RepoMod using the Reddit Developer Platform (Devvit) and TypeScript.

  1. Triggers: We set up real-time event listeners for ModAction (to catch moderator removals) and PostDelete/CommentDelete (to catch user-initiated deletions).
  2. GitHub Integration: We connected to the GitHub REST API using the Contents endpoint. Because GitHub commits are incremental, the app fetches the existing monthly JSON file, decodes the array, appends the new event, and commits the updated file back to the repository.
  3. Redis Logging: We used Reddit’s built-in Redis key-value storage to maintain a quick-access log of recent commits, which we render to moderators using custom Devvit Forms.

Challenges We Faced

  • Sandbox Environment Constraints: Devvit runs in a custom sandboxed environment where standard Node.js modules (like Buffer) are unavailable. This meant we could not use standard encoding libraries. We solved this by writing custom base64 encoder and decoder utilities using raw JavaScript TextEncoder and bitwise string mapping.
  • Concurrency and Git Conflicts: When multiple posts are removed rapidly, consecutive GitHub API requests can conflict if they target the same file version. We had to design the commit flow to dynamically fetch the latest file SHA right before writing, minimizing collision rates.
  • Balancing Accountability with Privacy: We had to carefully design the database schema to store full text for moderator actions (for community protection) while strictly redacting user-deleted posts (for user privacy compliance).

What We Learned

We gained deep experience working with high-volume webhooks and sandboxed environments. We learned how to structure robust JSON schemas that scale, how to handle base64 binary transformations without native system libraries, and how to implement strict privacy controls in automated data pipelines.

Built With

Share this project:

Updates

Submission history