We have great news for the GuardianDB ecosystem! Thanks to a contribution from our GitHub community, the project has just gained the implementation of an ODM (Object Document Mapper) layer.
What is the ODM in GuardianDB?
For those already familiar with tools like Mongoose, the concept will feel very similar. The ODM is a new optional layer that runs on top of the current decentralized storage engine. It acts as an intelligent bridge between your application code and the database, allowing you to define and work with data using strongly typed objects and models, instead of handling information in a “raw” form.
What is it for in practice?
The goal of this feature is to make developers’ lives easier by providing high-level modeling tools without turning GuardianDB into a traditional relational database. When you enable the ODM, you gain access to:
- Declarative Schemas and Constraints: You can now define clear rules for your data. Fields can be marked as primary keys, unique value constraints can be applied, and indexes can be created to speed up queries.
- Simplified Operations (CRUD): Data manipulation becomes much more intuitive, with direct methods for insertion, querying, and updating, reducing overall code complexity.
- Expanded Ecosystem: In addition to powerful macros for structuring models directly in Rust, the update introduces a new TypeScript SDK, paving the way for much more developer-friendly integration with Web, Node.js, and Mobile applications.
- Local Atomic Validation: Before any data is persisted, the ODM validates types, required fields, and constraints. If anything falls outside the defined schema, the operation is blocked before it even touches the storage layer.
The Decentralized Essence Remains
It is important to highlight that the ODM is a modular feature. It does not change the decentralized replication model based on the Iroh concept that defines GuardianDB.
The database remains P2P with eventual consistency. The role of the ODM is to rigorously organize and validate data locally before it enters the network synchronization flow, laying the groundwork for future distributed coordination logic.
To check the full documentation, performance details, and code examples showing how to apply models in Rust and TypeScript, visit the official GuardianDB repository on GitHub.