Overview
Get started with storage in TurboStarter.
With TurboStarter, you can easily upload and manage files (images, videos, documents, and more) in your application.
Currently, all S3-compatible storage providers are supported, including AWS S3, DigitalOcean Spaces, Cloudflare R2, Supabase Storage, and others.
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 TurboStarter 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.
This approach ensures that credentials remain secure, handles authorization and authentication properly, and avoids the limitations of serverless platforms.
The configuration for storage is straightforward and simple. We'll explore this in more detail in the Configuration section.
Last updated on