Hey Dev.to community! 👋

I'm excited to share AnuDB, a project I've been working on that aims to solve document storage needs for C++ applications, particularly those running in embedded environments.

What is AnuDB?

AnuDB is a lightweight, serverless document database designed specifically for C++ applications. It offers efficient storage of JSON documents through MessagePack serialization, providing a serverless, schema-less solution for applications requiring flexible data management with robust query capabilities.

If you find this project useful, please consider giving it a star on GitHub!

Key Features

  • Embedded & Serverless: Run directly within your application with no separate server process
  • JSON Document Storage: Store and query complex JSON documents with rich query capabilities
  • RocksDB Backend: Built on RocksDB for high performance and durability
  • MQTT Interface: Connect and operate via MQTT protocol from various platforms
  • High Concurrency: Supports 32 concurrent worker threads for handling MQTT requests
  • Docker Support: Easy deployment with Docker

Ideal for AI and IoT Applications

AnuDB is particularly well-suited for AI and IoT domains:

  • Edge Computing: Store and process data directly on edge devices with limited resources
  • IoT Data Collection: Efficiently collect and query sensor data from distributed IoT networks
  • AI Model Results: Store inference results and model outputs in a structured, queryable format
  • Embedded Systems: Optimized for constrained environments common in IoT deployments
  • MQTT Integration: Seamlessly integrates with existing IoT MQTT infrastructure
  • Offline-First Applications: Support for disconnected operation in remote deployments

MQTT Interface - Connect from Anywhere

One of the features I'm most excited about is the MQTT interface, allowing you to interact with AnuDB from any platform that supports MQTT, without direct C++ integration.

Quick Start

Here's a simple example to get you started:

#include "Database.h"
#include 

int main() {
    anudb::Database db("./my_database");
    anudb::Status status = db.open();

    // Create a collection
    status = db.createCollection("users");
    anudb::Collection* users = db.getCollection("users");

    // Create a document
    nlohmann::json userData = {
        {"name", "Hash"},
        {"email", "[email protected]"},
        {"age", 33}
    };
    anudb::Document doc("user001", userData);

    // Insert the document
    status = users->createDocument(doc);

    anudb::Document doc1;
    status = users->readDocument("user001", doc1);
    std::cout << doc1.data().dump(4) << std::endl;

    db.close();
    return 0;
}

Full Documentation

This post only scratches the surface of what AnuDB can do. For complete documentation including:

  • Detailed API reference
  • Query and update operations
  • Index management
  • MQTT command reference
  • Docker deployment options
  • Building from source
  • Performance considerations
  • Embedded platform optimizations

Check out the full README on GitHub: https://github.com/hash-anu/AnuDB

Get Involved

If you're interested in AnuDB, I'd love your feedback and contributions:

Let me know in the comments what you think, or if you have any questions about using AnuDB in your projects!