Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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:

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 long
  • MYNE_ADMIN_KEY: Secret Admin Key for encryption, MUST be 32 characters long
  • MYNE_SMTP_SERVER: SMTP server address that will be used to send e-mails
  • MYNE_SMTP_USER: SMTP server user
  • MYNE_SMTP_PASSWORD: SMTP server password
  • MYNE_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": {}
}
PropertyDefault ValueDescription
id""Id of the App. Used when updating the manifest
nameThe name of your application
versionVersion of your app’s manifest
urlAddress of the app’s webpage
companyName of your company
company_urlAddress of your company’s webpage
logoA base64 data url string of your app’s logo
contractList 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"
    ]
  }
}
PropertyDefault ValueDescription
nameName of the action
descriptionA short description of what the action does
query_templateA templated SGQL query. See Templated Queries
query_paramsA list of parameters used in the query_template
hookundefinedAn 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": ""
}
PropertyDefault ValueDescription
urlThe url to call
methodGET, POST, DELETE, PUT…
authorization_headerA 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": ""
  }
}
PropertyDefault ValueDescription
nameName of the scheme
descriptionA short description of what the scheme
actionOne Action
scheme_parameter_nameName 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:

  1. The meta stage, which is everything before the >
  2. The query stage, 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–> Node
  • BEEN: 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

  • FIND queries MUST NOT have any meta stage modifiers.

Behaviour

  • FIND queries WILL return Nodes and Relations defined in the query

Response

  • FIND queries 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

  • WRITE queries MUST NOT have any meta stage modifiers.

Behaviour

  • WRITE queries WILL create every entity that does not already exist
  • WRITE queries WILL overwrite existing files that match the query

Response

  • WRITE queries WILL return Nodes and Relations that match the query as if it was a FIND query

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

  • UPDATE queries MUST have meta stage modifiers.

Behaviour

  • UPDATE queries ONLY modify properties
  • UPDATE queries WILL modify Nodes (with the IS keyword) and Relations (with the HAS keyword) matched by the query stage

Response

  • UPDATE queries 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

  • DELETE queries 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

  • DELETE queries WILL return Nodes and Relations that have been deleted