Inspiration

Every brand subreddit is a 24/7 town square. When a Sonos speaker breaks at 2am, the user doesn't call support — they post on r/Sonos. When a payment fails, the complaint hits Reddit before the help desk. These communities generate thousands of signals per week: bug reports buried in rants, feature requests disguised as complaints, fraud attempts in support questions, and slow-building crises. Moderators run customer experience operations with tools built for content moderation, not customer intelligence. They scan manually, guess at trends, and find crises after they explode. Enterprise platforms like Sprinklr cost six figures and pull data out of Reddit. We asked: what if the analytics came to where the conversations already live? Not another external dashboard. A native instrument panel inside Reddit, like vital signs beside a hospital bed. That's SubVitals. Your subreddit's vital signs, at a glance.

What it does

SubVitals turns any brand subreddit into a CX intelligence hub through one Devvit install. A pinned "SubVitals · Live Analytics" post appears immediately — click it for a full dashboard with no external logins or extensions. Every new post flows through configurable pipelines. Ten built-in templates cover intent classification, sentiment scoring (AFINN-165 lexicon plus AI judge when ambiguous), fraud detection, spam, PII, impostor flagging, topic clustering, volume spikes, and root-cause summarization. Classification happens within seconds of post creation. The dashboard has four surfaces. Triage Inbox sorts by severity, sentiment, and age, with bulk actions for resolve, tag, and escalate. Pipelines shows each analysis as a live card with output, tunable prompts, and adjustable thresholds. Rules Engine runs WHEN/THEN automation, for example "when a post is tagged fraud and sentiment is below minus 0.5, send modmail and remove the post." Settings handles brand identity (auto-populated from your subreddit), API keys, team roster, and exports. Crisis detection compares hourly comment velocity against a 14-day rolling baseline. When negative sentiment spikes three standard deviations above normal, SubVitals opens an incident, alerts via modmail, and groups related posts. Incidents auto-resolve when sentiment returns to baseline. The AI Copilot is an embedded chat assistant with tool-calling — mods ask "show me the most negative posts this week" and the copilot queries live data, not hallucinations. Team metrics track verified-agent first-response latency, sentiment lift after replies, and SLA performance. Everything is mod-only. Every API endpoint is gated by requireMod() and fail-closed at the server, not hidden in the UI.

How we built it

SubVitals runs on Devvit Web — Reddit's framework for full-stack apps native to the platform. It gives us a Node.js HTTP server, a React iframe for UI, per-install Redis, and native triggers (PostCreate, CommentCreate, ModAction) with no infrastructure to manage. The server is a Hono 4 app with 100+ endpoints split between /api/ (client-facing, mod-gated) and /internal/ (Reddit triggers). Every handler completes within Devvit's 5-second budget; heavy work is either microseconds (lexicon) or deferred to the scheduler. The client is a React 19 SPA with Vite 8 and Tailwind 4. TanStack Query 5 manages server state with 10–15 second polling for near-real-time updates. Heavy components (Recharts timelines, Rules editor, Settings) lazy-load to keep the bundle fast. The module system is the spine. Each feature — contact-drivers, sentiment, crisis-detection, copilot, rules, audit-log — implements a standard interface with optional trigger handlers and API routes. A central dispatcher fans events sequentially with failure isolation; one module crashing never breaks the others. AI is hybrid. AFINN-165 scores sentiment in microseconds for free. LLM calls (OpenAI via Vercel AI SDK) fire only when the lexicon is ambiguous or a pipeline needs reasoning. Every call is cost-tracked, response-cached by prompt hash for 24 hours, and rate-limited. Brand context from the subreddit's own title and description is injected into every prompt. Storage is Redis-only. Daily rollups use atomic hIncrBy. Idempotency guards prevent double-counting on retried triggers. Uninstall purges everything automatically. Testing: 184 Vitest unit tests across 15 suites covering validation, webhook delivery, rules evaluation, sentiment, and pipeline integrity. Biome handles lint and format.

Challenges we ran into

