# Storage is now available in Supabase

[Supabase](https://yomu.fyi/company/supabase) · Inian Parameshwaran · Mar 30, 2021

**Type:** Announcement

## Summary

Supabase launched Storage, adding a scalable object store to its existing Postgres, authentication, and API services. Existing open-source storage servers like Ceph, Swift, Minio, and Zenko were evaluated but rejected due to auth incompatibilities and external dependencies like etcd, MongoDB, and Kafka. Consequently, the team implemented a custom Storage API server built with Fastify and TypeScript behind the Kong gateway. Object metadata and access control reside directly in Postgres, leveraging Row Level Security policies written in SQL rather than a proprietary domain-specific language. Objects stream directly to managed backends like AWS S3 using Node streams with minimal in-memory buffering, accompanied by a default one-hour Cache-Control header.

## Context

Users required a scalable object store integrated into the Supabase ecosystem, but existing open-source storage servers could not use Postgres as their primary datastore and bundled incompatible authentication systems.

## Approach / What changed

Built a custom Storage API server using Fastify, TypeScript, and Node streams behind a Kong gateway, delegating metadata and authorization to Postgres tables via Row Level Security while storing actual objects in S3.

## Takeaways

- Instead of introducing a custom policy DSL, Supabase Storage leverages Postgres Row Level Security on a dedicated storage schema to evaluate authorization.
- Node streams upload objects directly to S3 with minimal in-memory buffering, reducing RAM consumption during large file transfers.
- Supabase Storage applies a default Cache-Control header of one hour to retrieved objects to ensure browser caching, which can be overridden.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [AWS](https://yomu.fyi/topic/aws), [Postgres](https://yomu.fyi/topic/postgres), [REST APIs](https://yomu.fyi/topic/rest-api), [TypeScript](https://yomu.fyi/topic/typescript)

[Read original post](https://supabase.com/blog/supabase-storage)
