Documentation
Stackhouse — Product Overview
AI-native, schema-later database with automatic evolution. Explore features, architecture, and API reference.
Stackhouse Product Overview
Security Note
The current hardening and readiness work is documented in the Security documentation. This project does not claim completed SOC 2 or ISO 27001 readiness on code alone.
What is Stackhouse?
Stackhouse is an open-source, AI-native database that combines the flexibility of NoSQL with the power of SQL, vector search, and serverless compute — all in one unified system. Built in Rust, Stackhouse serves as a production-ready alternative to Supabase for modern applications requiring real-time capabilities and AI integration.
The Problem We Solve
Traditional database architectures force developers to cobble together multiple services:
| Traditional Stack | Stackhouse |
|---|---|
| PostgreSQL + ORM/migration tools | Unified database, Schema-Later — no migrations needed (still PostgreSQL under the hood) |
| Pinecone/Qdrant (vector search) | Native Qdrant integration — one less service to wire up separately |
| AWS Lambda/Cloud Functions (compute) | JavaScript/Boa serverless functions |
| Firebase/Pusher (realtime) | Built-in WebSocket/SSE (currently single-process; multi-instance fan-out not yet implemented) |
Result: Stackhouse reduces infrastructure complexity from 5+ services to 1, cutting operational overhead and latency while improving developer velocity.
Core Capabilities
1. Schema-Later™ Data Store
Eliminate schema migrations and downtime. Stackhouse automatically evolves your schema as your data grows.
// Day 1: Simple document
await db.push('users', { name: 'Alice', age: 25 });
// Day 30: Add new fields — no migration needed
await db.push('users', {
name: 'Bob',
email: 'bob@example.com',
preferences: { theme: 'dark', notifications: true }
});Benefits:
- Zero downtime schema changes
- No migration scripts to write or maintain
- Handles nested JSON structures natively
- Development stays fast as your app grows
2. AI-Native Vector Search
Semantic search built into the core, powered by Qdrant's HNSW algorithm. No external vector database required.
// Store document with embedding
await db.vectors.insert('documents', {
id: 'doc1',
vector: [0.1, 0.2, 0.3, ...], // 384+ dimensional embedding
metadata: { title: 'Introduction to Stackhouse' }
});
// Semantic search
const results = await db.vectors.search('documents', {
query: embedding,
k: 10,
filter: { category: 'tutorials' }
});Use Cases:
- RAG (Retrieval-Augmented Generation) pipelines
- Semantic document search
- Recommendation engines
- Similarity matching
- Image search (with vision embeddings)
3. Realtime 2.0
Bidirectional live data subscriptions via WebSocket or Server-Sent Events.
const ws = new WebSocket('ws://api.stackhouse.io/v1/realtime');
ws.send(JSON.stringify({
type: 'subscribe',
table: 'users',
event: '*'
}));
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
console.log('Live update:', msg.type, msg.record ?? msg.old_record);
};Features:
- Sub-millisecond latency for live updates
- Multiple subscriptions per connection
- Automatic reconnection handling
- Scales to millions of concurrent connections
4. Serverless JavaScript Functions
Deploy custom business logic as JavaScript/TypeScript source and execute it via the embedded Boa engine.
# Deploy a JavaScript function
curl -X POST /v1/functions/deploy \
-H "Content-Type: application/json" \
-d '{
"name": "process",
"runtime": "javascript",
"source_code": "exports.handler = (input) => ({ doubled: input.value * 2 });"
}'
# Execute with data
curl -X POST /v1/functions/invoke/process \
-d '{"value": 21}'Benefits:
- Sandboxed execution with resource limits
- Fast cold-start times
- JavaScript/TypeScript via the embedded Boa engine
- A multi-language WASM runtime is a future roadmap item
5. PostgreSQL-Backed Storage
Stackhouse's data layer is PostgreSQL, managed through sqlx (stackhouse/src/platform/db.rs). There is no separate custom LSM storage engine in this codebase — durability, crash-safety, and WAL behavior come from Postgres itself. "Schema-Later" is implemented as dynamic DDL generation over standard Postgres tables driven by incoming JSON shape, not an alternate storage format.
6. Enterprise Security
Defense-in-depth security architecture:
| Layer | Protection |
|---|---|
| Network | Cloudflare DDoS + WAF, TLS 1.3 only |
| Infrastructure | VPC isolation, Kubernetes NetworkPolicies, mTLS |
| Application | SQL injection detection, XSS filtering, SSRF protection |
| Authentication | Argon2id hashing, JWT with refresh tokens, MFA/TOTP |
| Authorization | Row-Level Security (RLS) policies per table |
| Data | AES-256 encryption at rest, PII masking in logs |
API Overview
Data Operations
POST /v1/push/:collection # Insert document
GET /v1/query/:collection # Query with filters
POST /v1/update/:collection/:id # Update document
POST /v1/delete/:collection/:id # Delete documentVector Search (proxied to Qdrant)
POST /v1/vectors/:collection/upsert # Upsert vector(s)
POST /v1/vectors/:collection/search # Semantic search
GET /v1/vectors/:collection/info # Collection infoThere is no list-all-collections endpoint (no GET /v1/vectors).
Functions — implemented, NOT currently reachable
POST /v1/functions/deploy # Deploy function
POST /v1/functions/invoke/:name # Execute function
GET /v1/functions # List functionsThis router exists in compute/functions.rs but is never mounted in main.rs — none of these endpoints respond over HTTP in the current build.
Realtime
WS /v1/realtime # WebSocket connection
GET /v1/stream/:collection # SSE streamScale Targets
Stackhouse is designed to scale from prototype to enterprise:
| Metric | SMB (100K Users) | Enterprise (10M Users) |
|---|---|---|
| Concurrent users | 10,000 | 1,000,000 |
| Peak API RPS | 1,000 | 100,000 |
| WebSocket connections | 50,000 | 5,000,000 |
| DB queries/sec | 5,000 | 500,000 |
| Monthly cost (GCP) | ~$1,300 | ~$85K–$120K |
| Regions | Single | 3–5 active-active |
Technology Stack
| Component | Technology |
|---|---|
| Runtime | Rust (Axum web framework) |
| Storage Engine | PostgreSQL, accessed via sqlx — no separate custom storage engine |
| Vector Database | Qdrant (external, via REST) |
| Function Runtime | Boa (embedded JS/TS engine) |
| Authentication | Argon2id + JWT |
| Observability | Prometheus + OpenTelemetry (Cargo.toml deps confirmed; exporter targets like Grafana/Jaeger are deployment-side, not bundled) |
Use Cases
1. AI-Powered Applications
Build RAG pipelines, chatbots, and recommendation systems with native vector search.
2. Realtime Collaboration
Live document editing, collaborative whiteboards, multiplayer games.
3. Modern Web Apps
Rapid prototyping with automatic schema evolution that scales to production.
4. Content Management
Semantic search across documents, images, and multimedia content.
5. E-commerce
Personalized recommendations, visual search, real-time inventory.
Quick Start
# Clone and build
git clone https://github.com/ArjavDesa912/stackhouse.git
cd stackhouse-stack/stackhouse
# Requires a reachable Postgres and a JWT secret — there is no default
STACKHOUSE_URL=postgres://postgres:password@localhost:5432/stackhouse \
STACKHOUSE_JWT_SECRET=some-long-dev-secret \
cargo run --release -- serve
# Insert your first document
curl -X POST http://localhost:3000/v1/push/users \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "email": "alice@example.com"}'
# Query it
curl http://localhost:3000/v1/query/usersRelated Documentation
- System Design — Enterprise architecture for 100K–10M users
- API Reference — Complete REST API documentation
- Security — Security controls and hardening status
License
MIT License — see LICENSE for details.
Stackhouse — Schema-Later • AI-Native • Realtime