Skip to content

incredlabs/ormdb

ORMDB

License: MIT Build Status Rust Documentation

The database that speaks ORM natively. No more N+1 queries. No more impedance mismatch. Just declare your model graph and let the database do the rest.


Why ORMDB?

Traditional databases force ORMs to translate object graphs into SQL, leading to:

  • N+1 query problems that kill performance
  • Impedance mismatch between objects and tables
  • Risky migrations that require downtime
  • Cache invalidation headaches with no built-in solution

ORMDB flips this around. The database understands your entities, relations, and constraints natively.

// Fetch a user with their posts and comments in ONE round-trip
const user = await db.fetch({
  entity: "User",
  where: { id: userId },
  include: {
    posts: {
      include: { comments: true }
    }
  }
});

Features

  • Graph Fetches - Fetch entire object graphs in a single query
  • Native Relations - First-class support for one-to-one, one-to-many, and many-to-many
  • ACID Transactions - Full relational guarantees with constraints and joins
  • Safe Migrations - Online schema changes with automatic safety grading
  • Change Streams - Built-in CDC for cache invalidation and real-time updates
  • ORM Adapters - Drop-in support for Prisma, Drizzle, TypeORM, SQLAlchemy, and more
  • Vector Search - HNSW-indexed k-nearest neighbor search for embeddings
  • Geo Search - R-tree indexed geographic queries (radius, bounding box, polygon)
  • Full-Text Search - BM25 ranked text search with phrase and boolean support

Quick Start

Installation

# Install the server
cargo install ormdb-server

# Or build from source
git clone https://github.com/incredlabs/ormdb.git
cd ormdb
cargo build --release

Start the Server

ormdb-server --data-dir ./data --port 5432

Connect with Your Favorite ORM

TypeScript (Prisma adapter)

npm install @ormdb/client
import { OrmdbClient } from '@ormdb/client';
import { PrismaAdapter } from '@ormdb/client/prisma';

const client = new OrmdbClient({ url: 'ormdb://localhost:5432' });
const prisma = new PrismaAdapter(client);

Python (SQLAlchemy adapter)

pip install ormdb[sqlalchemy]
from sqlalchemy import create_engine
engine = create_engine("ormdb://localhost:5432/mydb")

Documentation

Guide Description
Getting Started Installation and first steps
Core Concepts Graph queries, MVCC, storage architecture
Tutorials Schema design, querying, mutations
ORM Adapters Prisma, Drizzle, TypeORM, SQLAlchemy, Django
API Reference Query API, mutations, configuration

Architecture Docs

Project Structure

ormdb/
├── crates/
│   ├── ormdb-core/     # Storage engine, query executor, catalog
│   ├── ormdb-server/   # Standalone database server
│   ├── ormdb-proto/    # Wire protocol (rkyv zero-copy)
│   ├── ormdb-lang/     # Query language parser
│   ├── ormdb-client/   # Rust client library
│   ├── ormdb-cli/      # Command-line interface
│   └── ormdb-gateway/  # HTTP/REST gateway
├── clients/
│   ├── typescript/     # @ormdb/client + ORM adapters
│   └── python/         # Python client + SQLAlchemy/Django
└── docs/               # Architecture documentation

Benchmarks

ORMDB is designed to outperform traditional ORM+database stacks on graph-shaped queries.

# Run benchmarks
cargo bench

# Compare against SQLite and PostgreSQL
./scripts/run-comparison.sh

See docs/benchmarks.md for methodology and results.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

# Development setup
git clone https://github.com/incredlabs/ormdb.git
cd ormdb
cargo build
cargo test

Roadmap

See docs/roadmap.md for implementation phases and milestones.

Current Status: Alpha (v0.1.0)

Community

License

This project is licensed under the MIT License.


Created by Dipankar Sarkar at Skelf Research

About

The database that speaks ORM natively.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors