I Built a Universal Vector DB ORM in Rust (for Python & Node). Here's How.
Vendor lock-in is a trap. Here is how I used Rust and SIMD to build embex—an open-source, high-performance ORM that runs anywhere.If you are building RAG (Retrieval-Augmented Generation) applications today, you are likely stuck in "Database Purgatory." You start with Pinecone because it's easy. Then your bill explodes, so you look at Qdrant. But wait, you need to run locally for testing, so maybe Chroma? Or perhaps your enterprise client insists on PgVector.Every time you switch, you rewrite your data ingestion pipeline. You rewrite your search logic. You fight with different SDKs.I got tired of rewriting the same connection logic. I wanted an ORM for Vectors. I wanted the "Prisma" or "SQLAlchemy" experience, but for the AI stack.So, I built Embex. And thanks to the power of a shared Rust core and modern FFI (Foreign Function Interface) tooling, I built the whole thing including bindings for Python and Node.js. I used an AI coding agent with Google Antigravity to accelerate the development process.Here is the architecture, the benchmarks, and the code.
The "One Core" Architecture
The biggest mistake developers make when building multi-language libraries is rewriting logic. If you write the client in Python, then port it to Node.js, you have two codebases to maintain, two sets of bugs, and two performance profiles.I didn't have time for that.I built Embex under bridgerust, which is dedicated to this exact philosophy: build high-performance infrastructure once in Rust, and deploy it everywhere. I wrote the core logic once in Rust.The Core: Handles connection pooling, SIMD vector math, and API normalization in pure Rust.The Bindings: I used PyO3 for Python and Neon/NAPI for Node.js to create thin, zero-cost wrappers around the core.This means when you
pip install embex
or
npm install @bridgerust/embex
, you aren't just getting a script; you are getting a pre-compiled, binary-optimized engine.
The Development Sprint: How it Happened
Building a cross-language ORM usually takes months. How did I fast-track the entire process? I used an AI coding agent with Google Antigravity to help streamline the development workflow and accelerate implementation.
Strict Scope
I focused on the "Big 7": Qdrant, Pinecone, Chroma, LanceDB, PgVector, Weaviate, and Milvus. These cover the vast majority of use cases, and I could always add more later.
The Ecosystem
The Rust ecosystem has matured incredibly. Tools like PyO3 and NAPI-RS handle the heavy lifting of bridging languages. Instead of writing boilerplate C-bindings manually, these tools allowed me to expose Rust structs as Python classes or JS objects with simple macros. The bridgerust framework provides the infrastructure to make this process seamless.
The Trait System
Rust's Trait system is the MVP here. I defined a single
VectorDatabase
trait. Every database integration is just an implementation of that trait.
This abstraction means adding a new database is just implementing the trait—no changes to the core logic, no changes to the bindings.
Why Rust? (It's not just for the memes)
It's about SIMD (Single Instruction, Multiple Data).When you are doing cosine similarity or dot product calculations on large datasets before sending them to the DB (or for re-ranking), Python is too slow. Node.js is inconsistent.By dropping into Rust, embex accesses AVX2 and NEON intrinsics directly.
The Benchmarks (M1/M2/M3)
Dot Product: 4.0x Faster than scalar
L2 Distance: 3.8x Faster
Overhead: < 1% compared to native clients
We aren't just wrapping the APIs; we are accelerating the math.
The Killer Feature: Database Migrations
In the SQL world, we have migrations. In the Vector world, we usually have "run a script and hope it works."embex brings git-ops style migrations to vector databases.
# Generate a new migration file
embex generate migration create_users_collection
embex migrate up
This makes your RAG pipeline production-grade immediately. You can track schema changes in your repo, rollback if a deployment fails, and ensure your dev/prod environments are identical.
Show Me The Code
The beauty of embex is that your application code looks the same, regardless of the database you use.
Python
from embex import EmbexClient
# Want to switch to Pinecone? Just change this string.
client = EmbexClient("qdrant", "http://localhost:6333")
# This code NEVER changes
results = client.collection("knowledge_base").search(
vector=[0.1, 0.4, ...],
top_k=5
)
Switching databases is now a one-line change. Your business logic stays the same. Your tests stay the same. Your deployment pipeline stays the same.
The Architecture Deep Dive
Let me break down how this actually works under the hood. If you're interested in building similar cross-language tools, check out the bridgerust repository to see how the underlying architecture works.
Connection Pooling
Every vector database has different connection semantics. Some use HTTP, some use gRPC, some use WebSockets. Embex normalizes all of this into a unified connection pool interface.
in Python or Node.js, this optimized Rust code runs under the hood.
API Normalization
Each vector database has quirks. Pinecone uses different field names than Qdrant. Chroma has different error codes than Weaviate. Embex normalizes all of this into a consistent interface.
If you're building a SaaS product where different customers might prefer different vector databases, embex lets you support them all with the same codebase.
# Customer A uses Pinecone
client_a = EmbexClient("pinecone", api_key=key_a)
# Customer B uses Qdrant
client_b = EmbexClient("qdrant", url=url_b)
# Same code, different backends
2. Local Development → Production
Develop locally with Chroma, deploy to production with Pinecone. No code changes.
# Development
client = EmbexClient("chroma", "./local_db")
# Production (just change the connection string)
client = EmbexClient("pinecone", api_key=prod_key)
3. Database Migration
Need to migrate from one database to another? Embex makes it trivial.
The overhead is negligible, but the SIMD acceleration is massive when you're doing pre-processing or re-ranking.
Try it out (Beta)
I built this because I needed it for my own projects (and for Yoshimyra). It's open source, MIT licensed, and ready for you to break it.A quick note on status: embex is currently in public beta. It is stable enough for my production applications, but we are still actively optimizing and iterating. You are encouraged to break it and submit issues!If you are tired of vendor lock-in, give it a spin.
More Databases: Adding support for more vector databases based on community feedback
Advanced Features: Hybrid search, filtering, and more sophisticated query capabilities
Performance: Further SIMD optimizations and connection pooling improvements
Developer Experience: Better error messages, more comprehensive documentation, and IDE support
Conclusion
Let's stop fighting APIs and start building intelligence.Vendor lock-in doesn't have to be inevitable. With the right architecture—a shared Rust core, modern FFI tooling (powered by bridgerust), and a focus on developer experience—you can build tools that work everywhere.Embex proves that you don't have to choose between performance and portability. You can have both. And you can build it faster than you think.The future of RAG applications shouldn't be tied to a single database vendor. It should be about building great products, not fighting with SDKs.Try embex. Break it. Tell me what you think.Key Takeaways:
Vendor lock-in is a real problem in the RAG ecosystem
Building once in Rust and deploying everywhere is possible with modern FFI tooling
SIMD acceleration provides 4x performance improvements for vector math
Database migrations bring production-grade practices to vector databases
A unified API across multiple databases simplifies development and deployment
The Rust trait system makes adding new database backends trivial
Related Topics: Vector Databases, RAG Systems, Rust, FFI, SIMD, Database ORMs, AI Infrastructure
Enjoyed this blog?
Seriously, thank you for spending your time here. If you made it to the end, you’re the kind of person who cares about craft, not just quick fixes.If you’d like to support my work, pick one (no pressure). It genuinely helps me keep writing and improving these blogs.