A GRAPH BACKEND
FOR A DISTRIBUTED, REAL-TIME WORLD

The best graph backend experience for Python developers

pip install zef

Easy graph development in Python

Zef is an open source, data-oriented toolkit for graph data. It combines the access speed and local development experience of an in-memory data structure with the persistence and full-versioning of a distributed, immutable database. Create your first database in a few lines:

Copied to clipboard!
from zef import *
from zef.ops import *

# Create a new database
g = Graph()

# Add an entity
p1 = ET.Person | g | run

# Add "fields" (source, relation, target)
(p1, RT.FirstName, "Yolandi") | g | run

# Traverse your nodes through time and space
p1 | now | Out[RT.FirstName] | value | collect # -> "Yolandi" 

In Zef, we overloaded the "|" pipe so users can chain together values, Zef operators (ZefOps), and functions in sequential, lazy, and executable pipelines where data flow is left to right.

Go to Zef docs

DEVELOP WITH ZEF

(g
| now                                # At the latest time slice
| all[ET.Person]                     # Get all ET.Person nodes
| filter[F.Name | equals["Yolandi"]] # Filter on the value of the field RT.Name
| single                             # Confirm only a single Person named Yolandi
| collect)                           # Make entire pipeline eager and return value

Powerful Python operators

Pipe together queries or pipelines directly in Python with a pre-built library of lazy operators. Work with your graphs like local data structures.

# View this entity 2 time slices ago relative to its slice
p1 | time_travel[-2] | collect

# View the graph at this absolute time
absolute_t = Time('2021 December 4 15:31:00 (+0100)')
g | time_travel[absolute_t] | collect

# View all graph transactions
first_tx = g | all[TX] | first | collect

# View events in any given Transaction
first_tx | events | collect

Fully versioned graphs

An in-memory, immutable database means fully versioned graphs out-of-the-box. Time travel with ease to any previous time slice.

# Autogenerate the actions to create a GraphQL backend
actions = auto_generate_gql(g)

# Apply the actions on a graph
tx_receipt = actions | transact[g] | run

# Get the schema root from tx_receipt dict
my_schema = tx_receipt["schema_root"]

# Construct an Effect which starts a GraphQL server
Effect({
        "type": FX.GraphQL.StartServer,
        "schema_root": my_schema,
        "path": '/my-api',
        "port": 6000,
}) | run

Native GraphQL support

Automatically generate a GraphQL schema and explore with the GQL playground. Launch a GraphQL server with just a few lines of code.

Easy graph deployment in real-time

ZefHub automatically persists, synchronizes, and distributes graphs across its network in real-time. Any update on a graph will be mapped almost instantaneously into the local memory of all other machines with graph access.

DEPLOY WITH ZEFHUB

# Make a graph fully synced and distributed in real-time
g | sync[True] | run

Infra with 1 line of code

Access storage and real-time, distributed infrastructure instantly. No config or maintenance needed, so you can focus on development.

# Tag a graph with a label
g | tag["awesome-analysis"] | run

# Grant view access to a friend
"friend@abcxyz.com" | grant[KW.view][g] | run

Share graphs with others

Send your graph’s tag or UID to another ZefHub user. Others with access will see all graph changes happening on their local machines, in real-time.

# Retrieve a graph with this tag from ZefHub
graph_tag = 'user/awesome-analysis'
g = Graph(graph_tag)

# Subscribe to be informed any time a new Entity is added
g | on[Instantiated[ET]] | subscribe[print]

Retrieve graphs instantly

Pull graphs onto any machine’s local memory. Subscribe and be informed of any specific changes with the option of locking on a specific time slice.

FAQ

GET MONTHLY UPDATES

Thank you for signing up!
Oops! Something went wrong while submitting the form.