Correct way to deal with user generated data
So I've been dealing with users sending images to host, and I've got up with packing blobs into file and sending them to backend, then use unstorage to store path to the file. Is there any open-source CDNs that on backend will just send me a "file link" so i could store only it in my db?
2 Replies
Hi @FearArt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, there are open-source and third-party storage/CDN solutions that can provide you with a file link after upload, allowing you to store only the URL in your database. Based on the knowledge sources, here are some options you can use with unstorage and Nuxt/Nitro:
1. Uploadcare
Uploadcare is integrated with the Nuxt Image module. When you upload an image, Uploadcare provides a UUID-based file link (e.g.,
You can use the unstorage S3 driver to upload files to any S3-compatible storage (such as Amazon S3, MinIO, or Cloudflare R2). After uploading, you get a public URL to the file, which you can store in your database. For Cloudflare R2, set the
UploadThing is supported experimentally in unstorage. After uploading, you receive a file link that you can store. Note that there is a known issue with reusing deleted keys. See UploadThing driver docs. 4. Netlify Blobs
Netlify Blobs allows you to store files and provides a link to each file. This works in both edge and Node.js environments. You can use the unstorage Netlify Blobs driver to interact with this service. See Netlify Blobs driver docs. Summary:
All these solutions allow you to upload user-generated files, receive a public file link, and store only the link in your database. The choice depends on your hosting, privacy, and scalability needs. If you want a fully open-source stack, S3-compatible solutions like MinIO (self-hosted) are a good fit. If you prefer managed services, Uploadcare, Cloudflare R2, or Netlify Blobs are easy to integrate with Nuxt and unstorage. If you need more details on how to implement any of these with Nuxt or unstorage, let me know! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Uploadcare is integrated with the Nuxt Image module. When you upload an image, Uploadcare provides a UUID-based file link (e.g.,
<https://ucarecdn.com/<uuid>/
>). You can use this link directly in your database. Nuxt Image supports this provider out of the box, and you can even configure a custom CDN domain if needed. Example usage:
You can configure the provider in nuxt.config.ts
to use a custom CDN domain if desired. See Uploadcare provider docs for more details.
2. S3-Compatible Providers (including Cloudflare R2)You can use the unstorage S3 driver to upload files to any S3-compatible storage (such as Amazon S3, MinIO, or Cloudflare R2). After uploading, you get a public URL to the file, which you can store in your database. For Cloudflare R2, set the
region
to auto
and use the appropriate endpoint. See S3 driver docs and Cloudflare R2 docs.
3. UploadThingUploadThing is supported experimentally in unstorage. After uploading, you receive a file link that you can store. Note that there is a known issue with reusing deleted keys. See UploadThing driver docs. 4. Netlify Blobs
Netlify Blobs allows you to store files and provides a link to each file. This works in both edge and Node.js environments. You can use the unstorage Netlify Blobs driver to interact with this service. See Netlify Blobs driver docs. Summary:
All these solutions allow you to upload user-generated files, receive a public file link, and store only the link in your database. The choice depends on your hosting, privacy, and scalability needs. If you want a fully open-source stack, S3-compatible solutions like MinIO (self-hosted) are a good fit. If you prefer managed services, Uploadcare, Cloudflare R2, or Netlify Blobs are easy to integrate with Nuxt and unstorage. If you need more details on how to implement any of these with Nuxt or unstorage, let me know! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@360699173378588674> Kapa.ai is still learning and improving, please let me know how I did by reacting below.