Skip to content

DameonK/bapcs-alerts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bapcs-alerts

A two-piece system that turns r/buildapcsales into push notifications you actually want to see.

┌──────────────────────────────┐         ┌─────────────────────────────┐
│   Synology NAS  (or VPS)     │         │   Android phone             │
│                              │         │                             │
│   bapcs-alerts-backend       │         │   bapcs-alerts client       │
│   ┌────────────┐             │         │   ┌──────────────┐          │
│   │ poller     │ every 30s   │         │   │ Compose UI   │          │
│   │ → reddit   │────────────►│         │   │ Rules / Deals│          │
│   │ → parser   │             │         │   │ / Settings   │          │
│   │ → rules    │             │         │   └──────────────┘          │
│   │ → fcm      │─────────────┼────────►│         ▲                    │
│   └────────────┘             │  push   │         │                    │
│   express REST  ◄────────────┼─────────┼─ rule CRUD, register token  │
│   sqlite (data/)             │  HTTPS  │                             │
└──────────────────────────────┘         └─────────────────────────────┘

Layout

Path What it is
backend/ Node 20 + TypeScript service (poller, REST API, FCM push)
android/ Kotlin + Compose Android app
docs/ Notes, design decisions

Each subdirectory has its own README with concrete setup steps.

End-to-end setup, in order

  1. Backend prerequisites. Reddit script app, Firebase service-account JSON, a random API_TOKEN. See backend/README.md.
  2. Deploy backend. docker compose up -d --build on the NAS.
  3. Configure Android client. Drop google-services.json from the same Firebase project into android/app/. Build, install, point Settings at the backend URL + API_TOKEN, register the device.
  4. Create rules. Open the Rules tab, add e.g. "GPU under $500": include rtx, rx 7, retailers Amazon, Newegg, categories GPU, max price 500.00, channel id deals_gpu, importance high.
  5. Wait. Next time a matching post hits r/buildapcsales /new, you get a push.

Features

  • Per-rule filtering: include/exclude keywords, retailer, category/flair, max price, min upvotes, MIR exclusion.
  • Per-rule Android notification channels & priority.
  • EXPIRED-flair detection. Refreshes flair on every poll; deals killed by mods don't notify, and existing entries get re-rendered as strikethrough in the Deals tab.
  • Repost dedup. Same canonical URL across reposts collapses into one notification per REPOST_DEDUP_HOURS window (affiliate/tracking params stripped before comparison).
  • Quiet hours. Per-rule HH:MM start/end window in the backend's configured TZ; pushes during the window are dropped (post still stored).
  • Test push button. Send a [TEST] notification using the most recent matching post (or a synthetic one) without waiting for a real deal.
  • Backend GitHub Actions type-check on every push.

Things deliberately left out of v0.1

  • Multi-user. One set of rules, one device pool per backend.
  • Pull-to-refresh / pagination on the lists.
  • Price-history tracking. Each post is a snapshot; we don't track edits or repost detection.
  • Discord integration. Out of scope for now.
  • Rate-limit pressure handling. At 30s × one subreddit you're far below Reddit's 60/min OAuth limit; if you add subs, add backoff.

Where things live in the backend

  • src/reddit.ts — OAuth + /new fetch
  • src/parser.ts — title heuristics (price, retailer, MIR, category)
  • src/rules.ts — rule CRUD + matcher
  • src/store.ts — posts, devices, sent-log
  • src/fcm.ts — FCM multicast w/ token cleanup
  • src/poller.ts — the loop that ties it all together
  • src/api.ts — Express REST API
  • src/index.ts — bootstrap

Where things live in the Android app

  • data/Models.kt — DTOs (mirror backend types)
  • data/Api.kt — Retrofit interface + factory
  • data/Settings.kt — DataStore-backed url + token
  • data/ServiceLocator.kt — hand-rolled DI
  • notify/PushService.kt — FCM service (token rotation)
  • notify/Channels.kt — creates per-rule channels on save
  • ui/AppRoot.kt — bottom-nav scaffold
  • ui/PostsScreen.kt / RulesScreen.kt / RuleEditorScreen.kt / SettingsScreen.kt — the UI

About

Filtered push notifications from r/buildapcsales: Node/TS backend on Synology + Kotlin/Compose Android client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors