Theo 6.0 works with Memgraph
While testing Theo 6.0, our Swift driver for Neo4j, I made an interesting discovery: Theo works with Memgraph out of the box!
The Discovery
Memgraph is a high-performance graph database that implements the Bolt protocol - the same binary protocol that Neo4j uses for client communication. Since Theo communicates with Neo4j using the Bolt protocol (versions 3.0 through 5.6), I was curious to see if it would work with Memgraph.
Testing Setup
I spun up a Memgraph container using Docker:
docker run -d --name memgraph \
-p 7696:7687 \
memgraph/memgraph:latest \
--bolt-server-name-for-init="Neo4j/"
The --bolt-server-name-for-init flag is important - it tells Memgraph
to identify itself in a way that Neo4j drivers expect.
Test Results
I ran the Theo test suite against Memgraph v3.7.2 on both platforms:
| Platform | Result |
|---|---|
| macOS | All 5 tests passed |
| Linux | All 5 tests passed |
The tests cover connection establishment, Cypher query execution, node creation, and transaction handling. Everything worked without any code changes to Theo.
What This Means
If you're already using Theo in your Swift application to talk to Neo4j, you can now also connect to Memgraph with the same code. This gives you flexibility in choosing your graph database backend.
Memgraph positions itself as an in-memory graph database optimized for real-time analytics and streaming workloads. Having Swift driver compatibility opens up interesting possibilities for iOS and macOS applications that need high-performance graph queries.
Technical Notes
Memgraph implements the Bolt protocol with good compatibility. The handshake negotiation works smoothly, and Memgraph accepts connections without requiring username/password authentication by default (unlike Neo4j which requires credentials).
The Cypher query language is largely compatible between the two databases, though there may be some differences in advanced features.
Get Started
Theo is available via Swift Package Manager:
dependencies: [
.package(url: "https://github.com/Neo4j-Swift/Neo4j-Swift.git",
from: "6.0.0")
]
Check out the Theo GitHub repository for documentation and examples.