Live Demo
A single-page semantic search app over Hacker News, showcasing Rivestack pgvector in action.Try the demo
Search 30 days of HN stories and comments with natural language.
Source code
Full source code — backend, frontend, and Kubernetes deployment.
What it does
Type a question, get semantically relevant Hacker News posts and comments — with real-time performance stats on every query.- ~4,000 stories and ~40,000 chunks indexed from the last 30 days of HN
- HNSW index for fast cosine similarity search
- Performance stats displayed on every query: vector query time, embedding time, chunks searched, index type
- Daily cron job keeps a rolling 30-day window of fresh data
Architecture
| Component | Stack |
|---|---|
| Database | Rivestack PostgreSQL + pgvector |
| Backend | Python, FastAPI, SQLAlchemy, asyncpg |
| Embeddings | OpenAI text-embedding-3-small (1536 dims) |
| Frontend | Vue 3, Vite, Tailwind CSS v4, shadcn-vue |
| Deployment | Kubernetes, Helm, GitHub Actions CI/CD |
Performance
Typical query performance on a shared Rivestack instance:| Metric | Time |
|---|---|
| Vector query (pgvector) | ~12ms |
| OpenAI embedding | ~150ms |
| Total API response | ~180ms |
These numbers are from a shared Rivestack instance. Dedicated instances deliver significantly faster performance.
Run it yourself
1. Create a Rivestack database
Sign up at app.rivestack.io and create a database. pgvector is enabled by default on the initialappdb database. For new databases, add it through the dashboard or Terraform.
2. Clone and configure
backend/.env with your Rivestack DATABASE_URL and an OPENAI_API_KEY.
3. Run with Docker Compose
- Backend: http://localhost:8000
- Frontend: http://localhost:8080