Build Cloudinary
KINDAreplaces $99/mosaves $1,188/yrback to the verdict
An image CDN for your own sites without writing an image processor: originals in S3-compatible storage, imgproxy resizing and converting on request by signed URL, a cache in front, and a helper that emits srcset for every image. Video and the media library stay with the vendor.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Everything in this build runs on it: the server, the scripts, the tests.
Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗
Verify
node --version prints v22 or higher - installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - API keycents to a few dollars a month
Why Where originals live.
Get it Cloudflare R2: dashboard > R2 > Create bucket > Manage R2 API Tokens. Backblaze B2: Buckets > Create, then App Keys. Note endpoint, bucket, key id and secret. open ↗
- installfree
Why imgproxy runs as a container.
Get it docs.docker.com/engine/install/ubuntu open ↗
Verify
docker compose version prints - accountabout $5 a month
Why This needs one process running all the time with a public address. imgproxy needs a box; 2 GB of RAM is comfortable.
Get it Hetzner Cloud (from about 4 EUR), DigitalOcean or Fly.io. Ubuntu 24.04, the smallest size. You need SSH access and a public IP. Only needed for the deploy phase; develop locally first. open ↗
- accountroughly $10 a year, or free on an existing domain
Why img.yourdomain.com
Get it Register at Cloudflare Registrar, Porkbun or Namecheap, or use a subdomain of one you already own. You add one DNS record in the deploy phase. open ↗
- installfree
Why Automatic HTTPS in front of the Node process. Without TLS the browser features this relies on (and your visitors' trust) do not work.
Get it On the VPS: follow the install steps at caddyserver.com/docs/install for Ubuntu. One Caddyfile with your domain and a reverse_proxy line is the whole config. open ↗
Verify
caddy version prints a version on the server - decidefree
Why Unsigned URLs would let anyone resize anything through your box.
Get it openssl rand -hex 32 twice, into .env.
Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
S3_ENDPOINT | required | https://<account>.r2.cloudflarestorage.com | From the bucket provider. |
S3_BUCKET | required | images | Bucket name. |
S3_ACCESS_KEY_IDsecret | required | ... | Bucket access key. |
S3_SECRET_ACCESS_KEYsecret | required | ... | Bucket secret. |
IMGPROXY_KEYsecret | required | hex | openssl rand -hex 32. |
IMGPROXY_SALTsecret | required | hex | openssl rand -hex 32. |
UPLOAD_TOKENsecret | required | base64 | Bearer token for the upload endpoint. |
IMG_URL | required | https://img.yourdomain.com | Public base of the image domain. |
The build, in order
Originals
Upload behind a token, content-hash keys, sniffed, capped, EXIF stripped, never overwritten.
- terminal
mkdir imgcdn && cd imgcdn && git init && npm init -y && npm pkg set type=module && npm install @aws-sdk/client-s3@3 sharp@0.35.3 mkdir -p data && cp .env.example .env
done when · tick each as it passesTransforms
imgproxy with the bucket as source, signed URLs, auto WebP and AVIF.
Files
docker-compose.yml
done when · tick each as it passesCache
Responsive helper
Operate
Lifecycle rules, memory limits, healthz, backups of the key index.
Files
README.md
done when · tick each as it passesServe several sitesproduct builder
Per-site prefixes, tokens and metrics.
done when · tick each as it passes
That is the whole plan for Cloudinary. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- Video, the media library, AI tagging, upload widgets: the $99.
- video transcoding and adaptive streaming
- the media library and AI tagging
- global edge delivery you do not operate
- upload widgets and SDKs for every platform
- Direct-to-bucket presigned uploads from the browser
- Focal-point cropping metadata
Need the files? The project pack on the verdict page hands your agent the whole brief · more hosting.