Skip to main content

Configuration

VectorDB is configured entirely through environment variables. All settings have sensible defaults for local development.

Core Settings

VariableDefaultDescription
API_KEYtest-keyDefault API key. Change in production.
PORT8000Server port
WORKERS4Gunicorn worker processes
DB_URLsqlite:///./vectors.dbDatabase connection string
VECTOR_DIM384Default dimensionality for legacy (non-collection) endpoints

Storage Backend

VariableDefaultDescription
STORAGE_BACKENDsqlitesqlite or postgres
DB_URLsqlite:///./vectors.dbFor SQLite: file path. For PostgreSQL: postgresql+asyncpg://user:pass@host/db

HNSW Index

VariableDefaultDescription
INDEX_PATHdata/index.binDirectory where HNSW index files are saved
MAX_ELEMENTS10000Maximum vectors per collection index
EF_CONSTRUCTION200HNSW build-time accuracy parameter. Higher = more accurate, slower builds
M16HNSW graph connectivity. Higher = more accurate, more memory
EF_QUERY50HNSW query-time accuracy parameter. Higher = more accurate, slower queries
note

MAX_ELEMENTS sets the initial index capacity. Once reached, the index cannot accept new vectors. Set it to the maximum number of vectors you expect per collection. Typical production values: 100000 to 10000000.

Rate Limiting

VariableDefaultDescription
RATE_LIMIT_PER_MINUTE100Requests per minute per API key

CORS

VariableDefaultDescription
CORS_ORIGINS["*"]Allowed origins. JSON array, e.g. ["https://app.example.com"]

Caching (Redis)

VariableDefaultDescription
REDIS_URL(empty)Redis connection string. Leave empty to disable caching. E.g. redis://localhost:6379
CACHE_TTL60Cache time-to-live in seconds

Validation Limits

VariableDefaultDescription
MAX_VECTOR_DIM65536Maximum allowed vector dimension
MAX_METADATA_SIZE10240Maximum metadata JSON size in bytes (10KB)
MAX_BATCH_SIZE1000Maximum items in a bulk upsert or batch delete

Logging & Observability

VariableDefaultDescription
LOG_FORMATconsoleconsole (human-readable) or json (structured, for log aggregators)
LOG_LEVELINFODEBUG, INFO, WARNING, ERROR
OTEL_ENABLEDfalseEnable OpenTelemetry tracing
OTEL_EXPORTER_OTLP_ENDPOINT(empty)OTLP endpoint for traces (e.g. Jaeger, Tempo)

Example: Production .env

API_KEY=sk-prod-your-secret-key-here
STORAGE_BACKEND=postgres
DB_URL=postgresql+asyncpg://vectordb:strongpassword@db:5432/vectordb
WORKERS=8
MAX_ELEMENTS=1000000
REDIS_URL=redis://redis:6379
CACHE_TTL=120
RATE_LIMIT_PER_MINUTE=1000
LOG_FORMAT=json
CORS_ORIGINS=["https://app.yourcompany.com"]

Example: Local Development .env

API_KEY=test-key
DB_URL=sqlite:///./vectors.db
WORKERS=1
LOG_FORMAT=console
LOG_LEVEL=DEBUG
RATE_LIMIT_PER_MINUTE=100000