ReditKey
Watches Reddit for the topics you care about — validated keyword tracking, a scheduled server-side worker, and a protected dashboard for what it finds.
What it is
Reddit is an enormous, unstructured, real-time corpus of what people are talking about. ReditKey narrows it to the terms you actually care about — you define topics, and a scheduled worker searches Reddit on your behalf and surfaces what it finds in a protected dashboard.
Authenticated users get a guarded dashboard shell; the tracking pipeline runs server-side on a schedule rather than the client holding a slow request open.
Authentication
Sign-in is Google OAuth through Firebase. On first sign-in the app checks Firestore for a matching users/{uid} document and creates one if it's missing, storing the email, display name, and timestamps. Users then land on a protected route, and signing out returns them to login.
Keeping the profile document in Firestore alongside the auth record means application data and identity stay in sync without a separate user table to reconcile.
Keyword management
Users can track up to five keywords, and the validation is enforced in two places:
| Rule | Reason |
|---|---|
| Minimum 3 characters | Shorter terms match noise. |
| Maximum 50 characters | Bounded index size. |
| Maximum 3 words | Long phrases rarely match anything. |
| Not a stopword | Searching for "the" is not a search. |
The client enforces these rules for immediate feedback, and the server re-validates them inside a Firestore transaction before persisting. Client validation is a convenience; server validation is the one that counts. Keywords live on the profile document and can be deleted individually.
A client-side check can be bypassed by anyone with a console. A server-side check inside a transaction can't be raced. Having both means users get instant feedback and the data stays clean.
The tracking worker
A scheduled server endpoint does the actual Reddit searching. It's protected by a cron secret, so the only thing that can trigger a run is the scheduler.
The worker is built to be a good API citizen rather than a fast one:
- Request delay between Reddit API calls, defaulting to 2 seconds, to respect rate limits.
- Bounded batch size per run, so a single execution stays within time limits.
- Per-user keyword limit processed each run, defaulting to 5, spreading work fairly across users.
Each of those is an environment-tunable override rather than a hardcoded constant, so the worker can be dialled up or down based on how the API responds.
On-demand search
Waiting for the next scheduled run isn't always acceptable, so the dashboard includes a Search Now button. It calls an authenticated endpoint that verifies the caller's Firebase ID token before doing any work — the same worker logic, triggered per request.
Server-side credentials
Reddit's API credentials and the Firebase Admin service account live server-side only, never in the client bundle. The Vite app only exposes variables prefixed VITE_, which keeps the boundary between public config and secrets enforced by the build tooling rather than by convention.
Requirements
- Node.js 18+
- A Firebase project with Google authentication and Firestore enabled
- A Reddit script application for API client credentials