The Devvit iframe sandbox bit us repeatedly. target="_blank" links silently fail (switched to _top). Blob downloads for CSV were blocked (rewired to fetch plus in-memory blob). CSS hover tooltips clipped against parent overflow (repositioned). localStorage isn't available (we sample computed background color to detect theme). Each was a small fix but shaped how we build inside constrained environments. The u/unknown bug had us chasing the wrong layers for hours. Every post showed an empty author. Schema, storage, and trigger handler all looked correct. Root cause: Devvit's PostCreate event puts the author at event.author.name, not event.post.authorName — our Zod schema was looking inside the wrong object. One-line fix, four modules updated. Devvit's HTTP gateway rate limit was invisible until we hit it. Parallel module dispatch with Promise.allSettled fired all LLM calls simultaneously and got a cryptic gRPC "too many requests" error. We switched to sequential for-await dispatch so LLM calls space themselves naturally. The naming saga: we registered as "redlattuce" (typo), tried renaming to "redlattice" (taken), then "redlettuce" (also taken), before landing on sub-vitals. Four renames across 51 files each time. The Data Lab broke silently for two weeks. The module was registered for triggers but missing from the apiRoutes array, so every /api/lab/ endpoint returned 404. One missing entry in a literal.

Accomplishments that we're proud of

It works end-to-end on a real subreddit. Someone posts "my speaker stopped connecting to WiFi after the update" and within 10 seconds it appears in the Inbox with an intent tag (Bug), a sentiment score (-0.4 negative), and reasoning. That pipeline touches 6 modules, 3 Redis operations, an optional LLM call, and a React refetch — reliably. The pipeline architecture is a template-and-instance system instead of hardcoded analyses. Ten templates cover common cases; mods install instances, tune prompts, adjust thresholds. Adding a new analysis is writing a prompt, not writing code. 184 tests, strict TypeScript with noUncheckedIndexedAccess and exactOptionalPropertyTypes, Biome formatting, pre-commit hooks. We didn't cut corners on engineering discipline. Zero external state dependencies. No Postgres, Supabase, or Firebase — just Devvit Redis with atomic operations. Uninstall purges all data. No orphaned databases, no dangling keys. The AI health banner. When the OpenAI key runs out of credits, the dashboard shows a clear red banner explaining the issue and the fix instead of silently failing.

What we learned

Build for the constraint, not against it. Devvit's Redis-only storage felt limiting but forced a better design: atomic counters for rollups, sorted sets for time-series, hashes for O(1) lookups. Simpler, faster, zero operational overhead. Hybrid AI is the right default. Pure-LLM is slow and expensive; pure-lexicon misses nuance. Hybrid gives sub-millisecond response for 80% of posts and AI judgment for the ambiguous 20%. Cost is under $0.10 per 1,000 posts. Sequential dispatch beats parallel inside a rate-limited sandbox. Concurrent bursts hit invisible limits; graceful sequencing is more reliable. The best UX for a mod tool is no UX. SubVitals auto-populates brand identity, pre-installs pipelines, auto-pins the dashboard, and seeds rules from templates. A mod installs and sees value immediately. Devvit Web is ready for complex applications. We built a 100+ endpoint server, a full React SPA, a rules engine, a pipeline system, an AI assistant, and crisis detection all running natively inside Reddit. We'd build on it again.

What's next for SubVitals

Cross-subreddit analytics. A brand may moderate three or four communities; today each install is isolated. We want a companion web app for unified dashboards, cross-sub incident correlation, and org-level metrics. PII Guardian. A pipeline that detects and redacts personal information before storage — critical for financial-services communities. AI-generated content detection. A classifier that flags posts likely written by language models, useful against bot spam and astroturfing. Visual pipeline builder. Drag-and-drop construction of classification logic, output chaining, and conditional routing without touching prompts. Response drafting with brand voice. The Copilot can chat with mods today; next, it generates draft replies in the brand's tone with A/B variants. Mods review, edit, and post — cutting first-response time from hours to minutes. Reddit Developer Funds. SubVitals is free for communities. Post-hackathon we're applying to Developer Funds for sustainable development without charging volunteer moderators. SubVitals started as one question: what if moderators had the analytics tools enterprise CX teams take for granted? Eleven days later, the answer runs inside Reddit — not beside it, not on top of it, inside it.

Built With

Share this project:

Updates