Skip to main content
Local CDN is the development and test implementation: it drains upload streams, logs operations, and returns local-cdn:// stub URLs without writing to disk or calling a cloud provider.

Why

Use Local for safe development and Jest without R2 credentials, disk paths, or outbound object-storage traffic. The same CDNType contract applies so callers work unchanged when you switch to Cloudflare R2 in production.

Setup

  1. tooling-cdn-local is already a workspace dependency of apps/backend.
  2. Configure tools.cdn in apps/backend/src/configuration/development.ts and test.ts:
  1. No provider env vars are required.
  2. Verify:

Local observability

Operations log through feature logger cdn-local: Inspect backend stdout (Pino in dev) after an upload mutation.

Behavior vs production

Limitation

Stub URLs do not resolve in <img src>. For fetchable images in dev, use R2 in a staging environment or accept broken previews locally. Filesystem-backed local CDN is a possible future enhancement — not included in the boilerplate today.

Adding a new bucket constant

Local config has no buckets[] list, but callers still pass logical bucket names (e.g. CDN_BUCKET_PROFILE_PICTURES from apps/backend/src/constants/cdn.ts) for API consistency. See CDN overview for the full bucket recipe.

Gotchas

  • tools.cdn must appear in config for the tool to load — omitting it disables uploads entirely.
  • Local does not validate bucket names against a config list; unknown names still return stub URLs.
  • Do not point production traffic at Local.

What’s next?