The Asset Manager is a Next.js App Router application deployed to Webflow Cloud through OpenNext.
- A user opens
/assets. - The app checks interface auth through
src/lib/auth-gate.ts. - The React UI calls API routes under
/assets/api/assets/**. - API routes read and write metadata in
ASSET_INDEX. - File bytes are stored in
CLOUD_ASSETS; generated thumbnails are stored inCLOUD_ASSET_THUMBNAILS. - Copied links serve files through
/assets/files/:slugand thumbnails through/assets/thumbnails/:id.
CLOUD_ASSETS stores file bytes. Object keys are not intended to be the customer-facing contract.
CLOUD_ASSET_THUMBNAILS stores generated preview artifacts. New thumbnail writes go to this bucket, while delivery still falls back to legacy thumbnails that may exist in CLOUD_ASSETS.
ASSET_INDEX stores the stable asset record: URL slug, display name, original filename, content type, size, object key, folder, tags, cache policy, thumbnail metadata, upload status, and soft-delete state.
That split lets the app preserve stable links even when users rename, reorganize, or replace assets. Editing the URL slug intentionally changes the public file link.
src/components/asset-manager.tsx: main product UI, upload flow, filters, table, drawer, copy actions, replacement, and trash.src/lib/asset-storage.ts: schema safety, validation, metadata mapping, search/filter queries, settings, tags, and usage stats.src/app/api/assets/**: asset management APIs for listing, upload, update, replacement, thumbnails, duplicates, settings, and usage.src/app/files/[id]/route.ts: stable file delivery route withGET,HEAD, byte ranges, validation headers, cache intent, and trash/status handling.src/app/thumbnails/[id]/route.ts: generated thumbnail delivery route.migrations/**: additive database migrations for the asset index.
Files are served through the app, not directly from a public bucket.
The file route supports full downloads, HEAD, single byte ranges, ETag revalidation, content disposition, per-asset cache intent, and 410 Gone for assets still recoverable in trash.
Webflow Cloud may override Cache-Control response headers at the platform layer. The app still records cache intent and emits best-effort headers, but cache-busted fresh URLs are the dependable invalidation path.
The URL slug is the stable file-link contract. Asset IDs and object keys remain internal to the app and storage layer.
- Replace
src/lib/auth.tsto connect your auth provider. - Extend
migrations/**andsrc/lib/asset-storage.tstogether for new metadata fields. - Adjust
src/components/asset-manager.tsxfor workflow changes such as approvals, ownership, or custom review queues. - Update
src/app/globals.cssandpublic/brand/**if you want different branding. - Change delivery behavior in
src/app/files/[id]/route.tsif your project needs different headers, transforms, or access rules.
Keep runtime behavior and database migrations in sync. If a new UI field needs to persist, add a migration and update the storage helpers in the same change.