Build Pinecone
KINDAreplaces $20/mosaves $240/yrback to the verdict
Semantic search over your own documents with pgvector in the Postgres you already run: chunked documents with embeddings, cosine search with an HNSW index, hybrid ranking with full-text so exact identifiers still win, a localhost search page, and backups that are just pg_dump.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Everything in this build runs on it: the server, the scripts, the tests.
Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗
Verify
node --version prints v22 or higher - installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - installfree
Why The whole store.
Get it Docker: docker run -d -e POSTGRES_PASSWORD=pw -p 5432:5432 pgvector/pgvector:pg16. Or install pgvector on an existing Postgres. open ↗
Verify
CREATE EXTENSION vector; succeeds - API keypay per use, or free locally
Why Phase 1 embeds chunks.
Get it OpenAI: platform.openai.com/api-keys. Local: install Ollama and ollama pull nomic-embed-text. open ↗
- have readyfree
Why Markdown, PDFs converted to text, or a folder of notes.
Get it A folder of files.
Data model
Create these before the first phase that stores anything. Changing a table later is the expensive kind of change.
- documents: id, source, title, url, updated_at - chunks: id, document_id, position, text, embedding vector(N), token_count Chunks, not documents, carry the vectors: a 40-page PDF as one vector matches nothing well.
Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
DATABASE_URLsecret | required | postgres://postgres:pw@localhost:5432/search | Your Postgres. |
EMBED_PROVIDER | required | openai | openai or ollama. |
OPENAI_API_KEYsecret | optional | sk-... | For the openai provider. |
EMBED_MODEL | required | text-embedding-3-small | Model name; dimension must match the column. |
DOCS_DIR | required | ./docs | Where the ingester reads. |
The build, in order
Store and embed
Chunks with vectors, idempotent on document hash, provider swappable.
documents (id, source, title, url, updated_at, hash), chunks (id, document_id, position, text, embedding vector(N), token_count). N matches EMBED_MODEL's dimension.
Files
schema.sqlterminalmkdir semantic && cd semantic && git init && npm init -y && npm pkg set type=module && npm install pg@8 mkdir -p docs && cp .env.example .env
done when · tick each as it passesSearch
Top-k by cosine with an HNSW index actually used.
- terminal
CREATE INDEX ON chunks USING hnsw (embedding vector_cosine_ops);
- terminal
EXPLAIN ANALYZE SELECT ... ORDER BY embedding <=> $1 LIMIT 10;
done when · tick each as it passesHybrid
A page
Localhost search with highlighted passages and source links.
done when · tick each as it passesOperate
Serve it to othersproduct builder
Auth, rate limits, and cost visibility.
done when · tick each as it passes
That is the whole plan for Pinecone. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- Billions of vectors and serverless scale; under a few million this is a column.
- serverless scaling to billions of vectors
- zero-ops managed indexes
- hybrid and sparse search features
- the SLA
- Re-ranking with a cross-encoder
- Per-user document permissions
Need the files? The project pack on the verdict page hands your agent the whole brief · more databases.