
# 

Creating Buckets

* * *

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. Here we create a bucket called "avatars":

```
1import { createClient } from '@supabase/supabase-js'2const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_KEY!)34// ---cut---5// Use the JS library to create a bucket.67const { data, error } = await supabase.storage.createBucket('avatars', {8  public: true, // default: false9})
```

[Reference.](/docs/reference/javascript/storage-createbucket)

## Restricting uploads[#](#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, imagine you want to allow your users to upload only images to the `avatars` bucket and the size must not be greater than 1MB. You can achieve the following by providing `allowedMimeTypes` and `maxFileSize`:

```
1import { createClient } from '@supabase/supabase-js'2const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_KEY!)34// ---cut---5// Use the JS library to create a bucket.67const { data, error } = await supabase.storage.createBucket('avatars', {8  public: true,9  allowedMimeTypes: ['image/*'],10  fileSizeLimit: '1MB',11})
```

If an upload request doesn't meet the above restrictions it will be rejected. See [File Limits](/docs/guides/storage/uploads/file-limits) for more information.
