Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Break out Storage quickstart

dannykng3762c69f8360
diff --git a/apps/docs/components/Navigation/Navigation.constants.ts b/apps/docs/components/Navigation/Navigation.constants.ts
index 47c2bee3335..565d27b4ce8 100644
--- a/apps/docs/components/Navigation/Navigation.constants.ts
+++ b/apps/docs/components/Navigation/Navigation.constants.ts
@@ -244,6 +244,7 @@ export const menuItems: NavMenu = {
label: 'Storage',
items: [
{ name: 'Overview', url: '/guides/storage', items: [] },
+ { name: 'Quickstart', url: '/guides/storage/quickstart', items: [] },
{ name: 'CDN', url: '/guides/storage-cdn', items: [] },
],
},
diff --git a/apps/docs/pages/guides/storage.mdx b/apps/docs/pages/guides/storage.mdx
index bbf3df61c91..f9def048f2b 100644
--- a/apps/docs/pages/guides/storage.mdx
+++ b/apps/docs/pages/guides/storage.mdx
@@ -34,209 +34,7 @@ keep all video files in a "video" bucket, and profile pictures in an "avatar" bu
></iframe>
</div>
-## Getting started
-
-This is a quick guide that shows the basic functionality of Supabase Storage. Find a full
-[example application in GitHub](https://github.com/supabase/supabase/tree/master/examples/user-management/nextjs-ts-user-management),
-which you can deploy yourself.
-
-[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fuser-management%2Fnextjs-ts-user-management&project-name=supabase-user-management&repository-name=supabase-user-management&demo-title=Supabase%20User%20Management&demo-description=An%20example%20web%20app%20using%20Supabase%20and%20Next.js&demo-url=https%3A%2F%2Fsupabase-nextjs-ts-user-management.vercel.app&demo-image=https%3A%2F%2Fi.imgur.com%2FZ3HkQqe.png&integration-ids=oac_jUduyjQgOyzev1fjrW83NYOv&external-id=nextjs-user-management)
-
-<Admonition type="note">
-
-File, Folder, and Bucket names **must follow** [AWS object key naming guidelines](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) and avoid use of any other characters.
-
-</Admonition>
-
-### Create a bucket
-
-You can create a bucket using the Supabase Dashboard.
-Since the storage is interoperable with your Postgres database, you can also use SQL or our
-client libraries. Here we create a bucket called "avatars":
-
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="dashboard"
->
-<TabPanel id="dashboard" label="Dashboard">
-
-1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
-2. Click **New Bucket** and enter a name for the bucket.
-3. Click **Create Bucket**.
-
-</TabPanel>
-<TabPanel id="sql" label="SQL">
-
-```sql
--- Use Postgres to create a bucket.
-
-insert into storage.buckets (id, name)
-values ('avatars', 'avatars');
-```
-
-</TabPanel>
-<TabPanel id="javascript" label="JavaScript">
-
-```js
-// Use the JS library to create a bucket.
-
-const { data, error } = await supabase.storage.createBucket('avatars')
-```
-
-[Reference.](/docs/reference/javascript/storage-createbucket)
-
-</TabPanel>
-<TabPanel id="dart" label="Dart">
-
-```dart
-void main() async {
- final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
-
- final storageResponse = await supabase
- .storage
- .createBucket('avatars');
-}
-```
-
-[Reference.](https://pub.dev/documentation/storage_client/latest/storage_client/SupabaseStorageClient/createBucket.html)
-
-</TabPanel>
-</Tabs>
-
-### Upload a file
-
-You can upload a file from the Dashboard, or within a browser using our JS libraries.
-
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="dashboard"
->
-<TabPanel id="dashboard" label="Dashboard">
-
-1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
-2. Select the bucket you want to upload the file to.
-3. Click **Upload File**.
-4. Select the file you want to upload.
-
-</TabPanel>
-<TabPanel id="javascript" label="JavaScript">
-
-```js
-const avatarFile = event.target.files[0]
-const { data, error } = await supabase.storage
- .from('avatars')
- .upload('public/avatar1.png', avatarFile)
-```
-
-[Reference.](/docs/reference/javascript/storage-from-upload)
-
-</TabPanel>
-<TabPanel id="dart" label="Dart">
-
-```dart
-void main() async {
- final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
-
- // Create file `example.txt` and upload it in `public` bucket
- final file = File('example.txt');
- file.writeAsStringSync('File content');
- final storageResponse = await supabase
- .storage
- .from('public')
- .upload('example.txt', file);
-}
-```
-
-[Reference.](https://pub.dev/documentation/storage_client/latest/storage_client/SupabaseStorageClient/createBucket.html)
-
-</TabPanel>
-</Tabs>
-
-### Download a file
-
-You can download a file from the Dashboard, or within a browser using our JS libraries.
-
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="dashboard"
->
-<TabPanel id="dashboard" label="Dashboard">
-
-1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
-2. Select the bucket that contains the file.
-3. Select the file that you want to download.
-4. Click **Download**.
-
-</TabPanel>
-<TabPanel id="javascript" label="JavaScript">
-
-```js
-// Use the JS library to download a file.
-
-const { data, error } = await supabase.storage.from('avatars').download('public/avatar1.png')
-```
-
-[Reference.](/docs/reference/javascript/storage-from-download)
-
-</TabPanel>
-<TabPanel id="dart" label="Dart">
-
-```dart
-void main() async {
- final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
-
- final storageResponse = await supabase
- .storage
- .from('public')
- .download('example.txt');
-}
-```
-
-[Reference.](/docs/reference/dart/storage-from-download)
-
-</TabPanel>
-</Tabs>
-
-### Add security rules
-
-To restrict access to your files you can use either the Dashboard or SQL.
-
-<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="dashboard"
->
-<TabPanel id="dashboard" label="Dashboard">
-
-1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
-2. Click **Policies** in the sidebar.
-3. Click **Add Policies** in the `OBJECTS` table to add policies for Files. You can also create policies for Buckets.
-4. Choose whether you want the policy to apply to downloads (SELECT), uploads (INSERT), updates (UPDATE), or deletes (DELETE).
-5. Give your policy a unique name.
-6. Write the policy using SQL.
-
-</TabPanel>
-<TabPanel id="sql" label="SQL">
-
-```sql
--- Use SQL to create a policy.
-
-create policy "Public Access"
- on storage.objects for select
- using ( bucket_id = 'public' );
-```
-
-</TabPanel>
-</Tabs>
-
-## Public and Private Buckets
+### Public and Private Buckets
Storage buckets are private by default.
@@ -245,9 +43,7 @@ Alternatively, you can create a publicly shareable URL with an expiry date using
which calls the `/object/sign/` API.
For public buckets, you can access the assets directly without a token or an Authorisation header. The [getPublicUrl](/docs/reference/javascript/storage-from-getpublicurl)
-helper method returns the full public URL for an asset. This calls the `/object/public/` API endpoint internally. While no authorization is required for accessing objects in a public bucket, proper [access control](#access-control) is required for other operations like uploading, deleting objects from public buckets as well.
-
-Public buckets also tend to have [better performance](/docs/guides/storage-cdn#public-vs-private-buckets).
+helper method returns the full public URL for an asset. This calls the `/object/public/` API endpoint internally. While no authorization is required for accessing objects in a public bucket, proper [access control](#access-control) is required for other operations like uploading, deleting objects from public buckets as well. Public buckets also tend to have [better performance](/docs/guides/storage-cdn#public-vs-private-buckets).
<details>
<summary>Advanced: reverse proxy</summary>
diff --git a/apps/docs/pages/guides/storage/quickstart.mdx b/apps/docs/pages/guides/storage/quickstart.mdx
new file mode 100644
index 00000000000..20b99aee99f
--- /dev/null
+++ b/apps/docs/pages/guides/storage/quickstart.mdx
@@ -0,0 +1,216 @@
+import Layout from '~/layouts/DefaultGuideLayout'
+
+export const meta = {
+ id: 'storage-quickstart',
+ title: 'Storage Quickstart',
+ description: 'Learn how to use Supabase to store and serve files.',
+ sidebar_label: 'Quickstart',
+}
+
+This guide shows the basic functionality of Supabase Storage. Find a full [example application on GitHub](https://github.com/supabase/supabase/tree/master/examples/user-management/nextjs-ts-user-management) you can deploy yourself.
+
+[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fuser-management%2Fnextjs-ts-user-management&project-name=supabase-user-management&repository-name=supabase-user-management&demo-title=Supabase%20User%20Management&demo-description=An%20example%20web%20app%20using%20Supabase%20and%20Next.js&demo-url=https%3A%2F%2Fsupabase-nextjs-ts-user-management.vercel.app&demo-image=https%3A%2F%2Fi.imgur.com%2FZ3HkQqe.png&integration-ids=oac_jUduyjQgOyzev1fjrW83NYOv&external-id=nextjs-user-management)
+
+<Admonition type="note">
+
+File, Folder, and Bucket names **must follow** [AWS object key naming guidelines](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) and avoid use of any other characters.
+
+</Admonition>
+
+## Create a bucket
+
+You can create a bucket using the Supabase Dashboard.
+Since the storage is interoperable with your Postgres database, you can also use SQL or our
+client libraries. Here we create a bucket called "avatars":
+
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
+
+1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
+2. Click **New Bucket** and enter a name for the bucket.
+3. Click **Create Bucket**.
+
+</TabPanel>
+<TabPanel id="sql" label="SQL">
+
+```sql
+-- Use Postgres to create a bucket.
+
+insert into storage.buckets (id, name)
+values ('avatars', 'avatars');
+```
+
+</TabPanel>
+<TabPanel id="javascript" label="JavaScript">
+
+```js
+// Use the JS library to create a bucket.
+
+const { data, error } = await supabase.storage.createBucket('avatars')
+```
+
+[Reference.](/docs/reference/javascript/storage-createbucket)
+
+</TabPanel>
+<TabPanel id="dart" label="Dart">
+
+```dart
+void main() async {
+ final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
+
+ final storageResponse = await supabase
+ .storage
+ .createBucket('avatars');
+}
+```
+
+[Reference.](https://pub.dev/documentation/storage_client/latest/storage_client/SupabaseStorageClient/createBucket.html)
+
+</TabPanel>
+</Tabs>
+
+## Upload a file
+
+You can upload a file from the Dashboard, or within a browser using our JS libraries.
+
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
+
+1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
+2. Select the bucket you want to upload the file to.
+3. Click **Upload File**.
+4. Select the file you want to upload.
+
+</TabPanel>
+<TabPanel id="javascript" label="JavaScript">
+
+```js
+const avatarFile = event.target.files[0]
+const { data, error } = await supabase.storage
+ .from('avatars')
+ .upload('public/avatar1.png', avatarFile)
+```
+
+[Reference.](/docs/reference/javascript/storage-from-upload)
+
+</TabPanel>
+<TabPanel id="dart" label="Dart">
+
+```dart
+void main() async {
+ final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
+
+ // Create file `example.txt` and upload it in `public` bucket
+ final file = File('example.txt');
+ file.writeAsStringSync('File content');
+ final storageResponse = await supabase
+ .storage
+ .from('public')
+ .upload('example.txt', file);
+}
+```
+
+[Reference.](https://pub.dev/documentation/storage_client/latest/storage_client/SupabaseStorageClient/createBucket.html)
+
+</TabPanel>
+</Tabs>
+
+## Download a file
+
+You can download a file from the Dashboard, or within a browser using our JS libraries.
+
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
+
+1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
+2. Select the bucket that contains the file.
+3. Select the file that you want to download.
+4. Click **Download**.
+
+</TabPanel>
+<TabPanel id="javascript" label="JavaScript">
+
+```js
+// Use the JS library to download a file.
+
+const { data, error } = await supabase.storage.from('avatars').download('public/avatar1.png')
+```
+
+[Reference.](/docs/reference/javascript/storage-from-download)
+
+</TabPanel>
+<TabPanel id="dart" label="Dart">
+
+```dart
+void main() async {
+ final supabase = SupabaseClient('supabaseUrl', 'supabaseKey');
+
+ final storageResponse = await supabase
+ .storage
+ .from('public')
+ .download('example.txt');
+}
+```
+
+[Reference.](/docs/reference/dart/storage-from-download)
+
+</TabPanel>
+</Tabs>
+
+## Add security rules
+
+To restrict access to your files you can use either the Dashboard or SQL.
+
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
+
+1. Go to the [Storage](https://app.supabase.com/project/_/storage/buckets) page in the Dashboard.
+2. Click **Policies** in the sidebar.
+3. Click **Add Policies** in the `OBJECTS` table to add policies for Files. You can also create policies for Buckets.
+4. Choose whether you want the policy to apply to downloads (SELECT), uploads (INSERT), updates (UPDATE), or deletes (DELETE).
+5. Give your policy a unique name.
+6. Write the policy using SQL.
+
+</TabPanel>
+<TabPanel id="sql" label="SQL">
+
+```sql
+-- Use SQL to create a policy.
+
+create policy "Public Access"
+ on storage.objects for select
+ using ( bucket_id = 'public' );
+```
+
+</TabPanel>
+</Tabs>
+
+## See also
+
+- [Supabase Storage on GitHub](https://github.com/supabase/storage-api)
+- [Swagger API documentation](https://supabase.github.io/storage-api)
+- Official [JavaScript](/docs/reference/javascript/storage-createbucket) and [Dart](/docs/reference/dart/storage-createbucket) documentation
+
+export const Page = ({ children }) => <Layout meta={meta} children={children} />
+
+export default Page