← 开源
FalkorDB

FalkorDB

A super fast Graph Database uses GraphBLAS under the hood for its sparse adjacency matrix graph representation. Our goal is to provide the best Knowledge Graph for LLM (GraphRAG).

InfrastructureData systemsRust
在 GitHub 打开
增长势头
+41724 小时新增 Star+6.1%
7.27k
Star
514
Fork
—
本周
67
贡献者
创建于 2023-07-20 · 更新于 2026-10-05 · 今日第 32 名
主要开发者
README

FalkorDB Logo Square B

FalkorDB

Ultra-fast, Multi-tenant Graph Database

Powering Generative AI, Agent Memory, Cloud Security, and Fraud Detection

FalkorDB%2FFalkorDB | Trendshift

Try Free

Discord Dockerhub codecov Rust license

FalkorDB GitHub Repo - Video - 640x365

UNIQUE FEATURES

Our goal is to build a high-performance Knowledge Graph tailored for Large Language Models (LLMs), prioritizing exceptionally low latency to ensure fast and efficient information delivery through our Graph Database.

🆕 FalkorDB is the first queryable Property Graph database to leverage sparse matrices for representing the adjacency matrix in graphs and linear algebra for querying.

Key Features

  • Sparse Matrix Representation: Utilizes sparse matrices to represent adjacency matrices, optimizing storage and performance.

  • Linear Algebra Querying: Employs linear algebra for query execution, enhancing computational efficiency.

  • Property Graph Model Compliance: Supports nodes and relationships with attributes, adhering to the Property Graph Model.

  • OpenCypher Support: Compatible with OpenCypher query language, including proprietary extensions for advanced querying capabilities.

Explore FalkorDB in action by visiting the Demos.

GET STARTED

Step 1

To quickly try out FalkorDB, launch an instance using docker:

docker run -p 6379:6379 -p 3000:3000 -it --rm -v ./data:/var/lib/falkordb/data falkordb/falkordb

Step 2

Then, open your browser and navigate to http://localhost:3000.

You can also interact with FalkorDB using any of the supported Client Libraries

MotoGP League Example

In this example, we'll use the FalkorDB Python client to create a small graph representing a subset of motorcycle riders and teams participating in the MotoGP league. After creating the graph, we'll query the data to explore its structure and relationships.

from falkordb import FalkorDB

# Connect to FalkorDB
db = FalkorDB(host='localhost', port=6379)

# Create the 'MotoGP' graph
g = db.select_graph('MotoGP')
g.query("""CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}),
                  (:Rider {name:'Dani Pedrosa'})-[:rides]->(:Team {name:'Honda'}),
                  (:Rider {name:'Andrea Dovizioso'})-[:rides]->(:Team {name:'Ducati'})""")

# Query which riders represents Yamaha?
res = g.query("""MATCH (r:Rider)-[:rides]->(t:Team)
                 WHERE t.name = 'Yamaha'
                 RETURN r.name""")

for row in res.result_set:
	print(row[0])

# Prints: "Valentino Rossi"

# Query how many riders represent team Ducati ?
res = g.query("""MATCH (r:Rider)-[:rides]->(t:Team {name:'Ducati'})
                 RETURN count(r)""")

print(res.result_set[0][0])
# Prints: 1

USING FALKORDB

You can call FalkorDB's commands from any Redis client. Here are several methods:

With redis-cli

$ redis-cli
127.0.0.1:6379> GRAPH.QUERY social "CREATE (:person {name: 'roi', age: 33, gender: 'male', status: 'married'})"

With any other client

You can interact with FalkorDB using your client's ability to send raw Redis commands.

Note: Depending on your client of choice, the exact method for doing that may vary.

Example: Using FalkorDB with a Python client

This code snippet shows how to use FalkorDB with from Python using falkordb-py:

from falkordb import FalkorDB

# Connect to FalkorDB
db = FalkorDB(host='localhost', port=6379)

