@voltx/db
v0.3.0
Published
VoltX database — Drizzle ORM + Neon Postgres + Pinecone + pgvector adapters
Downloads
278
Maintainers
Readme
Database layer for the VoltX framework. Provides a unified interface for relational databases (Drizzle ORM + Neon Postgres) and vector stores (Pinecone, pgvector, in-memory).
Installation
npm install @voltx/dbQuick Start
Relational Database (Drizzle + Neon)
import { createDB } from "@voltx/db";
const db = createDB({ url: process.env.DATABASE_URL });
// Use Drizzle ORM queries
const users = await db.select().from(usersTable);Vector Store
import { createVectorStore } from "@voltx/db";
// In-memory (development)
const store = createVectorStore();
// Pinecone (production)
const store = createVectorStore("pinecone", {
apiKey: process.env.PINECONE_API_KEY,
indexName: "my-index",
});
// pgvector (self-hosted)
const store = createVectorStore("pgvector", {
connectionString: process.env.DATABASE_URL,
});Vector Operations
// Store documents with embeddings
await store.upsert([
{ id: "doc-1", content: "Hello world", embedding: [0.1, 0.2, ...], metadata: {} },
]);
// Search by similarity
const results = await store.search(queryEmbedding, 5);
// → [{ document, score }, ...]
// Delete documents
await store.delete(["doc-1"]);Supported Backends
| Backend | Type | Use Case | |---------|------|----------| | Neon Postgres | Relational | Production database via Drizzle ORM | | Pinecone | Vector | Managed vector search at scale | | pgvector | Vector | Self-hosted vector search (same Postgres) | | In-memory | Vector | Development and testing |
Schema Helpers
Built-in Drizzle schema for common AI app tables:
import { conversationsTable, messagesTable, documentsTable } from "@voltx/db";Environment Variables
DATABASE_URL=postgresql://user:[email protected]/dbname?sslmode=require
PINECONE_API_KEY=pc-...
PINECONE_INDEX=voltx-embeddingsPart of VoltX
This package is part of the VoltX framework. See the monorepo for full documentation.
License
MIT — Made by the Promptly AI Team
