AxioDB: A NoSQL DBMS

AxioDB is a blazing-fast, lightweight, and scalable open-source Database Management System (DBMS) tailored for modern applications. It supports .axiodb
file-based data storage, offers intuitive APIs, and ensures secure data management. AxioDB is the ultimate solution for developers seeking efficient, flexible, and production-ready database solutions.
๐ Official Documentation: Access the full power of AxioDB with detailed guides, examples, and API references.
๐ Table of Contents
๐ Current Featured Features
- Advanced Schema Validation: Define robust schemas to ensure data consistency and integrity, with the flexibility to disable validation when needed.
- Chainable Query Methods: Leverage powerful methods like
.query()
, .Sort()
, .Limit()
, and .Skip()
for seamless data filtering.
- Optimized Node.js Streams: Handle massive datasets effortlessly with high-performance read/write operations.
- Encryption-First Design: Protect sensitive data with optional AES-256 encryption for collections.
- Aggregation Pipelines: Perform advanced data operations like
$match
, $sort
, $group
, and more with MongoDB-like syntax.
- InMemoryCache Mechanism: Accelerate query execution by caching frequently accessed data, reducing query response time significantly.
- Plug-and-Play Setup: No additional database server requiredโinstall and start building instantly.
- Tree-like Structure: Store data in a tree-like structure for efficient data retrieval and management.
- Auto Indexing on documentId: Automatically create index on documentId for faster queries.
โ ๏ธ Current Limitations
While AxioDB offers many powerful features, there are some limitations to consider:
-
No Built-in Relation Tools: Unlike ODMs such as Mongoose, AxioDB doesn't provide built-in tools for managing document relations. While MongoDB-like NoSQL databases naturally don't enforce relations at the database level, AxioDB currently requires manual handling of references between collections.
-
Not Optimized for Heavy Workloads: The database may not perform optimally with rapid data input/output scenarios or extremely large datasets (10M+ documents).
-
Single-Thread Operations: Operations are performed on the main thread which can impact application performance during complex queries.
-
Limited Query Complexity: Some advanced query patterns found in mature databases are not yet implemented.
-
No Built-in Replication: Currently lacks distributed data replication capabilities for high availability setups.
We're actively working to address these limitations in future releases.
๐ฎ Future Plans
We're committed to continuously enhancing AxioDB with cutting-edge features:
- Inbuilt Web-Based GUI Dashboard: Provide a user-friendly, web-based interface similar to PhpMyAdmin for managing databases, collections, and data visually.
- Data Export and Import Mechanisms: Enable seamless export and import of data in various formats like JSON, CSV, and more.
- Docker Image with ODM Integration: Build a Docker image for this npm package-based DBMS, allowing integration with other programming languages via Object Document Mapping (ODM). Once completed, simply run the Docker image and connect with the ODM.
- Advanced Indexing: Implement multi-level indexing for lightning-fast queries.
- Replication and Sharding: Introduce support for distributed data replication and sharding for high availability and scalability.
- Improved Query Optimization: Enhance query performance with advanced optimization techniques.
- Data Backup and Restore: Implement robust backup and restore mechanisms for data safety.
- Comprehensive Documentation: Expand tutorials, examples, and API references for developers.
๐ณ AxioDB Docker - Under Development
We're excited to announce that work is in progress on AxioDB-Docker Image to extend the power of AxioDB to non-JavaScript languages!
What to Expect:
- Multi-Protocol Support: Connect via TCP, HTTP, gRPC, or WebSocket ports
- Web-Based GUI Management Dashboard: Easily manage your databases visually
- Multi-User System with Authentication: Secure access controls for your data
- Language-Agnostic Integration: Use AxioDB with Python, Java, Go, and more
- Containerized Deployment: Simple setup in any environment that supports Docker
Early Access:
While this feature is still under development, you can try out early versions:
docker pull theankansaha/axiodb:latest
docker pull ghcr.io/ankansaha/axiodb:latest
Stay tuned for more updates on this exciting expansion of AxioDB's capabilities!
๐ฆ Installation
Install AxioDB via npm:
npm install axiodb@latest --save
๐ ๏ธ Usage
CommonJS Example
const { AxioDB, SchemaTypes } = require("axiodb");
const main = async () => {
const db = new AxioDB();
const db1 = await db.createDB("testDB");
const db2 = await db.createDB("testDB2", false);
const schema = {
name: SchemaTypes.string().required(),
age: SchemaTypes.number().required().min(1).max(100),
email: SchemaTypes.string().required().email(),
};
const collection = await db1.createCollection("testCollection", schema);
const collection2 = await db1.createCollection(
"testCollection2",
schema,
true,
);
const collection3 = await db1.createCollection(
"testCollection3",
schema,
"myKey",
);
const saveStatus = await collection.insert({
name: "Ankan",
age: 21,
email: "ankan@example.com",
});
console.log(saveStatus);
const totalDocuments = await collection
.query({})
.Limit(1)
.Skip(0)
.Sort({ name: 1 })
.setCount(true)
.setProject({ name: 1, age: 1 })
.exec();
console.log(totalDocuments);
const FastDocument = await collection
.query({ documentId: "S4ACDVS6SZ4S6VS" })
.exec();
console.log(FastDocument);
const ArrayFirstDocument = await collection
.query({ documentId: ["S4ACDVS6SZ4S6VS", "VESV61Z6VS16VSE6V1S"] })
.exec();
console.log(ArrayFirstDocument);
const updatedDocuments = await collection
.update({ name: { $regex: "Ankan" } })
.UpdateOne({ name: "Ankan Saha", age: 22 });
console.log(updatedDocuments);
const deletedDocuments = await collection
.delete({ name: { $regex: "Ankan" } })
.deleteOne();
console.log(deletedDocuments);
const response = await collection
.aggregate([
{ $match: { age: { $gt: 20 }, name: { $regex: "Ankan" } } },
{ $group: { _id: "$age", count: { $sum: 1 } } },
{ $sort: { count: -1 } },
{ $project: { _id: 0, age: "$_id", count: 1 } },
{ $limit: 10 },
{ $skip: 0 },
])
.exec();
console.log(response);
};
main();
ES6 Example
import { AxioDB, SchemaTypes } from "axiodb";
const main = async () => {
const db = new AxioDB();
const db1 = await db.createDB("testDB");
const db2 = await db.createDB("testDB2", false);
const schema = {
name: SchemaTypes.string().required(),
age: SchemaTypes.number().required().min(1).max(100),
email: SchemaTypes.string().required().email(),
};
const collection = await db1.createCollection("testCollection", schema);
const collection2 = await db1.createCollection(
"testCollection2",
schema,
true,
);
const collection3 = await db1.createCollection(
"testCollection3",
schema,
"myKey",
);
const saveStatus = await collection.insert({
name: "Ankan",
age: 21,
email: "ankan@example.com",
});
console.log(saveStatus);
const totalDocuments = await collection
.query({})
.Limit(1)
.Skip(0)
.Sort({ name: 1 })
.setCount(true)
.setProject({ name: 1, age: 1 })
.exec();
console.log(totalDocuments);
const FastDocument = await collection
.query({ documentId: "S4ACDVS6SZ4S6VS" })
.exec();
console.log(FastDocument);
const ArrayFirstDocument = await collection
.query({ documentId: ["S4ACDVS6SZ4S6VS", "VESV61Z6VS16VSE6V1S"] })
.exec();
console.log(ArrayFirstDocument);
const updatedDocuments = await collection
.update({ name: { $regex: "Ankan" } })
.UpdateOne({ name: "Ankan Saha", age: 22 });
console.log(updatedDocuments);
const deletedDocuments = await collection
.delete({ name: { $regex: "Ankan" } })
.deleteOne();
console.log(deletedDocuments);
const response = await collection
.aggregate([
{ $match: { age: { $gt: 20 }, name: { $regex: "Ankan" } } },
{ $group: { _id: "$age", count: { $sum: 1 } } },
{ $sort: { count: -1 } },
{ $project: { _id: 0, age: "$_id", count: 1 } },
{ $limit: 10 },
{ $skip: 0 },
])
.exec();
console.log(response);
};
main();
๐ Advanced Features
1. Creating Multiple Databases and Collections
const { AxioDB, SchemaTypes } = require("axiodb");
const db = new AxioDB();
const setup = async () => {
const schema = {
name: SchemaTypes.string().required().max(15),
age: SchemaTypes.number().required().min(18),
};
const DB1 = await db.createDB("DB1");
const collection1 = await DB1.createCollection(
"collection1",
schema,
true,
"secretKey",
);
for (let i = 0; i < 300; i++) {
await collection1.insert({ name: `User${i}`, age: i + 18 });
}
const results = await collection1
.query({})
.Sort({ age: -1 })
.Limit(10)
.exec();
console.log("Query Results:", results);
await DB1.deleteCollection("collection1");
};
setup();
2. Aggregation Pipelines
Perform advanced operations like filtering, sorting, grouping, and projecting data.
const aggregationResult = await collection1
.aggregate([
{ $match: { name: { $regex: "User" } } },
{ $project: { name: 1, age: 1 } },
{ $sort: { age: -1 } },
{ $limit: 10 },
])
.exec();
console.log("Aggregation Result:", aggregationResult);
3. Encryption
Enable encryption for sensitive data by providing a secret key during collection creation.
const encryptedCollection = await DB1.createCollection(
"secureCollection",
schema,
true,
"mySecretKey",
);
await encryptedCollection.insert({ name: "Encrypted User", age: 25 });
const encryptedResult = await encryptedCollection.query({ age: 25 }).exec();
console.log("Encrypted Query Result:", encryptedResult);
4. Update and Delete Operations
Update Documents
await collection1
.update({ age: 20 })
.UpdateOne({ name: "Updated User", gender: "Male" });
await collection1
.update({ name: { $regex: "User" } })
.UpdateMany({ isActive: true });
Delete Documents
await collection1.delete({ name: "User1" }).deleteOne();
await collection1.delete({ age: { $lt: 25 } }).deleteMany();
๐ API Reference
AxioDB
-
createDB(dbName: string, schemaValidation: boolean = true): Promise<Database>
Creates a new database. The optional schemaValidation
parameter (default: true) determines whether schema validation will be enforced for collections in this database.
-
deleteDatabase(dbName: string): Promise<SuccessInterface | ErrorInterface>
Deletes a database.
Database
-
createCollection(name: string, schema: object, crypto?: boolean, key?: string): Promise<Collection>
Creates a collection with an optional schema and encryption.
-
deleteCollection(name: string): Promise<SuccessInterface | ErrorInterface>
Deletes a collection.
-
getCollectionInfo(): Promise<SuccessInterface>
Retrieves information about all collections.
Collection
-
insert(data: object): Promise<SuccessInterface | ErrorInterface>
Inserts a document into the collection.
-
query(query: object): Reader
Queries documents in the collection.
-
aggregate(pipeline: object[]): Aggregation
Performs aggregation operations.
Reader
-
Limit(limit: number): Reader
Sets a limit on the number of documents.
-
Skip(skip: number): Reader
Skips a number of documents.
-
Sort(sort: object): Reader
Sorts the query results.
-
exec(): Promise<SuccessInterface | ErrorInterface>
Executes the query.
๐ Security
AxioDB prioritizes data security with features like:
- Optional encryption for collections.
- Secure
.axiodb
file-based storage.
- InMemoryCache for faster and more secure query handling.
For vulnerabilities, please refer to the SECURITY.md file.
๐ค Contributing
We welcome contributions from the community! Whether it's code improvements, documentation updates, bug reports, or feature suggestions, your input helps make AxioDB better. Please read the CONTRIBUTING.md file for guidelines on how to get started.
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
๐ Acknowledgments
Special thanks to all contributors and supporters of AxioDB. Your feedback and contributions make this project better!