# Select the social graph
g = db.select_graph('social')

reply = g.query("CREATE (:person {name:'roi', age:33, gender:'male', status:'married'})")

CLIENT LIBRARIES

Note: Some languages have client libraries that provide support for FalkorDB's commands:

Official Clients

Project Language License Author Stars Package Comment
jfalkordb Java BSD FalkorDB jfalkordb-stars Maven
falkordb-py Python MIT FalkorDB falkordb-py-stars pypi
falkordb-ts Node.JS MIT FalkorDB falkordb-ts-stars npm
falkordb-rs Rust MIT FalkorDB falkordb-rs-stars Crate
falkordb-go Go BSD FalkorDB falkordb-go-stars GitHub
NFalkorDB C# Apache-2.0 FalkorDB nfalkordb-stars nuget

Additional Clients

Project Language License Author Stars Package Comment
nredisstack .NET MIT Redis nredisstack-stars nuget
redisgraph-rb Ruby BSD Redis redisgraph-rb-stars GitHub
redgraph Ruby MIT pzac redgraph-stars GitHub
redisgraph-go Go BSD Redis redisgraph-go-stars GitHub
rueidis Go Apache 2.0 Rueian rueidis-stars GitHub
ioredisgraph JavaScript ISC Jonah ioredisgraph-stars GitHub
@hydre/rgraph JavaScript MIT Sceat rgraph-stars GitHub
php-redis-graph PHP MIT KJDev php-redis-graph-stars GitHub
redisgraph_php PHP MIT jpbourbon redisgraph_php-stars GitHub
redisgraph-ex Elixir MIT crflynn redisgraph-ex-stars GitHub
redisgraph-rs Rust MIT malte-v redisgraph-rs-stars GitHub
redis_graph Rust BSD tompro redis_graph-stars GitHub
rustis Rust MIT Dahomey Technologies rustis-stars Crate Documentation
NRedisGraph C# BSD tombatron NRedisGraph-stars GitHub
RedisGraph.jl Julia MIT xyxel RedisGraph.jl-stars GitHub

DOCUMENTATION

Official Docs | Clients | Commands | 📊 Latest Performance Benchmarks

Community and Support

  • Discussions: Join our community discussions on GitHub Discussions to ask questions, share ideas, and connect with other users.

  • Contributing: We welcome contributions! See the Developer Guide below to build FalkorDB from source and run the test suites.

  • License: This project is licensed under the Server Side Public License v1 (SSPLv1). See the LICENSE file for details.

Developer Guide

This repository is the Rust implementation of FalkorDB. It builds the falkordb Redis module (libfalkordb.{so,dylib}) from Rust, using GraphBLAS sparse matrices for graph storage and traversal.

Quick Start with Dev Container (Recommended)

The easiest way to get started is using the development container, which includes all dependencies pre-installed:

  1. Install Docker and VS Code
  2. Install the Dev Containers extension
  3. Open this project in VS Code
  4. Click "Reopen in Container" when prompted (or press F1 and select "Dev Containers: Reopen in Container")
  5. Wait for the container to build (first time takes ~10-15 minutes)
  6. Start developing! All dependencies are ready to use.

See .devcontainer/README.md for more details.

Manual Setup

If you prefer to set up the environment manually:

Build

cargo build

Dependencies:

GraphBLAS, LAGraph, and RediSearch must be built and installed before building this project.

Toolchain prerequisites
Host Compiler OpenMP runtime
macOS brew install llvm (provides clang with OpenMP support) brew install libomp
Linux clang-23 (e.g. from apt.llvm.org) apt install libomp-23-dev

Local builds use whatever OpenMP package is on the system — build/libomp.sh is not required for local development. It is only invoked by the Docker toolchain image (build/Dockerfile) to produce /opt/libomp/lib/libomp.a, which lets the published libfalkordb.{so,dylib} embed libomp statically and have no libomp.so.5 / libgomp.so.1 / libomp.dylib runtime dependency. A locally-built artifact will dynamically link the system libomp instead — fine for dev, but CI/Docker is the source of truth for the self-contained image.

