MCPcopy Index your code
hub / github.com/FalkorDB/FalkorDB

github.com/FalkorDB/FalkorDB @v4.18.11

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.18.11 ↗ · + Follow
29,905 symbols 75,540 edges 5,303 files 3,415 documented · 11% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
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 Discord codecov Workflow

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.

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! Please see our Contributing Guide for more details.

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

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

START BUILDING

Compiling

Make sure to complete these requirements:

1️⃣ The FalkorDB repository: git clone --recurse-submodules -j8 https://github.com/FalkorDB/FalkorDB.git

  • Ubuntu, install: apt-get install build-essential cmake m4 automake peg libtool autoconf python3 python3-pip
  • Alpine, install: apk add build-base cmake m4 automake libtool autoconf python3 py3-pip peg git libgomp openssl-dev
  • OS X, verify that homebrew is installed and run: brew install cmake m4 automake peg libtool autoconf.
    • The version of Clang that ships with the OS X toolchain does not support OpenMP, which is a requirement for FalkorDB. One way to resolve this is to run brew install gcc g++ and follow the on-screen instructions to update the symbolic links. Note that this is a system-wide change - setting the environment variables for CC and CXX will work if that is not an option.

2️⃣ Build by running make in the project's directory.

Congratulations! You can find the compiled binary at bin/<arch>/src/falkordb.so.

Running tests

Start by installing the required Python packages by running pip install -r requirements.txt from the tests directory.

Note: If you've got redis-server in PATH, just invoke make test. Otherwise, invoke REDIS_SERVER=<redis-server-location> make test. For a more verbose output, run make test V=1.

Building in a docker

The FalkorDB build system runs within docker. For detailed instructions on building, please see here.

LOADING FALKORDB INTO REDIS

FalkorDB is hosted by Redis, so you'll first have to load it as a Module to a Redis server.

Note: Redis 7.4 is required for the latest FalkorDB version.

💡 We recommend having Redis load FalkorDB during startup by adding the following to your redis.conf file:

loadmodule /path/to/module/src/falkordb.so

In the line above, replace /path/to/module/src/falkordb.so with the actual path to FalkorDB's library. If Redis is running as a service, you must ensure that the redis user (default) has the necessary file/folder permissions to access falkordb.so.

Alternatively, you can have Redis load FalkorDB using the following command line argument syntax:

~/$ redis-server --loadmodule /path/to/module/src/falkordb.so

Lastly, you can also use the MODULE LOAD command. Note, however, that MODULE LOAD is a dangerous command and may be blocked/deprecated in the future due to security considerations.

Once you've successfully loaded FalkorDB your Redis log should see lines similar to:

...
30707:M 20 Jun 02:08:12.314 * Module 'graph' loaded from <redacted>/src/falkordb.so
...

If the server fails to launch with output similar to:

# Module /usr/lib/redis/modules/falkordb.so failed to load: libgomp.so.1: cannot open shared object file: No such file or directory
# Can't load module from /usr/lib/redis/modules/falkordb.so: server aborting

The system is missing the run-time dependency OpenMP. This can be installed on Ubuntu with apt-get install libgomp1, on RHEL/CentOS with yum install libgomp, and on OSX with brew install libomp.

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][jfalkordb-url] Java BSD [FalkorDB][falkordb-url] [![jfalkordb-stars]][jfalkordb-url] [Maven][jfalkordb-package]
[falkordb-py][falkordb-py-url] Python MIT [FalkorDB][falkordb-url] [![falkordb-py-stars]][falkordb-py-url] [pypi][falkordb-py-package]
[falkordb-ts][falkordb-ts-url] Node.JS MIT [FalkorDB][falkordb-url] [![falkordb-ts-stars]][falkordb-ts-url] [npm][falkordb-ts-package]
[falkordb-rs][falkordb-rs-url] Rust MIT [FalkorDB][falkordb-url] [![falkordb-rs-stars]][falkordb-rs-url] [Crate][falkordb-rs-package]
[falkordb-go][falkordb-go-url] Go BSD [FalkorDB][falkordb-url] [![falkordb-go-stars]][falkordb-go-url] [GitHub][falkordb-go-url]
[NFalkorDB][nfalkordb-url] C# Apache-2.0 [FalkorDB][falkordb-url] [![nfalkordb-stars]][nfalkordb-url] [nuget][nfalkordb-package]

