Using Dgraph
Add ‘memory’ and Knowledge Graph connection to your app.
Integrating Dgraph in Modus is a powerful solution to expose AI services with “memory” or to create, maintain and leverage knowledge graphs.
After you have initialized a Modus app:
-
Provision your environment
Run Dgraph locally or provision a Graph on Hypermode. -
Declare the connection in the App Manifest
Edit the App Manifest to declare a connection to the Dgraph instance using the Dgraph connection string.For local instance of Dgraph, the connection string is
dgraph://localhost:9080
.
For a Graph on Hypermode, the connection string is available from the Hypermode dashboard.Make sure to use a variable for the bearer token so you don’t commit secrets in your project!
Note: you can also define a Dgraph connection
Using the gRPC target
parameter.
-
Set the secrets
When working locally set your Environment Secrets using a .env file..env.dev.local
When your app is deployed on Hypermode, add the connection secrets in the Hypermode Console. -
Use Modus SDK to query and mutate the graph.
In your Modus app, use the Modus SDK to fetch data from Dgraph.
Resources
- Manage Schema to deploy a schema to your Dgraph instance if needed.
- Get inspirations from Modus Recipes where you’ll find examples using Dgraph in Modus.
- Check the Modus SDK examples for Go or AssemblyScript