MCPcopy Index your code
hub / github.com/agnesoft/agdb

github.com/agnesoft/agdb @v0.13.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.13.1 ↗ · + Follow
8,227 symbols 30,027 edges 671 files 3,476 documented · 42%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<a href="https://agdb.agnesoft.com/"><img width="300" src="https://agdb.agnesoft.com/images/logo.svg" alt="agdb logo"></a>

agdb

The graph database.

<a href="https://agdb.agnesoft.com/docs/references/queries"><img width="100" src="https://agdb.agnesoft.com/images/db.png" alt="db"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://agdb.agnesoft.com/api-docs/openapi"><img width="100" src="https://agdb.agnesoft.com/images/api.png" alt="api"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://agdb.agnesoft.com/docs/references/studio"><img width="100" src="https://agdb.agnesoft.com/images/studio.png" alt="studio"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://agdb.agnesoft.com/docs/references/server"><img width="100" src="https://agdb.agnesoft.com/images/server.png" alt="server"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://agdb.agnesoft.com/enterprise/cloud"><img width="100" src="https://agdb.agnesoft.com/images/cloud.png" alt="cloud"></a>







<a href="https://agdb.agnesoft.com/api-docs/rust"><img width="25" src="https://agdb.agnesoft.com/images/rust.png" alt="rust"></a>
<a href="https://agdb.agnesoft.com/api-docs/typescript"><img width="25" src="https://agdb.agnesoft.com/images/ts.png" alt="ts"></a>
<a href="https://agdb.agnesoft.com/api-docs/typescript"><img width="25" src="https://agdb.agnesoft.com/images/js.png" alt="js"></a>
<a href="https://agdb.agnesoft.com/api-docs/php"><img width="45" src="https://agdb.agnesoft.com/images/php.svg" alt="js"></a>
<img width="25" src="https://agdb.agnesoft.com/images/python.png" alt="python">
<img width="25" src="https://agdb.agnesoft.com/images/java.png" alt="java">
<img width="25" src="https://agdb.agnesoft.com/images/c.png" alt="c">
<img width="25" src="https://agdb.agnesoft.com/images/cpp.png" alt="cpp">
<img width="25" src="https://agdb.agnesoft.com/images/csharp.png" alt="csharp">







<a href="https://github.com/agnesoft/agdb/raw/v0.13.1/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="license"></a>
<a href="https://crates.io/crates/agdb"><img src="https://img.shields.io/crates/v/agdb" alt="Crates.io"></a>
<a href="https://docs.rs/agdb/latest/agdb/"><img src="https://docs.rs/agdb/badge.svg"></a>
<a href="https://deepwiki.com/agnesoft/agdb"><img src="https://img.shields.io/badge/DeepWiki-agnesoft%2Fagdb-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==" alt="DeepWiki"></a>
<a href="https://github.com/agnesoft/agdb/actions/workflows/release.yaml"><img src="https://github.com/agnesoft/agdb/actions/workflows/release.yaml/badge.svg" alt="release"></a>
<a href="https://github.com/agnesoft/agdb/actions/workflows/coverage.yaml"><img src="https://github.com/agnesoft/agdb/actions/workflows/coverage.yaml/badge.svg" alt="coverage"></a>
<a href="https://codecov.io/gh/agnesoft/agdb"><img src="https://codecov.io/gh/agnesoft/agdb/branch/main/graph/badge.svg?token=Z6YO8C3XGU" alt="codecov"></a>

agdb logo  Agnesoft Graph Database

<a href="https://agdb.agnesoft.com/docs/guides/quickstart">Quickstart Db</a> | <a href="https://agdb.agnesoft.com/api-docs/rust">Quickstart Client</a> | <a href="https://agdb.agnesoft.com/docs/references/queries">QUERIES</a> | <a href="#decision-tree">DECISION TREE</a>






<a href="https://agdb.agnesoft.com/blog">Why not SQL?</a>

