Storage
With supastarter it's really easy to store files like images or other files in the cloud. supastarter uses this functionality for example to store the avatar images for users and teams, but you can use it for any other kind of files as well.
We currently support all S3 compatible storage providers like AWS S3, DigitalOcean Spaces, MinIO, etc. and Supabase Storage.
Uploading files in a serverless architecture
supastarter uses Nuxt route handlers for providing the API, which have some limitations when being deployed on serverless platforms like Vercel or Netlify like a maximum execution time and a maximum payload size. These limitations are not a problem for most use cases, but if you need to upload very large files or need to process the files in a way that takes a long time, you might need to use a different approach.
That's why supastarter utilizes the presigned URLs feature of the storage providers to upload files. That means instead of sending the files to the serverless function, the client requests a presigned URL from the serverless function and then uploads the file directly to the storage provider. This way you can make sure to not expose any credentials, handle authorization and authentication and also don't need to worry about the limitations of the serverless platforms.
Storage with S3 compatible services
All you need to do to set it up is to add the following environment variables to your .env.local
file (and later your production environment):
Per default, supastarter uses a bucket called avatars
to store the avatars for users and teams. Make sure to create this bucket in your S3 compatible storage service.
Some providers like DigitalOcean Spaces require you to set allowed origins for CORS requests. You can set the allowed origins to *
to allow all origins, but it's recommended to set it to the domain of your application.