--- id: 'storage-creating-buckets' title: 'Creating buckets' description: 'Learn how to create Supabase Storage buckets.' sidebar_label: 'Buckets' tocVideo: ch2UGHMreB0 --- You can create a bucket using the Supabase Dashboard. Since storage is interoperable with your Postgres database, you can also use SQL or our client libraries. The following code examples create a bucket called `avatars`: ```js import { createClient } from '@supabase/supabase-js' const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_KEY!) // ---cut--- // Use the JS library to create a bucket. const { data, error } = await supabase.storage.createBucket('avatars', { public: true, // default: false }) ``` [Reference.](/docs/reference/javascript/file-buckets-createbucket) 1. Go to the [Storage](/dashboard/project/_/storage/buckets) page in the Dashboard. 2. Click **New bucket** and enter a name for the bucket. 3. Click **Create**. ```sql -- Use Postgres to create a bucket. insert into storage.buckets (id, name, public) values ('avatars', 'avatars', true); ``` <$Show if="sdk: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) <$Show if="sdk:swift"> ```swift try await supabase.storage.createBucket( "avatars", options: BucketOptions(public: true) ) ``` [Reference.](/docs/reference/swift/storage-createbucket) <$Show if="sdk:python"> ```python supabase.storage.create_bucket( 'avatars', options={"public": True} ) ``` [Reference.](/docs/reference/python/storage-createbucket) <$Show if="sdk:csharp"> ```c# var bucket = await supabase.Storage.CreateBucket("avatars", new BucketUpsertOptions { Public = true }); ``` [Reference.](/docs/reference/csharp/storage-createbucket) ## Restricting uploads When creating a bucket you can add additional configurations to restrict the type or size of files you want this bucket to contain. For example, to allow only images of up to 1 MB in the `avatars` bucket, set `allowedMimeTypes` and `fileSizeLimit`: ```js import { createClient } from '@supabase/supabase-js' const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_KEY!) // ---cut--- // Use the JS library to create a bucket. const { data, error } = await supabase.storage.createBucket('avatars', { public: true, allowedMimeTypes: ['image/*'], fileSizeLimit: '1MB', }) ``` Storage rejects an upload that doesn't meet the bucket's restrictions. For more information, see [Storage upload limits](/docs/guides/storage/uploads/file-limits). To change the restrictions of an existing bucket, call `updateBucket`. The JavaScript SDK requires `public`, so pass the bucket's current value to keep its visibility. `getBucket` returns that value. ```js import { createClient } from '@supabase/supabase-js' const supabase = createClient('your_project_url', 'your_supabase_api_key') // ---cut--- await supabase.storage.updateBucket('avatars', { public: true, allowedMimeTypes: ['image/*'], fileSizeLimit: '1MB', }) ```