Skip to main content

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 StackStackhouse
PostgreSQL + ORM/migration toolsUnified 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

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:

LayerProtection
NetworkCloudflare DDoS + WAF, TLS 1.3 only
InfrastructureVPC isolation, Kubernetes NetworkPolicies, mTLS
ApplicationSQL injection detection, XSS filtering, SSRF protection
AuthenticationArgon2id hashing, JWT with refresh tokens, MFA/TOTP
AuthorizationRow-Level Security (RLS) policies per table
DataAES-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 document

Vector 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 info

There 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 functions

This 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 stream

Scale Targets

Stackhouse is designed to scale from prototype to enterprise:

MetricSMB (100K Users)Enterprise (10M Users)
Concurrent users10,0001,000,000
Peak API RPS1,000100,000
WebSocket connections50,0005,000,000
DB queries/sec5,000500,000
Monthly cost (GCP)~$1,300~$85K–$120K
RegionsSingle3–5 active-active

Technology Stack

ComponentTechnology
RuntimeRust (Axum web framework)
Storage EnginePostgreSQL, accessed via sqlx — no separate custom storage engine
Vector DatabaseQdrant (external, via REST)
Function RuntimeBoa (embedded JS/TS engine)
AuthenticationArgon2id + JWT
ObservabilityPrometheus + 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/users


License

MIT License — see LICENSE for details.


Stackhouse — Schema-Later • AI-Native • Realtime