Storage

Creating Vector Buckets

Set up vector buckets and indexes using the dashboard or JavaScript SDK.


Vector buckets organize your vector data into logical units. Within each bucket, you create indexes that define how vectors are stored and searched based on their dimensions and distance metrics.

Creating a Vector bucket

You can create vector buckets using either the Supabase Dashboard or the JavaScript SDK.

Using the Supabase Dashboard

  1. Navigate to the Storage section in the Supabase Dashboard.
  2. Click Create Bucket.
  3. Enter a name for your bucket (e.g., embeddings or semantic-search).
  4. Select Vector Bucket as the bucket type.
  5. Click Create.

Your vector bucket is now ready. The next step is to create indexes within it.

Using the JavaScript SDK

1
2
3
4
5
6
7
8
import { } from '@supabase/supabase-js'const = ('https://your-project.supabase.co', 'your-service-key')// Create a vector bucketawait ...('embeddings').('✓ Vector bucket created: embeddings')

Creating indexes

Indexes organize vectors within a bucket with consistent dimensions and distance metrics. For comprehensive index management documentation, see Working with Vector Indexes.

Quick start: Creating an index via Dashboard

  1. Open your vector bucket.
  2. Click Create Index.
  3. Enter an index name (e.g., documents-openai).
  4. Set the dimension matching your embeddings (e.g., 1536 for OpenAI's text-embedding-3-small).
  5. Select the distance metric (cosine, euclidean, or l2).
  6. Click Create.

Quick start: Creating an index via JavaScript SDK

1
2
3
4
5
6
7
8
9
10
11
const bucket = supabase.storage.vectors.from('embeddings')// Create an indexawait bucket.createIndex({ indexName: 'documents-openai', dataType: 'float32', dimension: 1536, distanceMetric: 'cosine',})console.log('✓ Index created: documents-openai')

Key details

  • Dimension must match your embedding model (e.g., 1536 for OpenAI)
  • Distance metric (cosine, euclidean, or l2) is immutable after creation
  • Maximum indexes per bucket: 10
  • Maximum batch size: 500 vectors per operation

For detailed information on distance metrics, embedding dimensions, managing multiple indexes, and advanced index operations, see Working with Vector Indexes.

Next steps

After creating your bucket and indexes, you can: