# deckmasterbeam/sniffiesprojects architecture

> Architecture diagram of the GitHub repository deckmasterbeam/sniffiesprojects, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deckmasterbeam/sniffiesprojects
- Repository: https://github.com/deckmasterbeam/sniffiesprojects

## Overview

Sniffies Tools is a set of browser clients and a serverless service that augment sniffies.com. The main workflow is a user configuring location, profile-filter, or bot-blocking features in a client; shared page hooks then alter location handling or filter page data. Separate branches provide profile reporting and SMS notifications through the backend, and a watcher extension observes live presence. The README documents capabilities beyond the sampled implementation; those are represented at subsystem level where exact internal calls were not shown.

Main entry points: [`userscript/src/userscript.ts`](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/userscript/src/userscript.ts) (iOS userscript), [`core/src/location-override-controller.ts`](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/location-override-controller.ts) (Location override), [`server/api/notify.ts`](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/notify.ts) (SMS notifications), [`client/src/content/sniffies-profile-id.ts`](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/client/src/content/sniffies-profile-id.ts) (Chrome extension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Browser clients"]
  node_client["Chrome extension"]
  node_userscript["iOS userscript<br/>[userscript.ts]"]
  node_bookmarklet["Safari bookmarklet<br/>[inject.ts]"]
  node_clientprefs[("Extension settings<br/>[settings.ts]")]
  node_userscriptprefs[("Userscript settings<br/>[local-storage.ts]")]
end

subgraph group_shared["Shared page features"]
  node_location["Location override"]
  node_citysearch["City search capture"]
  node_citystatus["City status UI"]
  node_geohook["Geolocation hook<br/>[geo-hook.ts]"]
  node_filters["Profile filtering<br/>[profile-filter.ts]"]
  node_filterhook["Response filter hook"]
  node_filterui["Filter menu<br/>[filter-menu-ui.ts]"]
  node_selection["Selection limits"]
  node_botreport["Bot reporting"]
  node_botui["Bot controls<br/>[bot-block-ui.ts]"]
end

subgraph group_backend["API and storage"]
  node_api["Serverless API<br/>[_shared.ts]"]
  node_reportapi["Report endpoint<br/>[report.ts]"]
  node_notifyapi["SMS notifications<br/>[notify.ts]"]
  node_favorites[("Favorites storage<br/>[favorites.ts]")]
  node_phone["Phone registration<br/>[save-number.ts]"]
  node_neon[("Neon Postgres")]
  node_textbelt["Textbelt SMS"]
end

subgraph group_presence["Presence alerts"]
  node_watcher["Watcher extension"]
  node_watchbackground["Watcher background<br/>[background.ts]"]
  node_events["Presence events<br/>[sniffies-events.ts]"]
end

node_user(("Sniffies user"))
node_sniffies["Sniffies site"]

node_user -->|"configures"| node_client
node_user -->|"configures"| node_userscript
node_user -->|"uses"| node_bookmarklet
node_client -.->|"enables"| node_location
node_userscript -->|"installs"| node_location
node_userscript -->|"installs"| node_botreport
node_userscript -->|"wires"| node_botui
node_userscript -->|"installs"| node_selection
node_userscript -->|"reads"| node_userscriptprefs
node_location -->|"installs"| node_geohook
node_location -->|"observes"| node_citysearch
node_location -->|"installs"| node_citystatus
node_citysearch -->|"reads response"| node_sniffies
node_geohook -->|"overrides location"| node_sniffies
node_filters -->|"defines rules"| node_filterhook
node_filterhook -->|"filters responses"| node_sniffies
node_filterui -->|"uses rules"| node_filters
node_selection -->|"raises caps"| node_sniffies
node_botreport -.->|"submits reports"| node_reportapi
node_reportapi -->|"uses helpers"| node_api
node_botreport -->|"hides confirmed bots"| node_sniffies
node_client -->|"stores settings"| node_clientprefs
node_watcher -->|"hooks WebSocket"| node_sniffies
node_watcher -.->|"dispatches events"| node_events
node_events -.->|"notifies"| node_watchbackground
node_watchbackground -->|"requests alerts"| node_notifyapi
node_notifyapi -->|"uses helpers"| node_api
node_notifyapi -->|"sends SMS"| node_textbelt
node_notifyapi -.->|"loads subscribers"| node_favorites
node_favorites -->|"persists"| node_neon
node_phone -.->|"registers number"| node_neon
node_user -.->|"registers"| node_phone

click node_client "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/client/src/content/sniffies-profile-id.ts"
click node_userscript "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/userscript/src/userscript.ts"
click node_bookmarklet "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/bookmarklet/src/inject.ts"
click node_watcher "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/content/sniffies-ws-hook.ts"
click node_clientprefs "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/client/src/shared/settings.ts"
click node_userscriptprefs "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/userscript/src/shared/local-storage.ts"
click node_location "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/location-override-controller.ts"
click node_citysearch "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/city-search-hook.ts"
click node_citystatus "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/city-search-status-hook.ts"
click node_geohook "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/geo-hook.ts"
click node_filters "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/profile-filter.ts"
click node_filterhook "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/profile-filter-hook.ts"
click node_filterui "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/filter-menu-ui.ts"
click node_selection "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/selection-limit-hook.ts"
click node_botreport "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/report-button-hook.ts"
click node_botui "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/bot-block-ui.ts"
click node_api "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/_shared.ts"
click node_reportapi "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/report.ts"
click node_notifyapi "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/notify.ts"
click node_favorites "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/favorites.ts"
click node_phone "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/save-number.ts"
click node_watchbackground "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/background/background.ts"
click node_events "https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/content/sniffies-events.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_userscript,node_bookmarklet,node_clientprefs,node_userscriptprefs,node_user toneBlue
class node_location,node_citysearch,node_citystatus,node_geohook,node_filters,node_filterhook,node_filterui,node_selection,node_botreport,node_botui toneAmber
class node_api,node_reportapi,node_notifyapi,node_favorites,node_phone,node_neon,node_textbelt toneMint
class node_watcher,node_watchbackground,node_events toneRose
class node_sniffies toneIndigo
```

## Components

### Browser clients

- [Chrome extension](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/client/src/content/sniffies-profile-id.ts): `client/src/content/sniffies-profile-id.ts`
- [iOS userscript](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/userscript/src/userscript.ts): `userscript/src/userscript.ts`
- [Safari bookmarklet](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/bookmarklet/src/inject.ts): `bookmarklet/src/inject.ts`
- [Extension settings](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/client/src/shared/settings.ts): `client/src/shared/settings.ts`
- [Userscript settings](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/userscript/src/shared/local-storage.ts): `userscript/src/shared/local-storage.ts`

### Shared page features

- [Location override](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/location-override-controller.ts): `core/src/location-override-controller.ts`
- [City search capture](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/city-search-hook.ts): `core/src/city-search-hook.ts`
- [City status UI](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/city-search-status-hook.ts): `core/src/city-search-status-hook.ts`
- [Geolocation hook](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/geo-hook.ts): `core/src/geo-hook.ts`
- [Profile filtering](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/profile-filter.ts): `core/src/profile-filter.ts`
- [Response filter hook](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/profile-filter-hook.ts): `core/src/profile-filter-hook.ts`
- [Filter menu](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/filter-menu-ui.ts): `core/src/filter-menu-ui.ts`
- [Selection limits](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/selection-limit-hook.ts): `core/src/selection-limit-hook.ts`
- [Bot reporting](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/report-button-hook.ts): `core/src/report-button-hook.ts`
- [Bot controls](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/core/src/bot-block-ui.ts): `core/src/bot-block-ui.ts`

### API and storage

- [Serverless API](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/_shared.ts): `server/api/_shared.ts`
- [Report endpoint](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/report.ts): `server/api/report.ts`
- [SMS notifications](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/notify.ts): `server/api/notify.ts`
- [Favorites storage](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/favorites.ts): `server/api/favorites.ts`
- [Phone registration](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/server/api/save-number.ts): `server/api/save-number.ts`
- **Neon Postgres**
- **Textbelt SMS**

### Presence alerts

- [Watcher extension](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/content/sniffies-ws-hook.ts): `watcher/src/content/sniffies-ws-hook.ts`
- [Watcher background](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/background/background.ts): `watcher/src/background/background.ts`
- [Presence events](https://github.com/deckmasterbeam/sniffiesprojects/blob/main/watcher/src/content/sniffies-events.ts): `watcher/src/content/sniffies-events.ts`

### Other components

- **Sniffies user**
- **Sniffies site**

## Connections

- Sniffies user → Chrome extension: configures
- Sniffies user → iOS userscript: configures
- Sniffies user → Safari bookmarklet: uses
- Chrome extension → Location override: enables
- iOS userscript → Location override: installs (evidence: `userscript/src/userscript.ts`)
- iOS userscript → Bot reporting: installs (evidence: `userscript/src/userscript.ts`)
- iOS userscript → Bot controls: wires (evidence: `userscript/src/userscript.ts`)
- iOS userscript → Selection limits: installs (evidence: `userscript/src/userscript.ts`)
- iOS userscript → Userscript settings: reads (evidence: `userscript/src/userscript.ts`)
- Location override → Geolocation hook: installs (evidence: `core/src/location-override-controller.ts`)
- Location override → City search capture: observes (evidence: `core/src/location-override-controller.ts`)
- Location override → City status UI: installs (evidence: `core/src/location-override-controller.ts`)
- City search capture → Sniffies site: reads response (evidence: `core/src/city-search-hook.ts`)
- Geolocation hook → Sniffies site: overrides location
- Profile filtering → Response filter hook: defines rules (evidence: `core/src/index.ts`)
- Response filter hook → Sniffies site: filters responses
- Filter menu → Profile filtering: uses rules (evidence: `core/src/filter-menu-ui.ts`)
- Selection limits → Sniffies site: raises caps
- Bot reporting → Report endpoint: submits reports
- Report endpoint → Serverless API: uses helpers (evidence: `server/api/report.ts`)
- Bot reporting → Sniffies site: hides confirmed bots
- Chrome extension → Extension settings: stores settings (evidence: `client/src/shared/settings.ts`)
- Watcher extension → Sniffies site: hooks WebSocket
- Watcher extension → Presence events: dispatches events
- Presence events → Watcher background: notifies
- Watcher background → SMS notifications: requests alerts
- SMS notifications → Serverless API: uses helpers (evidence: `server/api/notify.ts`)
- SMS notifications → Textbelt SMS: sends SMS
- SMS notifications → Favorites storage: loads subscribers
- Favorites storage → Neon Postgres: persists
- Phone registration → Neon Postgres: registers number
- Sniffies user → Phone registration: registers