The Agnesoft Graph Database (aka agdb) is application native database without compromises. It is persistent, optionally memory mapped graph database with native object 'no-text' queries. It can be used as a main persistent storage, data analytics platform as well as fast in-memory cache. Its typed schema-less data store allows for flexible and seamless data updates with no downtime or costly migrations. All queries are constructed via a builder pattern or directly as objects with no special language or text parsing.

agdb logo  Key Features

  • The agdb is application native database.
  • No query language, queries are written in the same language as the application.
  • Performance without limits, constant time lookups and traversals regardless of db size.
  • Simple to build, use & scale.

Technical features:

  • Data plotted on a graph
  • Typed key-value properties attached to graph elements (nodes & edges)
  • Persistent platform agnostic file based storage (transferable between platforms)
  • ACID compliant
  • Object queries with builder pattern (no text, no query language)
  • Memory mapped for fast querying
  • Server mode
  • Cluster mode
  • In-built TLS support
  • OpenAPI clients in any programming language
  • Cloud hosted SaaS database
  • Db itself has no dependencies

agdb logo  At a glance [Db]

cargo add agdb

Basic usage demonstrating creating a database, inserting graph elements with data and querying them back with select and search. The function using this code must handle agdb::DbError for operator ? to work (i.e. fn foo() -> Result<(), agdb::DbError>):

use agdb::{Db, DbId, QueryBuilder, DbType};

let mut db = Db::new("db_file.agdb")?;

db.exec_mut(QueryBuilder::insert().nodes().aliases("users").query())?;

#[derive(Debug, DbType)]
struct User { db_id: Option<DbId>, name: String, }
let users = vec![User { db_id: None, name: "Alice".into(), },
                 User { db_id: None, name: "Bob".into(), },
                 User { db_id: None, name: "John".into(), }];

let users_ids = db.exec_mut(QueryBuilder::insert().nodes().values(&users).query())?;

db.exec_mut(
    QueryBuilder::insert()
        .edges()
        .from("users")
        .to(&users_ids)
        .query(),
)?;

This code creates a database called user_db.agdb with a simple graph of 4 nodes. The first node is aliased users and 3 user nodes for Alice, Bob and John are then connected with edges to the users node. The arbitrary name property is attached to the user nodes. Rather than inserting values directly with keys (which is also possible) we use our own type and derive from agdb::DbType to allow it to be used with the database.

You can select the graph elements (both nodes & edges) with their ids to get them back with their associated data (key-value properties). Let's select our users and convert the result into the list (notice we select only values relevant to our User type with passing User::db_keys()):

let users: Vec<User> = db
    .exec(
        QueryBuilder::select()
            .elements::<User>()
            .ids(&users_ids)
            .query(),
    )?
    .try_into()?;

println!("{:?}", users);
// [User { db_id: Some(DbId(2)), username: "Alice" },
//  User { db_id: Some(DbId(3)), username: "Bob" },
//  User { db_id: Some(DbId(4)), username: "John" }]

You can also search through the graph to get back only certain elements based on conditions. For example:

let user: User = db
    .exec(
        QueryBuilder::select()
            .elements::<User>()
            .search()
            .from("users")
            .where_()
            .key("name")
            .value("Bob")
            .query(),
    )?
    .try_into()?;

println!("{:?}", user);
// User { db_id: Some(DbId(3)), username: "Bob" }

For database concepts and primitive data types see concepts. For comprehensive overview of all queries see the queries reference or continue with more in-depth efficient agdb.

agdb logo  Crate Features

agdb

Feature Default Description
derive yes Enables derive macro to enable custom user types to be directly used with the database.
opeanapi no Enables ToSchema macro on query structs so they can be exported to json OpeanAPI/Swagger schema.
serde no Enables serialiation/deserialization of queries and QueryResult using serde.
api no Enables annotations on all structs to facilitate API generation for different languages.

agdb_api

