Purpose & Overview
Manages digital assets, attachments, and files across the application with polymorphic associations to any model.
Installation & Setup
1
Install the package
bash
bun veap add @veap/media-plugin2
Register in lib/veap.ts (or auto via lib/plugins.gen.ts)
lib/veap.ts
typescript
// lib/veap.ts
import { Application } from "@veap/kernel";
import mediaPlugin from "@veap/media-plugin";
export const app = Application.configure()
.withDatabase()
.withStorage()
.withPlugins([mediaPlugin])
.create();
// Querying media files programmatically:
import { MediaFile } from "@veap/media-plugin";
const images = await MediaFile.query()
.where("mime_type", "like", "image/%")
.orderBy("created_at", "desc")
.get();3
Start application
bash
bun devMigrations run automatically on boot via MigrationServiceProvider.
Keep in mind
- Stores files locally in `public/storage` by default with automatic static server routing.
- Supports external storage providers (e.g. @veap/vercel-blob-plugin, AWS S3, Cloudflare R2).
- Related models can use the polymorphic `morphMany('media_files')` relation to attach assets.
Dependencies
Veap Kernel
@veap/kernel (^0.1.0)
Required Veap Plugins
NPM Packages
date-fns@^4.1.0sonner@^2.0.0zod@^4.4.3lucide-react@^1.27.0
Authors & Maintainers
Veap Core Team
Maintainer