Create a media upload collection
Enable file uploads and capture accessible metadata in a dedicated media collection.
This generated recipe is review-ready source material. Use it from the runtime where it appears in the sidebar and search results.
Enable file uploads and capture accessible metadata in a dedicated media collection.
Use this when
- let editors upload images
- create a media library
- store uploaded files
- add image uploads to my project
Dyrected concepts
upload, StorageAdapter, media
Additional packages: No additional packages.
Decisions and cautions
Use this recipe only when its runtime matches the project you are documenting or building. Cloud recipes must stay inside the managed content backend boundary. Self-hosted recipes may use the server runtime, database, hooks, and infrastructure you control.
Complete recipe
This is the canonical source compiled and behavior-tested by @dyrected/knowledge.
import { defineCollection, defineTextField, defineTextareaField } from "@dyrected/core";
export const Media = defineCollection({
slug: "media",
upload: {
allowedMimeTypes: ["image/jpeg", "image/png", "image/webp"],
maxFileSize: 10 * 1024 * 1024,
},
fields: [
defineTextField({ name: "alt", label: "Alternative text", required: true }),
defineTextareaField({ name: "caption", label: "Caption" }),
],
});Create a responsive image library
Define reusable image sizes and a thumbnail preset on an upload collection for media-driven projects.
Overview
Browse the app-shaped Dyrected examples that are planned next, see what each one is meant to teach, and jump to the docs pages that already cover the underlying patterns.