PrimusDB is a high-performance, hybrid database engine written in Rust that combines multiple storage paradigms (columnar, vector, document, and relational) into a unified system. Designed for modern applications requiring analytics, AI/ML integration, and flexible data management.
- Columnar Engine: High-performance analytical storage with LZ4 compression, bitmap indexing, and vectorized operations
- Vector Engine: Advanced similarity search with cosine similarity, Euclidean distance, and optimized indexing
- Document Engine: Flexible JSON document storage with dynamic indexing and complex queries
- Relational Engine: Full relational storage with ACID transactions, foreign keys, and complex joins
- Key-Value Engine: CouchDB-compatible API with _id/_rev versioning, Mango queries, bulk operations, and collection encryption
- Unified Query Language (UQL): Cross-engine SQL/MongoDB/Mango/UQL queries with query planner and executor
- CRUD Operations: Complete create, read, update, delete across all storage types with advanced filtering
- Transaction Support: Full transaction management with ACID compliance, rollback, and commit
- AI/ML Integration: Advanced predictive analytics, anomaly detection, pattern analysis, and forecasting
- Consensus Mechanism: Hyperledger-style consensus with corruption detection and integrity validation
- Distributed Sync: Enterprise-grade cluster synchronization with Raft-style consensus, vector clocks, and cross-node reconciliation
- Encryption: Enterprise-grade encryption for data at rest, in transit, in memory, and buffers
- Clustering: Production-ready distributed clustering with node discovery, load balancing, and automatic failover
- Compression: LZ4 and Zstd algorithms with adaptive compression and advanced indexing
- Advanced Analytics: Complex joins, aggregations, and analytical queries
- Extended Data Types: 13 SQL-standard types including
SmallInt,BigInt,Decimal,Varchar,Char,Timestamp,Time,Uuid,Enum,Serial,BigSerial,Money,Interval - Referential Integrity: Foreign keys with
CASCADE,SET NULL,SET DEFAULT,RESTRICT,NO ACTIONon delete/update - Sequences: Auto-increment with
NEXTVAL,CURRVAL,SETVAL, persistence, cycle, cache - Views: Virtual and materialized views with query caching and refresh
- Triggers: Before/After/InsteadOf triggers on Insert/Update/Delete with Raise/Execute operations
- DDL Operations:
ADD COLUMN,DROP COLUMN,MODIFY COLUMN,ADD/DROP CONSTRAINT,RENAME TABLE - DML RETURNING:
INSERT RETURNING,UPDATE RETURNING,DELETE RETURNINGclauses - Enhanced SELECT:
GROUP BY,HAVING,ORDER BY,DISTINCT, aggregation functions - Information Schema: System tables for tables, columns, and constraints metadata
- User Authentication: Secure login with Argon2 password hashing
- API Tokens: Cryptographically secure tokens with SHA-256 hashing
- RBAC: Role-based access control (admin, developer, analyst, readonly)
- Multi-tenancy: Segment-based data isolation
- Account Protection: Brute-force protection with account lockout
- Cluster Security: Hyperledger-style genesis keys for node authentication
- Data-at-Rest Encryption: AES-256-GCM for all binary data files
- Columnar, Vector, Relational: Always encrypted
- Documents: Optional encryption (JSON plaintext by default)
- REST API: Complete HTTP interface for all operations
- CLI Tool: Command-line interface for database management
- Language Drivers: Native drivers for Node.js, Python, Java, Ruby, and Rust
- All drivers support: Transactions, ReferentialActions, Sequences, Views, Triggers, AlterTable, ReturningClause, GroupByQuery, InformationSchema, TruncateCascade, ExtendedDataTypes
- Async operations: Rust ✓, Python ✓, Node ✓, Ruby ✓, Java ✗
- Connection pooling: Rust ✓, Node ✓, Java ✓, Python ✗, Ruby ✗
- Prepared statements: Python ✓, Java ✓, Rust ✗, Node ✗, Ruby ✗
- SSL support: Java ✓, others ✗
- Docker Support: Containerized deployment with Arch Linux base
git clone https://github.com/devahil/primusdb.git
cd primusdb
cargo build --releasedocker build -t primusdb .
docker run -p 8080:8080 primusdb./target/release/primusdb-server --host 0.0.0.0 --port 8080# 1. Login with default credentials (admin/admin123)
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "admin123"}'
# 2. Create API token (use token from login response)
curl -X POST http://localhost:8080/api/v1/auth/token/create \
-H "Content-Type: application/json" \
-d '{"authorization": "TOKEN", "name": "my-token", "scopes": [{"resource": "All", "actions": ["Read", "Write"]}]}'
# 3. Use token in requests
curl -X POST http://localhost:8080/api/v1/crud/columnar/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"name": "Jane", "age": 25}'Create a table:
./target/release/primusdb-cli crud create --storage-type columnar --table users --data '{"name": "John", "age": 30}'Query records:
./target/release/primusdb-cli crud read --storage-type columnar --table users --limit 10 --offset 0Query records:
./target/release/primusdb-cli crud read --storage-type columnar --table users --limit 10# Health check
curl http://localhost:8080/health
# Create record
curl -X POST http://localhost:8080/api/v1/crud/columnar/users \
-H "Content-Type: application/json" \
-d '{"name": "Jane", "age": 25}'
# Query records
curl http://localhost:8080/api/v1/crud/columnar/usersPrimusDB uses TOML configuration files. Default location: config.toml
[storage]
data_dir = "./data"
max_file_size = 1073741824
compression = "lz4"
cache_size = 536870912
[network]
bind_address = "127.0.0.1"
port = 8080
max_connections = 1000
[security]
encryption_enabled = true
key_rotation_interval = 86400
auth_required = false
[cluster]
enabled = false
node_id = "node1"
discovery_servers = []--server <URL>: Server URL for client mode (default: http://localhost:8080)--mode <MODE>: Run mode - embedded or client (default: embedded)
server --config <FILE> --bind <ADDR>: Start the database serverinit --data-dir <DIR>: Initialize database directorystatus: Show database status
crud create --storage-type <TYPE> --table <NAME> --data <JSON>: Create recordcrud read --storage-type <TYPE> --table <NAME> --conditions <JSON> --limit <N> --offset <N>: Read recordscrud update --storage-type <TYPE> --table <NAME> --conditions <JSON> --data <JSON>: Update recordscrud delete --storage-type <TYPE> --table <NAME> --conditions <JSON>: Delete records
table create --storage-type <TYPE> --table <NAME> --schema <JSON>: Create table/collectiontable drop --storage-type <TYPE> --table <NAME>: Drop (delete) table/collectiontable truncate --storage-type <TYPE> --table <NAME>: Truncate (empty) table/collectiontable info --storage-type <TYPE> --table <NAME>: Get table/collection metadata
advanced analyze --storage-type <TYPE> --table <NAME> --conditions <JSON>: Analyze data patternsadvanced predict --storage-type <TYPE> --table <NAME> --data <JSON>: AI predictionsadvanced vector-search --table <NAME> --query-vector <VECTOR>: Vector similarity searchadvanced cluster --storage-type <TYPE> --table <NAME>: Data clustering analysisadvanced table-info --storage-type <TYPE> --table <NAME>: Get detailed table information
backup --destination <DIR>: Create database backuprestore --source <DIR>: Restore from backup
GET /health- Basic health checkGET /status- System status informationGET /metrics- Prometheus metrics
POST /api/v1/crud/{storage_type}/{table}- Create recordGET /api/v1/crud/{storage_type}/{table}?limit={n}&offset={n}&conditions={json}- Read recordsPUT /api/v1/crud/{storage_type}/{table}- Update recordsDELETE /api/v1/crud/{storage_type}/{table}- Delete records
POST /api/v1/advanced/analyze/{storage_type}/{table}- Data analysisPOST /api/v1/advanced/predict/{storage_type}/{table}- AI predictionsPOST /api/v1/advanced/vector-search/{table}- Vector searchPOST /api/v1/advanced/cluster/{storage_type}/{table}- Data clusteringGET /api/v1/table/{storage_type}/{table}/info- Table information
POST /api/v1/transaction/begin- Begin transactionPOST /api/v1/transaction/{id}/commit- Commit transactionPOST /api/v1/transaction/{id}/rollback- Rollback transaction
POST /api/v1/query- Execute custom queries
GET /api/v1/cache/cluster/health- Cluster health check
GET /api/v1/kv- List all Key-Value databasesPOST /api/v1/kv- Create Key-Value databaseDELETE /api/v1/kv/{db}- Delete Key-Value databaseGET /api/v1/kv/{db}/{id}- Get document by IDPUT /api/v1/kv/{db}/{id}- Create/update documentDELETE /api/v1/kv/{db}/{id}- Delete document (with _rev)GET /api/v1/kv/{db}/_all_docs- List all documents with paginationPOST /api/v1/kv/{db}/_find- Mango query (selector-based)PUT /api/v1/kv/{db}/_index- Create indexPOST /api/v1/kv/{db}/_bulk_docs- Bulk document operationsPOST /api/v1/kv/{db}/_compact- Compact databasePOST /api/v1/kv/{db}/_encrypt- Encrypt collectionPOST /api/v1/kv/{db}/_decrypt- Decrypt collection
POST /api/v1/auth/login- User login (returns session info)POST /api/v1/auth/register- User registrationPOST /api/v1/auth/token/create- Create API tokenPOST /api/v1/auth/token/revoke/:token_id- Revoke API tokenGET /api/v1/auth/tokens- List user tokensGET /api/v1/auth/users- List users (admin only)GET /api/v1/auth/roles- List available rolesPOST /api/v1/auth/segment/create- Create data segment (admin only)
npm install primusdbconst { PrimusDB } = require('primusdb');
const db = new PrimusDB('localhost', 8080);
await db.connect();
// CRUD operations
await db.create('columnar', 'users', { name: 'Alice', age: 30 });
const users = await db.read('columnar', 'users', {}, 10, 0);pip install primusdbfrom primusdb import PrimusDB
db = PrimusDB('localhost', 8080)
db.connect()
# CRUD operations
db.create('columnar', 'users', {'name': 'Bob', 'age': 25})
users = db.read('columnar', 'users', {}, 10, 0)<dependency>
<groupId>com.primusdb</groupId>
<artifactId>primusdb-driver</artifactId>
<version>1.0.0</version>
</dependency>import com.primusdb.PrimusDB;
PrimusDB db = new PrimusDB("localhost", 8080);
db.connect();
// CRUD operations
db.create("columnar", "users", Map.of("name", "Charlie", "age", 35));
List<Map<String, Object>> users = db.read("columnar", "users", null, 10, 0);gem install primusdbrequire 'primusdb'
db = PrimusDB.new('localhost', 8080)
db.connect
# CRUD operations
db.create('columnar', 'users', { name: 'David', age: 40 })
users = db.read('columnar', 'users', {}, 10, 0)[dependencies]
primusdb = "1.0.0"use primusdb::PrimusDB;
let db = PrimusDB::new("localhost:8080").await?;
db.connect().await?;
// CRUD operations
db.create("columnar", "users", serde_json::json!({"name": "Eve", "age": 45})).await?;
let users = db.read("columnar", "users", None, Some(10), Some(0)).await?;Fully implemented columnar storage with LZ4 compression, bitmap indexing, and vectorized operations.
Use Cases:
- Data warehousing
- Business intelligence
- Time series analysis
- High-performance analytical workloads
Features:
- Efficient compression algorithms
- Advanced indexing for fast queries
- Optimized for read-heavy operations
JSON document storage with flexible querying.
Features:
- Schema-less storage
- JSON path queries
- Basic indexing
Full relational database with ACID transactions and complex relationships.
Features:
- Complete SQL-like table operations
- Foreign key constraints and referential integrity
- Complex joins (inner, left, right)
- ACID transactions with full rollback support
- Schema management and data validation
High-performance similarity search and vector operations.
Features:
- Multiple distance metrics (Euclidean, Cosine, Dot Product)
- Optimized indexing for fast similarity search
- Configurable vector dimensions
- Batch processing and real-time search
CouchDB-compatible document storage with MVCC versioning.
Use Cases:
- Session storage
- User profiles
- Caching layer
- Configuration management
- Real-time applications
Features:
- _id/_rev versioning (MVCC)
- Mango queries (selector-based)
- Bulk document operations
- Collection-level encryption
- Index creation and management
- Tombstone deletion for replication support
docker build -t primusdb:latest .# Basic server
docker run -p 8080:8080 primusdb:latest
# With persistent data
docker run -v primusdb_data:/var/lib/primusdb -p 8080:8080 primusdb:latest
# Cluster mode
docker run -e PRIMUSDB_CLUSTER_ENABLED=true -p 8080:8080 primusdb:latestversion: '3.8'
services:
primusdb:
image: primusdb:latest
ports:
- "8080:8080"
- "9090:9090"
volumes:
- primusdb_data:/var/lib/primusdb
environment:
- RUST_LOG=info
healthcheck:
test: ["CMD", "primusdb-health", "127.0.0.1", "8080"]
interval: 30s
timeout: 10s
retries: 3
volumes:
primusdb_data:PrimusDB Architecture
=====================
┌─────────────────────────────────────────────────────────┐
│ Application Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Language Drivers (Node.js, Python, Java, etc.) │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────┐
│ API Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ REST API, CLI, Query Interface │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────┐
│ Processing Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ AI/ML Engine, Consensus, Transactions │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────┐
│ Storage Layer │
│ ┌─────────┬─────────┬─────────┬─────────┐ │
│ │Columnar │ Vector │Document │Relational│ │
│ └─────────┴─────────┴─────────┴─────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Cache, Compression, Encryption │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────┐
│ Persistence Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Sled Database, File System, Clustering │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
- Columnar Queries: High-performance analytical queries with compression
- CRUD Operations: Fully implemented across all storage engines
- Memory Usage: Efficient memory management with configurable limits
- Concurrent Connections: Supports up to 1000 concurrent connections
- All storage engines are fully implemented with no placeholders
- AI/ML operations integrated with real predictive analytics
- Vector search with similarity algorithms implemented
- Data clustering analysis for pattern recognition
- Transaction support with ACID compliance
- Cryptographic signatures for security
- Backup and restore functionality
- CLI tools fully operational
- User Authentication: Secure login with Argon2 password hashing
- API Tokens: Cryptographically secure tokens with SHA-256 hashing
- RBAC: Role-based access control with predefined roles (admin, developer, analyst, readonly)
- Multi-tenancy: Segment-based data isolation
- Account Lockout: Protection against brute-force attacks
- Data at rest: AES-256-GCM encryption
- Data in transit: TLS support
- Key rotation: Configurable intervals
- Token encryption: AES-256-GCM
- Genesis key system for trust establishment
- Node identity certificates
- Mutual authentication between nodes
- Trust chain validation
- HTTP health endpoints
- System status reporting
- Cluster health monitoring
- Prometheus-compatible metrics
- Performance counters
- Cache statistics
git clone https://github.com/devahil/primusdb.git
cd primusdb
cargo buildcargo test- Follow Rust standard formatting (
cargo fmt) - Run clippy for linting (
cargo clippy) - Add tests for new features
- Architecture - Detailed system architecture and design decisions
- Build Guide - Complete compilation and build instructions
- Administration - System administration and deployment guide
- User Manual - End-user operations and examples
- API Reference - Complete REST API documentation
- Troubleshooting - Common issues and solutions
GNU General Public License v3.0 - see LICENSE file for details.
Copyright (C) 2026 devahil@gmail.com. All rights reserved.
PrimusDB is fully implemented with all planned features completed:
- ✅ All storage engines (columnar, vector, document, relational)
- ✅ AI/ML integration with predictions and clustering
- ✅ Consensus mechanism and transactions
- ✅ Encryption and security features
- ✅ Clustering and distributed operations
- ✅ CLI tools and API
- ✅ Backup/restore functionality
- ✅ No placeholders or TODOs remaining
- ✅ All tests passing
- devahil@gmail.com - Lead Developer - devahil@gmail.com
- PrimusDB Team - Contributors and Maintainers
Built with Rust, inspired by modern database architectures combining the best of multiple paradigms.
