OPENSOURCEStatus: COMPLETED
Image Resizer & Optimization Microservice
High-throughput backend image processing API built with TypeScript and Sharp, featuring disk caching, format conversion, placeholder generation, and automated Jasmine testing.
Role & ResponsibilityBackend Engineer
Program / Institutional ContextEngineered as a reusable microservice for high-load media processing pipelines requiring predictable memory utilization.
The Problem Statement
On-the-fly dynamic image resizing without caching saturates server CPU and triggers out-of-memory crashes under concurrent traffic spikes.
System Architecture
Constructed an Express service wrapping libvips via Sharp. Incoming requests check a deterministic disk cache keyed by dimension and quality hashes; cache misses trigger Sharp pipelines and pipe output simultaneously to disk and HTTP response streams.
Key Technical Decisions
- [1]Adopted Sharp over ImageMagick to achieve 4x-5x faster processing speeds and lower memory overhead.
- [2]Enforced strict query parameter sanitization with TypeScript guards to prevent path traversal and arbitrary file reads.
Architectural Trade-offs
- ⚖Disk-based caching requires disk volume management policies, but eliminates recomputation CPU costs.
Engineering Challenges
- ⚠Preventing race conditions when multiple concurrent clients request the exact same uncached image dimensions simultaneously.
Verifiable Outcomes
- ✓100% test coverage across endpoint controllers and image processing modules using Jasmine.
- ✓Sub-15ms cached response times on standard server hardware.
Technologies & Libraries Employed
TypeScriptNode.jsExpressSharpJasmine Test Suite