Overview
How to store files in your application.
With SuperStarter, you can easily upload and manage files (images, videos, documents, and more) in your application.
Uploading files
The most common approach to uploading files is to use client-side uploads. With client-side uploads, you avoid paying ingress/egress fees for transferring file binary data through your server.
Additionally, most hosting platforms like Vercel or Netlify have limitations on file size and maximum serverless function execution time.
That’s why SuperStarter utilizes the presigned URLs
feature of storage providers to upload files. Instead of sending files to the serverless function, the client requests a time-limited presigned URL from the serverless function and then uploads the file directly to the storage provider.
- Client requests a presigned URL from the serverless function.
- Server parses the request, validates the payload, optionally saves the metadata, and returns the presigned URL to the client.
- Client uploads the file to the presigned URL within the expiration time.
- (Optional) Once the file is uploaded, the serverless function is notified about the upload event, and the file metadata is saved to the database.
The configuration and use of storage is straightforward and simple. We’ll explore this in more detail in the following sections.
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 maight need presigned URLs
feature.