Neon PostgreSQL

Set up serverless PostgreSQL with pgvector.

Neon provides serverless PostgreSQL with built-in pgvector support for vector search.

Setup

1. Create a Neon Account

  1. Go to neon.tech
  2. Sign up for a free account
  3. Create a new project

2. Get Connection String

  1. In the Neon dashboard, go to Connection Details
  2. Copy the connection string
  3. It looks like: postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/cortex

3. Enable pgvector

Run this SQL in the Neon SQL editor:

CREATE EXTENSION IF NOT EXISTS vector;

4. Configure Cortex

Add to your .env:

DATABASE_URL=postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/cortex

5. Run Migrations

npm run db:generate
npm run db:migrate

Free Tier Limits

FeatureLimit
Storage512 MB
Compute24/7 available
Connections100 concurrent

Production Considerations

  • Use connection pooling for high-traffic deployments
  • Monitor storage usage (memories can grow quickly)
  • Consider read replicas for heavy query loads

Neon's pgvector extension supports up to 2000 dimensions per vector. Cortex uses OpenAI's text-embedding-3-small (1536 dimensions), which fits well within this limit.