Introduction
Welcome to Myne’s Developer Documentation!
Myne is a decentralized platform that allows developers to securely store and responsibly access their users’ personal data.
Getting started
As a developer, you probably want to install your own instance of Myne’s platform to start experimenting.
You will also need to use the SDK (web only at the moment, mobile is coming soon) in your application to be able to communicate with the platform.
Feel free to check out our guides and the different concept pages that dig deeper into the knowledge you will need to better take advantage of all what Myne has to offer.
Support & Feedback
If you have any question, you’re welcome to join our community on Discord.
Licence
Apps
A Myne App is essentially a set of pre-defined actions that can be invoked to interact with your personal Semantic Graph.
Manifests
An App Manifest can be viewed as a contract between you and its developer.
A manifest contains:
- Identification information about the app itself, the company behind it etc.
- A list of Actions that can be performed on your Semantic Graph
- A list of Data Sharing Schemes that can be created to share data with your peers
If you agree with those terms, you will be redirected to the app’s landing page with a session token that will allow the app to execute the actions specified in the manifest.
Actions
Actions are essentially templated SGQL queries that can be run on your Semantic Graph.
Data Sharing Schemes
Data Sharing Schemes are essentially actions that can be run by a Peer on your Semantic Graph.
Example use case: you created an app allowing users to create lists, and you want to allow them to share lists with their friends.
Contracts
A contract is essentially a set of predefined actions, just like apps but simpler, that allows you to generate access token you can use in third-party apps and services to access your data.
An example use case would be using a contract with your blog to access the posts stored in your Semantic Graph.
Files
With Myne, files are not only defined by their content but also by their metadata which is contained in a linked Node.
This is really powerful, as it allows attaching complex documents to simple data points, but also classifying and searching for files in a very precise way.
Searching files
Since files are regular nodes in the Semantic Graph, you can query them like any other entity.
Uploading files
At this moment, files can only be uploaded through Myne’s app.
Downloading files
At this moment, files are necessarily downloaded through Myne’s app, but requesting a download from an app is possible using the SDK.
Sharing files
Files can be shared with peers through Myne’s app.
Identities
In Myne’s app, you can create multiple identities, which allows you to isolate data and files in your Semantic Graph.
Meaning that for a same request, two apps linked to two different identities will return different results.
This is useful when wanting to separate work related content and personal content for example, or multiple projects.
Peers
Myne users can add each other as contact in Myne’s app, and by doing so, they can share files and data through apps’ Data Sharing Schemes.
Schemas
All data in the Semantic Graph is structured, meaning it follows a specific schema.
Schemas are designed to represent and codify the world we live in, and make it inter-operable and searchable by computer programs. This will allow us to unlock an immense potential for cross-domain applications.
Public Schemas
Myne maintains an open source schemas repository that is used to validate nodes and relations in the database.
Feel free to open issues there if you see something missing for your use case and spot a mistake.
Custom Schemas
In some cases, if the domain you are trying to represent is too niche, we would advise to use custom schemas, which will allow you create any node and relation definitions you want.
Semantic Graph
On Myne, each user have their personal Semantic Graph.
It is a powerful graph-like database that contains structured data and files that can be related to each others.
Semantic Graph Query Language
To interact with this graph, we created a query language called SGQL.
SGQL aims to be easy to use and close to plain english even when expressing complex relationships. It was designed specifically for this use case and is not meant to be an all around query language like Cypher etc.
Session
There are multiple session types in Myne, but they are essentially keys to your Semantic Graph which give permission to peers and apps to access your data linked to a specific identity.
When a session expires, or you revoke it manually, the app that used it cannot access your data anymore.
Zero-Knowledge
Myne is built around a zero-knowledge architecture, which means that nobody besides you can access the data on your semantic graph without your permission, not even Myne’s administrators.
Your data is fully encrypted with an AES-256 algorithm, and it is only ever decrypted when an authorized request is made with a session key, and only for the duration of the request.
Only you have the key to your data, so don’t loose it, as we cannot get it back for you!
Installation
Whether you want to install Myne for development purposes or spin up your own instance as a user, a few options are available.
Docker
For a list of available image tags and full description, go to Docker Hub.
Simple Docker command:
docker run -it -d \
-p 2020:2020 \
-e "MYNE_URL=<url> \
-e "MYNE_NONCE=<nonce>" \
-e "MYNE_ADMIN_KEY=<admin_key>" \
--volume=./data_admin:/myne/data_admin \
--volume=./data_users:/myne/data_users \
--name myne-core \
myne/core:latest
Or with Docker Compose:
# docker-compose.yml
myne-core:
image: myne-core:latest
container_name: myne-core
ports:
- "2020:2020"
environment:
- MYNE_URL=<url>
- MYNE_NONCE=<nonce>
- MYNE_ADMIN_KEY=<admin_key>
volumes:
- ./data_admin:/myne/data_admin
- ./data_users:/myne/data_users
Environment variables explanation:
MYNE_URL: URL where your Myne instance is accessible from the internet (or http://localhost:2020 for development)MYNE_NONCE: Secret Nonce for encryption, MUST be 12 characters longMYNE_ADMIN_KEY: Secret Admin Key for encryption, MUST be 32 characters longMYNE_SMTP_SERVER: SMTP server address that will be used to send e-mailsMYNE_SMTP_USER: SMTP server userMYNE_SMTP_PASSWORD: SMTP server passwordMYNE_SIGNUP_CODES:
Helm
Coming soon
Web SDK
Myne SDK JS is a Javascript/Typescript implementation of the Myne protocol.
Find out more on our GitHub repo.
App Manifest
If you do not want to use Myne’s app to register your manifest, you can submit your applications’ manifests programmatically, which is useful in a CI/CD environment for example.
Endpoint
POST https://core.myne.systems/app-manifests
Schema
The body of the request MUST be of Content-Type: application/json and follow this schema:
{
"id": "",
"name": "",
"version": "",
"last_version_published": "",
"url": "",
"company": "",
"company_url": "",
"logo": "",
"contract": {},
"data_sharing_schemes": {}
}
| Property | Default Value | Description |
|---|---|---|
| id | "" | Id of the App. Used when updating the manifest |
| name | The name of your application | |
| version | Version of your app’s manifest | |
| url | Address of the app’s webpage | |
| company | Name of your company | |
| company_url | Address of your company’s webpage | |
| logo | A base64 data url string of your app’s logo | |
| contract | List of actions your application can perform. See below | |
| data_sharing_schemes | {} | List of Data Sharing Schemes that users can invoke. See below |
Actions
Action names (keys in the object actionsof the manifest) SHOULD be lowerCamelCased.
{
"createConversation": {
"name": "createConversation",
"description": "Create a conversation",
"query_template": "WRITE > Conversation IS:subject '%subject%' BEEN:Participate ME HAS:role '%role%'",
"query_params": [
"subject",
"role"
]
}
}
| Property | Default Value | Description |
|---|---|---|
| name | Name of the action | |
| description | A short description of what the action does | |
| query_template | A templated SGQL query. See Templated Queries | |
| query_params | A list of parameters used in the query_template | |
| hook | undefined | An url to call when the action is run. See below |
Hooks
Hooks are http calls triggered when the action is run.
{
"url": "",
"method": "",
"authorization_header": ""
}
| Property | Default Value | Description |
|---|---|---|
| url | The url to call | |
| method | GET, POST, DELETE, PUT… | |
| authorization_header | A string that will be injected in the Authorization http header of the request |
Data Sharing Schemes
Data Sharing Scheme names (keys in the object data_sharing_schemesof the manifest) SHOULD be lowerCamelCased.
{
"myList": {
"name": "myList",
"description": "",
"action": {},
"scheme_parameter_name": ""
}
}
| Property | Default Value | Description |
|---|---|---|
| name | Name of the scheme | |
| description | A short description of what the scheme | |
| action | One Action | |
| scheme_parameter_name | Name of the parameter that will be fixed (usually an id so that exactly one entity is shared) |
SGQL - Semantic Graph Query language
On Myne, each User has their own personal Semantic Graph.
This graph is composed of Nodes, linked by Relations, and is centered on a Me node that represents an identity of the user.
Anatomy of a query
An SGQL Query is composed of two stages:
- The
metastage, which is everything before the> - The
querystage, which is everything after the>
The Action keyword
The Action keyword can be one of the following:
What they do is pretty self-explanatory, but check their specificities in the subsections.
Nodes
Nodes SHOULD be title cased and singular.
Nodes MAY have properties, that can be defined with the IS keyword.
FIND > Movie IS:title 'The Matrix'
Relations
Relations SHOULD be title cased and singular.
Relations are directional.
They are defined using the keywords:
DID: Node –DID–> NodeBEEN: Node <–BEEN– Node
Relations MAY also have properties, that can be defined with the HAS keyword.
For example, if you write this:
WRITE > Me DID:Rate HAS:star '5' Movie IS:title 'The Matrix'
You can retrieve it like this:
FIND > Movie BEEN:Rate HAS:star '5' Me
Note that the position of the Me keyword doesn’t matter, as long as it is after the relation, or it can be omitted altogether.
These are equivalent to the previous query:
FIND > Movie BEEN:Rate Me HAS:star '5'
FIND > Movie BEEN:Rate HAS:star '5'
Values
As you may have noticed, values MUST be surrounded by single quotes '', even for numbers.
Templated Queries
In App Manifests, actions use SGQL queries where values can contain variables.
They are defined like so '%variableName%'.
Operators (AND / OR)
By default, queries use the AND operator, so that you can define multiple relations conditions.
FIND > Movie BEEN:Rate HAS:star '5' HAS:year '2002'
But if you wanted to find movies that you liked in 2021 or 2022:
FIND > Movie BEEN:Like Me HAS:year '2021' OR( HAS:year '2022' )
Mind that its OR(_ (with the open parenthesis and space after) and closed by _) (with a space before).
You can also define another relation in the OR query:
FIND > Person DID:Watch Movie IS:title 'Star Wars' OR( DID:Watch Movie IS:title 'The Matrix' )
Output of a query
If the query is valid, the output of a query is a JSON of the form:
{
"nodes": [],
"relations": []
}
The type of the nodes returned is the leftmost node name, that is the one right after the >.
Specific typings for the query response are defined in each SDK documentation in the “Resources” section of this documentation.
FIND
Use FIND queries to retrieve data from a User’s Semantic Graph.
Syntax
FIND > Message
FIND > Movie BEEN:Watch Me
Rules
FINDqueries MUST NOT have any meta stage modifiers.
Behaviour
FINDqueries WILL return Nodes and Relations defined in the query
Response
FINDqueries WILL return Nodes and Relations that have been found satisfying the query
WRITE
Use WRITE queries to save data on a User’s Semantic Graph.
Syntax
WRITE > Me DID:Watch Movie IS:title 'Test'
Rules
WRITEqueries MUST NOT have any meta stage modifiers.
Behaviour
WRITEqueries WILL create every entity that does not already existWRITEqueries WILL overwrite existing files that match the query
Response
WRITEqueries WILL return Nodes and Relations that match the query as if it was aFINDquery
UPDATE
Use UPDATE queries to update data of a User’s Semantic Graph.
Syntax
UPDATE IS:name 'Toto 2' > Person IS:name 'Toto 1'
UPDATE HAS:count '2' > Me DID:Listen Song ID 'ae1f8211-b7eb-4d8e-bb06-cfc240c0f068'
Rules
UPDATEqueries MUST have meta stage modifiers.
Behaviour
UPDATEqueries ONLY modify propertiesUPDATEqueries WILL modify Nodes (with theISkeyword) and Relations (with theHASkeyword) matched by the query stage
Response
UPDATEqueries WILL return Nodes and Relations that have been updated
DELETE
Use DELETE queries to remove data from a User’s Semantic Graph.
Syntax
DELETE > Place ID 'ae1f8211-b7eb-4d8e-bb06-cfc240c0f068' BEEN:Visit Me
DELETE > Place ID 'ae1f8211-b7eb-4d8e-bb06-cfc240c0f068'
Rules
DELETEqueries MUST reference a Node by its id.
Behaviour
- If a query ONLY defines a Node, the Node will be deleted
- If the query defines a Relation, ONLY the Relation WILL be deleted, not the Nodes involved in the relation.
Response
DELETEqueries WILL return Nodes and Relations that have been deleted