Products / AI Developer Tools

Live

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.

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

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

Limitations

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

AgentForge · PromptKit · EvalHarness · McpForge

Demo

RagPipe demo
Live Postgres + pgvector demo — ingest/query with mock embeddings (OPENAI_API_KEY missing); chunks.embedding stored.
Buy RagPipe — $29 All products