{"id":13469406,"url":"https://github.com/indradb/indradb","last_synced_at":"2025-05-13T00:30:20.390Z","repository":{"id":38417978,"uuid":"117597728","full_name":"indradb/indradb","owner":"indradb","description":"A graph database written in rust","archived":false,"fork":false,"pushed_at":"2025-01-18T18:14:32.000Z","size":2562,"stargazers_count":2263,"open_issues_count":14,"forks_count":118,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-10T12:28:38.840Z","etag":null,"topics":["database","graph","graph-database","graph-processing","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indradb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-15T21:33:54.000Z","updated_at":"2025-04-09T08:45:10.000Z","dependencies_parsed_at":"2024-01-06T07:49:38.938Z","dependency_job_id":"7866150c-cdec-4da5-a424-9e5b2d317815","html_url":"https://github.com/indradb/indradb","commit_stats":{"total_commits":852,"total_committers":21,"mean_commits":40.57142857142857,"dds":0.06338028169014087,"last_synced_commit":"29703a5f6a28f34c13a141e110196069a3611bfa"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indradb%2Findradb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indradb%2Findradb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indradb%2Findradb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indradb%2Findradb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indradb","download_url":"https://codeload.github.com/indradb/indradb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250494641,"owners_count":21440019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","graph","graph-database","graph-processing","rust"],"created_at":"2024-07-31T15:01:38.066Z","updated_at":"2025-04-23T18:44:34.098Z","avatar_url":"https://github.com/indradb.png","language":"Rust","readme":"\u003cp align=\"center\"\u003e\n \t\u003cimg src=\"https://indradb.github.io/logo.png\"\u003e\n\u003c/p\u003e\n\n# [IndraDB](https://indradb.github.io)\n\n[![Test](https://github.com/indradb/indradb/actions/workflows/test.yml/badge.svg)](https://github.com/indradb/indradb/actions/workflows/test.yml)\n[![crates.io](https://img.shields.io/crates/v/indradb-lib.svg)](https://crates.io/crates/indradb-lib)\n[![Released API docs](https://docs.rs/indradb-lib/badge.svg)](https://docs.rs/indradb-lib)\n\nA graph database written in rust.\n\nIndraDB consists of a server and an underlying library. Most users would use the server, which is available via releases as pre-compiled binaries. But if you're a rust developer that wants to embed a graph database directly in your application, you can use the [library](https://github.com/indradb/indradb/tree/master/lib).\n\nIndraDB's original design was heavily inspired by [TAO](https://www.cs.cmu.edu/~pavlo/courses/fall2013/static/papers/11730-atc13-bronson.pdf), facebook's graph datastore. In particular, IndraDB emphasizes simplicity of implementation and query semantics, and is similarly designed with the assumption that it may be representing a graph large enough that full graph processing is not possible. Over time, richer query semantics and other features have been added to IndraDB, so it can no longer be called TAO-like, although we try to stay true to some of those original goals.\n\nFor more details, see the [homepage](https://indradb.github.io). See also a [complete demo of IndraDB for browsing the wikipedia article link graph.](https://github.com/indradb/wikipedia-example)\n\n## Features\n\n* Directed and typed graphs.\n* JSON-based properties tied to vertices and edges.\n* Queries with multiple hops, and queries on indexed properties.\n* Cross-language support via gRPC, or direct embedding as a library.\n* Pluggable underlying datastores, with several built-in datastores. [Postgresql](https://github.com/indradb/postgres) and [sled](https://github.com/indradb/sled) are available separately.\n* Written in rust! High performance, no GC pauses, and a higher degree of safety.\n\n## Usage\n\nIndraDB offers a variety ways to work with it: as a server with cross-language support, as a rust library, and via CLI. What follows are a few examples of each use case.\n\n### Server\n\nThe server uses [gRPC](https://grpc.io/) to facilitate cross-language support. gRPC supports many languages; see the [official list](https://grpc.io/docs/languages/), though many more are unofficially supported as well. We have official bindings available for python and rust. These examples will require you to have a running server, e.g. to start an in-memory server, simply run `indradb-server`.\n\n#### Python\n\nPython bindings are available [here](https://github.com/indradb/python-client) and published to pypi as `indradb`. An example:\n\n```python\nimport indradb\nimport uuid\n\n# Connect to the server and make sure it's up\nclient = indradb.Client(\"localhost:27615\")\nclient.ping()\n\n# Create a couple of vertices\nout_v = indradb.Vertex(uuid.uuid4(), \"person\")\nin_v = indradb.Vertex(uuid.uuid4(), \"movie\")\nclient.create_vertex(out_v)\nclient.create_vertex(in_v)\n\n# Add an edge between the vertices\nedge = indradb.Edge(out_v.id, \"bar\", in_v.id)\nclient.create_edge(edge)\n\n# Query for the edge\nresults = list(client.get(indradb.SpecificEdgeQuery(edge)))\nprint(results)\n```\n\nFor further reference, see the [docs](https://indradb.github.io/python-client/indradb/) and [python bindings tests](https://github.com/indradb/python-client/tree/master/tests).\n\n#### Rust\n\nThe gRPC bindings library is available as [`indradb-proto`](https://crates.io/crates/indradb-proto). An example:\n\n```rust\nuse indradb;\nuse indradb_proto as proto;\n\n// Connect to the server and make sure it's up\nlet mut client = proto::Client::new(\"grpc://127.0.0.1:27615\".try_into()?).await?;\nclient.ping().await?;\n\n// Create a couple of vertices\nlet out_v = indradb::Vertex::new(indradb::Identifier::new(\"person\")?);\nlet in_v = indradb::Vertex::new(indradb::Identifier::new(\"movie\")?);\nclient.create_vertex(\u0026out_v).await?;\nclient.create_vertex(\u0026in_v).await?;\n\n// Add an edge between the vertices\nlet edge = indradb::Edge::new(out_v.id, indradb::Identifier::new(\"likes\")?, in_v.id);\nclient.create_edge(\u0026edge).await?;\n\n// Query for the edge\nlet output: Vec\u003cindradb::QueryOutputValue\u003e = client.get(indradb::SpecificEdgeQuery::single(edge.clone())).await?;\n// Convenience function to extract out the edges from the query results\nlet e = indradb::util::extract_edges(output).unwrap();\nassert_eq!(e.len(), 1);\nassert_eq!(edge, e[0]);\n```\n\nThe rust gRPC bindings library is built to closely mirror the rust library. But if you're using 100% rust, and don't need a server, you can skip all the gRPC rigmarole and just use the rust library directly. For further reference, see the [docs](https://docs.rs/indradb-proto/latest/indradb_proto/) and the [wikipedia indexing example](https://github.com/indradb/wikipedia-example), which heavily relies on `indradb-proto`.\n\n#### Other languages\n\nIf you're looking to contribute, adding bindings for your favorite language is a great way to start! The gRPC/protobuf definitions are [here](https://github.com/indradb/indradb/blob/master/proto/indradb.proto).\n\n### Rust library\n\nAdd IndraDB to your `Cargo.toml`:\n\n```toml\nindradb-lib = { version = \"*\", features = [\"rocksdb-datastore\"] }\n```\n\n(You might want to pin the version, or not include the RocksDB datastore and only support in-memory.)\n\nHere's a brief example:\n\n```rust\nuse indradb;\n\n// Create an in-memory datastore\nlet db: indradb::Database\u003cindradb::MemoryDatastore\u003e = indradb::MemoryDatastore::new_db();\n\n// Create a couple of vertices\nlet out_v = indradb::Vertex::new(indradb::Identifier::new(\"person\")?);\nlet in_v = indradb::Vertex::new(indradb::Identifier::new(\"movie\")?);\ndb.create_vertex(\u0026out_v)?;\ndb.create_vertex(\u0026in_v)?;\n\n// Add an edge between the vertices\nlet edge = indradb::Edge::new(out_v.id, indradb::Identifier::new(\"likes\")?, in_v.id);\ndb.create_edge(\u0026edge)?;\n\n// Query for the edge\nlet output: Vec\u003cindradb::QueryOutputValue\u003e = db.get(indradb::SpecificEdgeQuery::single(edge.clone()))?;\n// Convenience function to extract out the edges from the query results\nlet e = indradb::util::extract_edges(output).unwrap();\nassert_eq!(e.len(), 1);\nassert_eq!(edge, e[0]);\n```\n\nFor further reference, see the [docs](https://docs.rs/indradb-lib/latest/indradb/) and [library tests](https://github.com/indradb/indradb/tree/master/lib/src/tests).\n\n### CLI\n\nThe CLI interacts with a running server.\n\nFirst start the server: `indradb-server`.\n\nThen, e.g. count the number of vertices: `indradb-client grpc://127.0.0.1:27615 count vertex`.\n\n## Installation\n\n### Releases\n\nWe offer pre-compiled releases for linux and macOS.\n\n* [Download the latest release for your platform.](https://github.com/indradb/indradb/releases)\n* Add the binaries to your `PATH`.\n* Start the server: `indradb-server`\n\nThis should start the default datastore.\n\n### From source\n\nTo build and install from source:\n\n* Install [rust](https://www.rust-lang.org/en-US/install.html). IndraDB should work with any of the rust variants (stable, nightly, beta.)\n* Make sure you have gcc 5+ and the protobuf toolchain installed.\n* Clone the repo: `git clone git@github.com:indradb/indradb.git`.\n* Build/install it: `cargo install`.\n\n### Docker\n\nIf you want to run IndraDB in docker, follow the below instructions.\n\n#### Server \n\nBuild the image for the server:\n\n```bash\nDOCKER_BUILDKIT=1 docker build --target server -t indradb-server .\n```\n\nRun the server:\n\n```bash\ndocker run --network host --rm indradb-server -a 0.0.0.0:27615\n```\n\n#### Client\n\nBuild the image for the client:\n\n```bash\nDOCKER_BUILDKIT=1 docker build --target client -t indradb-client .\n```\n\nRun the client:\n\n```bash\ndocker run --network host --rm indradb-client grpc://localhost:27615 ping\n```\n\n## Datastores\n\nIndraDB offers several different datastores with trade-offs in durability, transaction capabilities, and performance.\n\n### Memory\n\nBy default, IndraDB starts a datastore that stores all values in-memory. This is the fastest implementation, but there's no support for graphs larger than what can fit in-memory, and data is only persisted to disk when explicitly requested.\n\nIf you want to use the standard datastore _without_ support for persistence, don't pass a subcommand; e.g.:\n\n```bash\nindradb-server [options]\n```\n\nIf you want to use the standard datastore but persist to disk:\n\n```bash\nindradb-server memory --persist-path=[/path/to/memory/image]\n```\n\nYou'll need to explicitly call `Sync()` when you want to save the graph.\n\n### RocksDB\n\nIf you want to use the rocksdb-backed datastore, use the `rocksdb` subcommand; e.g.:\n\n```bash\nindradb-server rocksdb [/path/to/rocksdb.rdb] [options]\n```\n\n### Postgres, Sled, etc.\n\nIt's possible to develop other datastores implementations in separate crates, since the IndraDB exposes the necessary traits to implement:\n\n* Postgres is available through [indradb-postgres.](https://github.com/indradb/postgres)\n* Sled is available through [indradb-sled.](https://github.com/indradb/sled)\n\n## Plugins\n\nThe IndraDB server includes support for plugins to extend functionality available to clients. Plugins are loaded via dynamically linked libraries.\n\nSee the [hello world plugin](https://github.com/indradb/indradb/tree/master/plugins/hello_world) and [naive vertex plugin](https://github.com/indradb/indradb/tree/master/plugins/naive_vertex_count) for demonstrations of how to author plugins.\n\nTo include plugins, see the `--plugins` argument for `indradb-server`, e.g. `indradb-server --plugins=plugins/*.so`. They are then callable via the gRPC `ExecutePlugin` function.\n\n## Testing\n\nFirst follow the [source building instructions above](https://github.com/indradb/indradb#from-source).\n\n### Unit tests\n\nUse `make test` to run the test suite. Note that this will run the full test suite across the entire workspace, including tests for all datastore implementations. You can filter which tests run via the `TEST_NAME` environment variable. e.g. `TEST_NAME=create_vertex make test` will run tests with `create_vertex` in the name across all datastore implementations. All unit tests will run in CI.\n\n### Benchmarks\n\nMicrobenchmarks can be run via `make bench`.\n\n### Fuzzing\n\nA fuzzer is available, ensuring the the RocksDB and in-memory datastores operate identically. Run it via `make fuzz`.\n\n### Checks\n\nLint and formatting checks can be run via `make check`. Equivalent checks will be run in CI.\n\n","funding_links":[],"categories":["Rust","rust","Applications","\u003ca name=\"Rust\"\u003e\u003c/a\u003eRust","软件"],"sub_categories":["Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findradb%2Findradb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findradb%2Findradb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findradb%2Findradb/lists"}