# stapel-cdn 0.9.1

Media management: image/video/file/audio upload, processing (thumbnail/preview generation via libvips) and CDN ref tracking, with a media-submodule opt-in (images core, video/recordings behind ENABLED_SUBMODULES + ffmpeg system checks), a watermark seam, upload speed-limiting, and cdn.media_exists / cdn.refs_sync comm Functions for other modules to check/sync media references without importing this package.

Contract: axes 3 · extension points 4.
Generated from docs/capabilities.json by `stapel-llms-txt` — do not edit; drift-gated by `make contract-check`.

## Configuration axes — what a product switches on
Settings keys; `default` is what you get by saying nothing. Turning an axis off unmounts the operations it gates.
- ASSET_TYPES [list, default ["avatar"]] — Which image categories this deployment accepts
  Image.type choices — the same STAPEL_CDN key the client-side CdnImageField reads, so server validation and client typing agree on what's legal. Default is the zero-infrastructure 'avatar' only; marketplace-specific types (product/chat/review) are added explicitly by the host (conf.py, MODULE.md Extension points table).
- ENABLED_SUBMODULES [list, default ["images"]] — Enabled media types (images / video / audio recordings)
  Which of images/video/recordings this deployment turns on. images needs no opt-in; adding video/recordings activates the ffmpeg system-check probe for that submodule (conf.py, MODULE.md 'Media submodules').
- WATERMARK [enum, default ""] — Watermark preview images
  Dotted path to (or direct callable) a watermark engine applied to preview variants; empty disables watermarking (conf.py, MODULE.md 'Storage / processing backends').

## Extension points — what a product replaces, fork-free
- ASSET_TYPES [value_list_override]
  Read through the callable models.get_image_type_choices, so adding types never produces a model/migration change (MODULE.md Extension points table).
- WATERMARK [dotted_path]
  The only dotted-path key in the namespace: a callable (pyvips.Image) -> pyvips.Image; built-in reference stapel_cdn.watermarks.text_watermark renders WATERMARK_TEXT (MODULE.md 'Storage / processing backends').
- media_processed signal [django_signal]
  stapel_core.signals.media_processed sent after ImageProcessingService.process_image() generates all variants — in-process hook for cache warm-up/denormalization (MODULE.md 'Signals').
- serializer_seams [class_override]
  Every view in stapel_cdn.views mixes in SerializerSeamMixin (request_serializer_class/response_serializer_class + get_* getters); subclass and re-route the URL to swap (views.py:62-79, MODULE.md 'Serializer seams').

## Fits with — fleet dependencies
- stapel-core (required) — comm bus (cdn.media_exists/cdn.refs_sync Functions, user.deleted/user.deletion_initiated consume for GDPR), AppSettings, error registry (pyproject.toml dependency)
