How incatswetrust/whisper-backend works
whisper-backend is an HTTP API for anonymous, self-destructing encrypted notes and files. Clients POST content and note settings; the notes route encrypts server-mode payloads or accepts opaque client ciphertext, then stores a record. On GET, it checks access conditions, optionally decrypts, atomically burns a view, and returns content or ciphertext. PostgreSQL backs notes and fixed-window rate limits; an authorized cleanup endpoint sweeps expired data. The README documents the API and Vercel Cron integration; relationships for unsampled deployment wiring are shown only where documented.
Main entry points: app.ts HTTP App · notes.ts Read Notes · rateLimit.ts Rate Limits · internal.ts Expiry Cleanup
Components 13
HTTP API
- HTTP App
src/app.ts
Note Lifecycle
- Create Notes
src/routes/notes.ts - Read Notes
src/routes/notes.ts - Note Encryption
src/crypto.ts
Access Controls
- IP Gate
src/ip.ts - Rate Limits
src/rateLimit.ts - Runtime Config
src/config.ts
Persistence and Cleanup
- Note Store
src/store.ts - SQL Client
src/db.ts - PostgreSQL
- Expiry Cleanup
src/routes/internal.ts
Other components
- API Clients
- Vercel Cron
Connections 22
- API Clients → HTTP App: send requests
README.md - HTTP App → Create Notes: routes POST
src/app.ts - HTTP App → Read Notes: routes GET
src/app.ts - HTTP App → Expiry Cleanup: routes internal
src/app.ts - HTTP App → Note Store: reads stats
src/app.ts - HTTP App → Runtime Config: configures CORS
src/app.ts - Create Notes → Rate Limits: applies limiter
src/routes/notes.ts - Read Notes → Rate Limits: applies limiters
src/routes/notes.ts - Create Notes → Note Encryption: encrypts payload
src/routes/notes.ts - Read Notes → Note Encryption: decrypts payload
src/routes/notes.ts - Create Notes → Note Store: writes note
src/routes/notes.ts - Read Notes → Note Store: fetches and burns
src/routes/notes.ts - Read Notes → IP Gate: checks allowlist
src/routes/notes.ts - Create Notes → Runtime Config: reads limits and defaults
src/routes/notes.ts - Read Notes → Runtime Config: reads limits
src/routes/notes.ts - Rate Limits → IP Gate: gets client IP
src/rateLimit.ts - Rate Limits → SQL Client: updates buckets
src/rateLimit.ts - Note Store → SQL Client: reads and writes notes
src/store.ts - SQL Client → PostgreSQL: queries database
src/db.ts - Expiry Cleanup → SQL Client: deletes expired rows
src/routes/internal.ts - Expiry Cleanup → Runtime Config: checks cron secret
src/routes/internal.ts - Vercel Cron → Expiry Cleanup: requests cleanup
README.md