Products / AI Developer Tools
RagPipe
Postgres pgvector RAG: ingest, embed (BYOK), top-k + answer
Postgres pgvector starter: chunk text, embed via OpenAI-compatible API (BYOK), store vectors, cosine top-k query, optional grounded answer.
Value
Problem. RAG demos sprawl across managed vector DBs. You already have Postgres and want ingest → embed → top-k → answer you can own.
How it helps. Postgres pgvector starter: chunk text, embed via OpenAI-compatible API (BYOK), store vectors, cosine top-k query, optional grounded answer.
Why buy. A readable RAG pipe on pgvector — not Pinecone lock-in, not a full agent framework.
- Overlapping chunker + OpenAI-compatible embeddings
- pgvector cosine top-k (<=>) with optional chat answer
- Ingest/query/documents HTTP API + sample markdown
How it works
flowchart LR
Client --> Ingest["POST /v1/ingest"]
Client --> Query["POST /v1/query"]
Ingest --> Chunk["chunkText"]
Chunk --> Emb["embeddings"]
Emb --> PG[("Postgres + pgvector")]
Query --> QEmb["embed question"]
QEmb --> Search["cosine top-k"]
Search --> PG
Search --> Answer["optional chat answer"]
Mermaid flowchart (render in GitHub / VS Code / mermaid.live).
Use case
POST /v1/ingest with a markdown doc, then POST /v1/query with a question — get top-k hits and a grounded answer.
What you get
- Express routes: ingest, query, documents, health
- docker-compose with pgvector/pg16 (host 5437)
- samples/*.md + demo-curl.sh
- 17 Vitest tests (chunking, ranking, config, vector literal)
- MIT license
Project structure
ragpipe/
src/
chunking/ embeddings/ ranking/
services/ ingest, query, vectorStore
routes/ ingest, query, documents, health
prisma/ samples/ tests/ docker-compose.yml
Quick start
docker compose up -d
cp .env.example .env # OPENAI_API_KEY + dims
npm install && npm run prisma:generate && npm run prisma:migrate
npm run dev
./scripts/demo-curl.sh
Example
From src/chunking/chunkText.ts
// Ingest: title+content → chunkText(size, overlap) → embeddings → chunks.embedding
// Query: embed question → ORDER BY embedding <=> query → topK → optional answer
Tested
17 Vitest tests — chunk overlap rules, cosine ranking helpers, config validation, vector SQL literal formatting. Embeddings mocked (no network).
npm test
2026-09-20 — 17 passed; npm run build OK
Design decisions
- pgvector over external vector SaaS for ownership
- Answer prompt grounded only on retrieved context
- Mock embeddings in tests so CI stays offline
Limitations
- Not a managed vector DB or hybrid search / reranker suite
- Not an agent framework (see AgentForge)
- Live ingest/query need OPENAI_API_KEY; tests use mocks
- Changing embedding dims requires migration + DB recreate in dev
Who it’s for
Builders who want a forkable RAG API on Postgres + pgvector.
Not for: Teams needing hosted vector search with SLAs out of the box.
What you own
Full MIT-licensed TypeScript source via Gumroad ZIP. Fork it, ship it commercially, keep the license notice. You are responsible for secrets, hardening, and production ops.
Related
Demo