Feature Default Description
tls no Enables rust-tls for reqwest.
api no Enables annotations on all structs to facilitate API generation for different languages.

agdb_server

Feature Default Description
tls no Enables TLS support via rustls. On Windows requires MSVC and CMake to build.
studio no Embedd the agdb_studio into the server at /studio route.

agdb logo  Decision Tree

flowchart TD;
    A[Embedded or server?] --> Embedded
    A --> B[Client or hosting?]
    Embedded --> Studio[<a href='https://agdb.agnesoft.com/docs/references/studio'>Studio</a>]
    Embedded --> Queries[<a href='https://agdb.agnesoft.com/docs/references/queries'>Queries</a>]
    B --> Client
    B --> Hosting
    Client --> API[<a href='https://agdb.agnesoft.com/api-docs/openapi'>API</a>]
    Client --> Studio
    Client --> Queries
    Hosting --> Server[<a href='https://agdb.agnesoft.com/docs/references/server'>Server</a>]
    Hosting --> Cloud[<a href='https://agdb.agnesoft.com/enterprise/cloud'>Cloud</a>]

agdb logo  Roadmap

The following are planned features:

Feature Description
Agdb Studio Graphical interface to agdb
Python Client Convenience client using bindings genereated from OpenAPI.
Java Client Convenience client using bindings genereated from OpenAPI.
C# Client Convenience client using bindings genereated from OpenAPI.
C Client Convenience client using bindin

Extension points exported contracts — how you extend this code

Query (Interface)
Trait for immutable `agdb` database queries. This trait is unlikely to be implementable for user types. [18 implementers]
agdb/src/query.rs
Action (Interface)
(no doc) [23 implementers]
agdb_server/src/action.rs
Rewrite (Interface)
(no doc) [7 implementers]
agdb_api/src/transpiler/rewrite.rs
MyTrait (Interface)
(no doc) [3 implementers]
agdb/tests/api_def_reflection_test.rs
ModelInterface (Interface)
* Interface abstracting model access. * * @package Agnesoft\AgdbApi\Model * @author OpenAPI Generator team */
agdb_api/php/lib/Model/ModelInterface.php
Edge (Interface)
(no doc) [1 implementers]
agdb_studio/app/src/composables/graph/prototype/edge.ts
AdminStatus (Interface)
(no doc)
agdb_api/typescript/src/openapi.d.ts
ImportMetaEnv (Interface)
(no doc)
agdb_studio/libs/core/auth/env.d.ts

Core symbols most depended-on inside this repo

query
called by 774
agdb/src/db/db_error.rs
new
called by 699
agdb_server/src/config.rs
query
called by 556
agdb_api/php/src/QueryBuilder.php
user_login
called by 443
agdb_api/src/client.rs
sanitizeForSerialization
called by 318
agdb_api/php/lib/ObjectSerializer.php
admin_user_add
called by 301
agdb_api/src/client.rs
insert
called by 291
agdb/src/storage/write_ahead_log.rs
push
called by 285
agdb/src/collections/vec.rs

Shape

Method 4,879
Function 2,572
Class 629
Interface 99
Enum 48

Languages

Rust46%
PHP44%
TypeScript10%

Modules by API surface

agdb_api/typescript/src/query_builder.ts313 symbols
agdb_api/php/lib/Api/AgdbApi.php283 symbols
agdb_api/php/src/QueryBuilder.php252 symbols
agdb/tests/api_def_reflection_test.rs169 symbols
agdb_api/php/tests/QueryTest.php131 symbols
agdb/src/graph.rs116 symbols
agdb/src/type_def/expression_def.rs115 symbols
agdb_api/typescript/src/openapi.d.ts106 symbols
agdb/src/storage/file_storage.rs99 symbols
agdb_server/src/raft.rs73 symbols
agdb_api/src/client.rs73 symbols
agdb/src/db.rs72 symbols

For agents

$ claude mcp add agdb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact