When it comes to managing data, a common question is: why can't we just use a database for everything?
The answer lies in the different types of data that a typical application needs to handle. Structured data, such as customer information or transaction records, fits nicely into a relational database model with its well-defined schema and robust querying capabilities.
On the other hand, semi-structured or unstructured data, which include images, videos, PDFs, and other file types, doesn't fit well into a structured schema. This type of data is often large in size and requires different methods for efficient storage and access.
NoSQL databases, such as MongoDB, can handle semi-structured data like JSON documents well. However, they are still not optimal for large unstructured data like multimedia files, especially regarding retrieval speed and cost-effectiveness. When the size and number of these files increase, it's more efficient and cost-effective to use a dedicated storage service to handle them.
Unlike databases, storage solutions are designed to handle large volumes of unstructured data. They provide efficient ways to store, retrieve, and manage this data. Additionally, they can cache and deliver these files directly to users, often through a Content Delivery Network (CDN), providing a faster and better user experience.
Supabase Storage uses Amazon S3, one of the most robust storage services, as its underlying technology. While we can use Amazon S3 directly, the additional features that Supabase has integrated into its Storage offering make it very developer-friendly and easy to move to production, with features such as CDN caching and on-demand image transformation.