Trim Voicy message stats and gzip JSON responses #65

Merged
backmeupplz merged 1 commit from trim-and-gzip-stats into master 2026-10-08 21:01:07 +00:00
backmeupplz commented 2026-10-08 20:18:39 +00:00 (Migrated from github.com)

Makes the borodutch.com stats requests much smaller.

  • /stats/voicy was 580 KB. 489 KB of that was messageStats carrying whole Mongo documents (_id, createdAt, updatedAt, __v). It now keeps only { date, count }, the only fields the site charts.
  • JSON responses are gzipped when the client sends Accept-Encoding: gzip, using a ~15-line middleware on Node's zlib with no new dependency. Before this, every endpoint was served uncompressed: /count 55 KB, /stats/banofbot 257 KB, /stats/todorant 125 KB.

Checks: yarn build-ts, and jest passes 92/92. Ran it locally: /summary comes back gzipped with Vary: Accept-Encoding when asked, and as plain JSON otherwise.

Note: the service has to be redeployed on Easypanel to take effect.

🤖 Generated with Claude Code

Makes the borodutch.com stats requests much smaller. - `/stats/voicy` was **580 KB**. 489 KB of that was `messageStats` carrying whole Mongo documents (`_id`, `createdAt`, `updatedAt`, `__v`). It now keeps only `{ date, count }`, the only fields the site charts. - JSON responses are gzipped when the client sends `Accept-Encoding: gzip`, using a ~15-line middleware on Node's `zlib` with no new dependency. Before this, every endpoint was served uncompressed: `/count` 55 KB, `/stats/banofbot` 257 KB, `/stats/todorant` 125 KB. Checks: `yarn build-ts`, and `jest` passes 92/92. Ran it locally: `/summary` comes back gzipped with `Vary: Accept-Encoding` when asked, and as plain JSON otherwise. Note: the service has to be redeployed on Easypanel to take effect. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No description provided.