Additional Clients

Project Language License Author Stars Package Comment
[nredisstack][nredisstack-url] .NET MIT [Redis][redis-url] [![nredisstack-stars]][nredisstack-url] [nuget][nredisstack-package]
[redisgraph-rb][redisgraph-rb-url] Ruby BSD [Redis][redisgraph-rb-author] [![redisgraph-rb-stars]][redisgraph-rb-url] [GitHub][redisgraph-rb-url]
[redgraph][redgraph-url] Ruby MIT [pzac][redgraph-author] [![redgraph-stars]][redgraph-url] [GitHub][redgraph-url]
[redisgraph-go][redisgraph-go-url] Go BSD [Redis][redisgraph-go-author] [![redisgraph-go-stars]][redisgraph-go-url] [GitHub][redisgraph-go-url]
[rueidis][rueidis-url] Go Apache 2.0 [Rueian][rueidis-author] [![rueidis-stars]][rueidis-url] [GitHub][rueidis-url]
[ioredisgraph][ioredisgraph-url] JavaScript ISC [Jonah][ioredisgraph-author] [![ioredisgraph-stars]][ioredisgraph-url] [GitHub][ioredisgraph-url]
[@hydre/rgraph][rgraph-url] JavaScript MIT [Sceat][rgraph-author] [![rgraph-stars]][rgraph-url] [GitHub][rgraph-url]
[php-redis-graph][php-redis-graph-url] PHP MIT [KJDev][php-redis-graph-author] [![php-redis-graph-stars]][php-redis-graph-url] [GitHub][php-redis-graph-url]
[redisgraph_php][redisgraph_php-url] PHP MIT [jpbourbon][redisgraph_php-author] [![redisgraph_php-stars]][redisgraph_php-url] [GitHub][redisgraph_php-url]
[redisgraph-ex][redisgraph-ex-url] Elixir MIT [crflynn][redisgraph-ex-author] [![redisgraph-ex-stars]][redisgraph-ex-url] [GitHub][redisgraph-ex-url]
[redisgraph-rs][redisgraph-rs-url] Rust MIT [malte-v][redisgraph-rs-aut

Core symbols most depended-on inside this repo

GB_Context_nthreads_max
called by 4920
deps/GraphBLAS/Source/context/GB_Context.c
GB_Context_chunk
called by 4908
deps/GraphBLAS/Source/context/GB_Context.c
GB_all_aliased
called by 1378
deps/GraphBLAS/Source/aliased/GB_all_aliased.c
cypher_astnode_type
called by 1055
deps/libcypher-parser/lib/src/ast.c
str
called by 965
deps/GraphBLAS/cpu_features/include/internal/string_view.h
arr_len
called by 712
src/util/arr.h
arr_free
called by 409
src/util/arr.h
GrB_Matrix_new
called by 363
deps/GraphBLAS/Source/matrix/GrB_Matrix_new.c

Shape

Function 26,718
Method 2,118
Class 1,043
Enum 25
Route 1

Languages

C87%
Python8%
C++4%

Modules by API surface

src/util/roaring.c691 symbols
deps/GraphBLAS/zstd/zstd_subset/compress/zstd_compress.c241 symbols
src/util/roaring.h188 symbols
tests/fuzz/generator/CypherGenerator.py174 symbols
deps/libcypher-parser/lib/src/parser.c155 symbols
deps/GraphBLAS/xxHash/xxhash.h150 symbols
deps/GraphBLAS/zstd/zstd_subset/common/xxhash.h135 symbols
tests/flow/test_function_calls.py100 symbols
deps/GraphBLAS/GraphBLAS/@GrB/private/mexfunctions/gbargminmax.c100 symbols
demo/client/prettytable/__init__.py97 symbols
deps/GraphBLAS/zstd/zstd_subset/decompress/zstd_decompress.c95 symbols
deps/GraphBLAS/Source/global/GB_Global.c91 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

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

⬇ download graph artifact