feat(media): External Storage Support for Media Uploads#315
feat(media): External Storage Support for Media Uploads#315larbish merged 40 commits intonuxt-content:mainfrom
Conversation
…h Cloudflare R2 - Added configuration options for OSS uploads in Nuxt Studio. - Implemented upload, list, and delete endpoints for managing media files in Cloudflare R2. - Updated documentation to reflect new media management features, including external storage integration. - Enhanced media item handling to support OSS URLs and metadata. This update allows users to manage larger media libraries efficiently by storing files externally, reducing repository size.
|
@MrSociety404 is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks a lot for this pull request @MrSociety404! I'll have a check at it next week 🫡 |
Hey there! Did you have a chance to review my PR? 👀 |
|
I was just looking over this as I think it would benefit my team. One consideration I would like to suggest is to integrate Nuxt Blob Storage via NuxtHub as this could massively simplify the configuration process for your suggested S3-compatible providers? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hey @MrSociety404, one more update: I've reworked the storage layer to drop the unstorage approach in favor of NuxtHub blob storage. S3 providers are still supported but now Vercel blob is also available. The detection logic stays simple, we check that @nuxthub/core is installed and blob is enabled. The docs have been updated to reflect the new setup. Can you give it a try with |
|
@MattA-Official I did integrate Nuxt Blob storage. Do you have any project you can try this PR with? 🙏 |
|
I'm currently testing it with https://github.com/pups-in-the-park/website/tree/feat/cloudflare-r2-storage but I think I might have broken something in doing so... Upload works - and I can manage it in my R2 Dashboard - but the media page doesn't appear to show anything. The image searcher shows "No images available" Additionally, when I have uploaded something I have to review and commit the changes and then alongside the image being added to R2 it is committing it to the repo still. I'm not sure if I've perhaps configured something incorrectly? https://feat-cloudflare-r2-storage-website.pups-in-the-park.workers.dev/ |
|
@MattA-Official To be honest I only tried Cloudflare R2 storage with the |
|
@MattA-Official, I’m experiencing the same issues with Cloudflare R2 when using the Docus playground. It appears to have been fixed in my last commit. The previous string replacement created a start path of Could you please confirm that the issues have been resolved? I should also mention that I’ve tested the issue with environment variables, but I haven’t tested it with the Nuxt Hub configuration for R2. |
|
Thanks @MrSociety404, I did remove this strip just before comiting my last update 🙈 Looks all good now! Ready to merge 🎉 |
This was a bug, I've fixed it also. |
Summary
Motivation
For projects with large media libraries, committing binary files to Git causes repository bloat and slow clone times. This feature allows teams to offload media storage to cloud providers while maintaining the same intuitive Studio media library experience.
Changes
Module Configuration (
src/module/src/module.ts)studio.mediaconfiguration option withenabled,endpoint,listEndpoint,deleteEndpoint,maxFileSize, andallowedTypessettingsNew Composables
useOSSUpload- Handles file validation and uploads to configured endpointsuseDraftMedias- Supports both local and OSS media itemsTypes (
src/app/src/types/media.ts)MediaItemextended withossUrl,ossKey, andossMetadatafieldsOSSUploadResult,OSSUploadError, andOSSUploadResponsetypesReference Implementation (
playground/docus/)Documentation (
docs/content/6.medias.md)Test plan