MaazDB is more than a database engine. Build applications faster with our native, high-performance client libraries that handle encryption, binary protocols, and connection pooling automatically.
The official pure-Python client library for MaazDB. It provides a simple, idiomatic Pythonic API while handling complex tasks like automatic TLS 1.3 handshakes and binary protocol serialization under the hood.
pip install maazdb-py
from maazdb import MaazDB
# 1. Initialize the client
db = MaazDB()
try:
# 2. Connect securely
db.connect(
host="127.0.0.1",
port=8888,
user="admin",
password="admin"
)
print("✓ Connected to MaazDB")
# 3. Execute SQL
db.query("CREATE DATABASE analytics;")
db.query("USE analytics;")
db.query("CREATE TABLE logs (id SERIAL PRIMARY KEY, message TEXT);")
# 4. Insert and Fetch
db.query("INSERT INTO logs (message) VALUES ('System started');")
results = db.query("SELECT * FROM logs;")
print(f"Results:\n{results}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# 5. Always close the connection
db.close()
Use the Context Manager (with MaazDB() as db:) in your production code. It guarantees that your TLS socket is safely closed and resources are freed, even if an exception occurs during execution.
A high-performance, asynchronous Node.js client library. It leverages native Promises and Node.js Buffers to implement the custom MaazDB binary protocol securely over TLS 1.3. Perfect for real-time web applications and microservices.
npm install maazdb-js
# or using yarn
yarn add maazdb-js
const MaazDB = require('maazdb-js');
async function main() {
// 1. Initialize the client
const db = new MaazDB();
try {
// 2. Connect securely (TLS is handled automatically)
await db.connect(
"127.0.0.1",
8888,
"admin",
"admin"
);
console.log("✓ Connected to MaazDB");
// 3. Run SQL commands
await db.query("CREATE DATABASE web_app;");
await db.query("USE web_app;");
// 4. Insert Data
await db.query("CREATE TABLE users (id SERIAL PRIMARY KEY, username TEXT);");
await db.query("INSERT INTO users (username) VALUES ('maaz_dev');");
// 5. Fetch Results
const results = await db.query("SELECT * FROM users;");
console.log("Results:", results);
} catch (error) {
console.error("Database Error:", error.message);
} finally {
// 6. Close connection
db.close();
}
}
main();
For high-traffic web servers, initialize the MaazDB connection pool at the top level of your application rather than creating a new connection per HTTP request. This eliminates TLS handshake overhead.
The official high-speed Rust SDK built on Tokio. It implements the binary protocol over a secure TLS 1.3 socket, allowing Rust applications to communicate with your database safely with zero-cost abstractions.
[dependencies]
maazdb-rs = "0.1.0"
tokio = { version = "1.0", features = ["full"] }
use maazdb_rs::MaazDB;
use std::error::Error;
fn main() -> Result<(), Box> {
// 1. Establish a Secure Connection
let mut db = MaazDB::connect("127.0.0.1",
8888,
"admin",
"admin")?;
println!("✓ Connected to MaazDB via TLS 1.3");
// 2. Execute SQL Commands
db.query("CREATE DATABASE store_prod;")?;
db.query("USE store_prod;")?;
db.query("CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);")?;
// 3. Insert Data
db.query("INSERT INTO users (name) VALUES ('Maaz');")?;
// 4. Fetch Results
let results = db.query("SELECT * FROM users;")?;
println!("--- Query Results ---\n{}", results);
Ok(())
}
The Rust driver uses rustls by default to avoid OpenSSL dependencies. Ensure your system's root certificates are up to date, or provide a custom certificate path in the connection builder for self-signed deployments.