A sample implementation of a managed AI search service using RAG pipelines with embeddings, reranking, and pgvector - powered by Heroku Managed Inference.
- Index any documentation - Crawl and index URLs automatically
- AI-powered chat - Ask questions, get answers with citations
- Multiple pipelines - Create separate knowledge bases for different docs
- Embeddable widget - Add to your site with a simple script tag
- Real-time streaming - See responses as they're generated
Connect to multiple data sources including URLs, with support for Notion, Google Drive, Salesforce, Slack, and more coming soon.
Watch your documents flow through the full RAG pipeline: Fetch, Parse, Chunk, Embed, and Store in pgvector.
Get an embeddable widget for your indexed documentation. Copy the iframe code or widget URL to add AI-powered search to any website.
Ask questions and get grounded answers with source citations. Toggle Cohere Rerank to improve retrieval precision.
| Primitive | Purpose |
|---|---|
| Cohere Embed | Vectorize documents and queries |
| Cohere Rerank 3.5 | Improve retrieval precision |
| Claude Sonnet | Generate answers from context |
| Postgres + pgvector | Vector storage and similarity search |
- Click the Deploy to Heroku button above
- Create the required AI model add-ons:
heroku addons:create heroku-inference:cohere-embed-multilingual
heroku addons:create heroku-inference:cohere-rerank-3-5
heroku addons:create heroku-inference:claude-3-5-sonnet- Set environment variables from the add-ons:
# Get the config vars from each addon and set them
heroku config:set EMBEDDING_URL=<from cohere-embed addon>
heroku config:set EMBEDDING_KEY=<from cohere-embed addon>
heroku config:set RERANKING_URL=<from cohere-rerank addon>
heroku config:set RERANKING_KEY=<from cohere-rerank addon>
heroku config:set INFERENCE_URL=<from claude addon>
heroku config:set INFERENCE_KEY=<from claude addon># Clone the repo
git clone https://github.com/dsouza-anush/heroku-rag-chatbot
cd heroku-rag-chatbot/frontend
# Install dependencies
npm install
# Set environment variables
cp .env.example .env.local
# Edit .env.local with your credentials
# Run development server
npm run dev┌─────────────────────────────────────────────────────────────────┐
│ MIA CHATBOT │
└─────────────────────────────────────────────────────────────────┘
INDEXING PIPELINE
─────────────────
URL → Crawl → Chunk → Cohere Embed → pgvector
QUERY PIPELINE
──────────────
Question → Embed → Vector Search → Rerank → Claude → Answer
POST /api/pipelines
{ "name": "My Docs", "description": "Documentation for my project" }POST /api/pipelines/:id/index
{ "url": "https://docs.example.com", "max_pages": 20 }POST /api/pipelines/:id/chat
{ "message": "How do I get started?" }GET /api/pipelines/:id/status| Variable | Description |
|---|---|
DATABASE_URL |
Postgres connection string (auto-set by addon) |
INFERENCE_URL |
Claude API endpoint |
INFERENCE_KEY |
Claude API key |
EMBEDDING_URL |
Cohere Embeddings endpoint |
EMBEDDING_KEY |
Cohere Embeddings API key |
RERANKING_URL |
Cohere Rerank endpoint |
RERANKING_KEY |
Cohere Rerank API key |
AUTH_SECRET |
NextAuth session secret |
- Frontend: Next.js 16, React 19, Tailwind CSS, shadcn/ui
- Database: PostgreSQL with pgvector extension
- AI: Heroku Managed Inference (Cohere, Claude)
MIT



