pardnio/node-image-server
Last updated
[!NOTE] This README was generated by SKILL, get the ZH version from here.
RESIZE ONCE, SERVE FROM CACHE EVERYWHERE!
A Node.js image resizing server with on-the-fly WebP/AVIF conversion, Nginx and CDN caching, and date-sorted trash
Table of Contents
Features
docker compose up -d· Documentation
- Four-Tier Caching — Browser, Cloudflare Worker, Nginx
proxy_cache, and on-disk cache files intercept requests layer by layer, so each image is processed only once. - On-the-Fly Resizing — URL parameters set size, quality, and format (WebP/AVIF/JPG/PNG), defaulting to WebP and shrinking oversized images to a 1024px long edge.
- Parameterized Cache Variants — Every size and quality combination produces its own cache file, and the Worker keys its cache on the query string, so variants never overwrite each other.
- Date-Sorted Trash — Deletion moves files into
.trash/YYYY-MM-DD/and returns the new location, making recovery by deletion date straightforward. - One-Command Deployment — Docker Compose starts Nginx alongside a PM2-managed Node.js cluster that respawns workers when they exit.
Architecture
graph TB
Client[Client] --> Worker[Cloudflare Worker<br>CDN cache]
Client --> Nginx[Nginx<br>proxy_cache]
Worker --> Nginx
Nginx --> App[Express Cluster]
App --> GET[GET /c/img<br>sharp conversion]
App --> POST[POST /upload]
App --> DEL[DELETE /del]
GET --> Storage[(storage/image<br>upload · cache)]
POST --> Storage
DEL --> Trash[(upload/.trash)]
License
This project is licensed under the MIT LICENSE.
Author
Just open an issue to share an idea.
©️ 2025 邱敬幃 Pardn Chiu