Skip to content

feat: add API response compression and payload optimization#968

Open
gavin913427-hash wants to merge 1 commit into
rohitdash08:mainfrom
gavin913427-hash:feat/api-response-compression
Open

feat: add API response compression and payload optimization#968
gavin913427-hash wants to merge 1 commit into
rohitdash08:mainfrom
gavin913427-hash:feat/api-response-compression

Conversation

@gavin913427-hash
Copy link
Copy Markdown

Changes

Implement response compression and payload optimization.

Features

  • Flask-Compress for automatic gzip compression (JSON, HTML, CSS, JS, XML)
  • Configurable minimum size threshold (500 bytes)
  • Response size tracking via Prometheus histogram
  • Pagination helper utility for consistent API responses
  • Updated expenses route to use pagination helper

Files Modified

  • packages/backend/requirements.txt - Added flask-compress
  • packages/backend/app/init.py - Configured compression
  • packages/backend/app/observability.py - Added response size metrics
  • packages/backend/app/routes/expenses.py - Uses pagination helper
  • packages/backend/app/utils/init.py - NEW: Utils package
  • packages/backend/app/utils/pagination.py - NEW: Pagination helper
  • packages/backend/tests/test_compression.py - NEW: 7 tests
  • packages/backend/app/services/README_COMPRESSION.md - NEW: Documentation

Fixes #129

Implement response compression and pagination improvements:

- Flask-Compress for automatic gzip compression (JSON, HTML, CSS, JS)
- Configurable min size threshold (500 bytes)
- Response size tracking via Prometheus histogram
- Pagination helper utility for consistent API responses
- Updated expenses route to use pagination helper
- 7 tests covering compression and pagination
- Documentation (README_COMPRESSION.md)

Fixes rohitdash08#129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API response compression & payload optimization

1 participant