If you do want a self-contained local artifact (e.g. to mirror the Docker build), run build/libomp.sh with a writable PREFIX and point graph/build.rs at it via LIBOMP_PREFIX:

CC=$(brew --prefix llvm)/bin/clang PREFIX=$HOME/libomp ./build/libomp.sh
LIBOMP_PREFIX=$HOME/libomp cargo build

The script auto-detects the libomp source release from ${CC:-clang} --version, so it stays ABI-matched to your compiler with no manual version arg. In Docker the same auto-detection runs against clang-${CLANG_MAJOR}, eliminating the prior drift risk between the apt-installed clang and a hand-pinned LLVMORG_VERSION.

Building the native dependencies

GraphBLAS, LAGraph and RediSearch are git submodules under deps/, built by the native-deps crate. git owns those checkouts — native-deps only builds what is there, so populate them first.

On macOS, point the build at Homebrew clang first: the system clang has no OpenMP, and GraphBLAS would build single-threaded without saying so.

export CC=$(brew --prefix llvm)/bin/clang
export CXX=$(brew --prefix llvm)/bin/clang++
git submodule update --init --recursive
cargo build   # graph/build.rs calls native-deps; nothing else to run

(git clone --recurse-submodules does the first step for you.)

cargo build builds any missing dependency automatically, so the explicit step below is only needed if you want to build them ahead of time or inspect the result:

cargo run --manifest-path native-deps/Cargo.toml
The artifact cache

Results are cached at ${XDG_CACHE_HOME:-$HOME/.cache}/falkordb/native-deps/// ($FALKORDB_DEPS_CACHE overrides the root). The key covers everything the artifacts are ABI-tied to: the submodule revision, the GB_control patch, the vendored PreJIT kernels, the recipe sources, $CC/$CXX --version, the target triple and the OpenMP/sanitizer flavour. Worktrees therefore share archives, and a compiler bump can never yield a stale-ABI cache hit.

$FALKORDB_NATIVE_DEPS_PREBUILT names extra read-only roots to search first; the Docker images use it to expose the artifacts their dep stages built.

Bumping a dependency

Move the gitlink the ordinary way, then regenerate the lock file:

git -C deps/RediSearch checkout 
git add deps/RediSearch
cargo run --manifest-path native-deps/Cargo.toml -- lock

deps/native-deps.lock mirrors the gitlinks as a plain file, because a Docker build context has no .git for the dep stages to read. CI enforces that the two agree via lock --check.

  • pytest - create virtualenv and install tests/requirements.txt

The virtual environment should be activated before running tests.

python3 -m venv venv
source venv/bin/activate
pip install -r tests/requirements.txt

Testing

  • run unit tests with cargo test -p graph

  • run e2e and function tests with pytest tests/test_e2e.py tests/test_functions.py -vv

  • run MVCC and concurrency tests with pytest tests/test_mvcc.py tests/test_concurrency.py -vv

  • run flow tests with ./flow.sh

  • run tck tests with pytest tests/tck/test_tck.py -s

There is an option to run only part of the TCK tests and stop on the first fail

TCK_INCLUDE=tests/tck/features/expressions/list pytest tests/tck/test_tck.py -s

To run all passing TCK tests use:

TCK_DONE=tck_done.txt pytest tests/tck/test_tck.py -s

LICENSE

Licensed under the Server Side Public License v1 (SSPLv1). See LICENSE.

Support our work

⭐️ If you find this repository helpful, please consider giving it a star!

↗️ Graph, graph database, RAG, graphrag, Retrieval-Augmented Generation,Information Retrieval, Natural Language Processing, LLM, Embeddings, Semantic Search