We use any S3 compatible storage for our files, you can use the useFileStorage
composable to access the storage and perform CRUD operations.
// Upload a file
const files = await useFileStorage().upload();
// Get a public URL for the file
const file = await useFileStorage().getObjectUrl();
// DELETE
await useFileStorage().delete("file.png");
Any S3 compatible storage provider will work.
If you want to go with local file storage, you can easily do so with useFileStorage("local")
composable.
You will find examples for both local and S3 storage in the image-gallery demo.
If you are hosting your site on Cloudflare Pages, S3 doesn't work because Nuxt 3 expects ESM build of S3 Client SDK which AWS SDK doesn't support. More info here. I'd sugges using Cloudflare R2 using CF R2 bindings directly or I suggest using NuxtHub.