Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Showcasing an app that uses the Solid protocol for decentralized storage

Showcasing an app that uses the Solid protocol for decentralized storage

Lightning talk given February 27th 2020 at the Blockchain Spirit conference in Barcelona.

This talk is a follow up to the talk I gave the previous week introducing Solid: https://speakerdeck.com/noeldemartin/an-introduction-to-solid

Outline & summary:

Slide 1. In this talk, I want to share how I built a decentralized task manager using the Solid protocol.

Slide 2. What is Solid? Solid means Social Linked Data, and it is a web standard based on technologies from the Semantic Web. What's interesting about talking of Solid at a Blockchain conference is that the meaning of decentralized in Solid and Blockchain are very different. In Blockchain, decentralized means that data is everywhere. However in Solid data is only in one place: where the owner of such data chooses it to be.

Slide 3. The main difference from a user's point of view is that you have to indicate where the data should be stored instead of logging in. There is this concept of a POD (Personal Object Datastore), and this is where you will hold your data. You can think of it as a vault with all your files and data from different apps. Given that different applications can interact with the data (having the proper permissions, of course), it is necessary to have a common modeling language that isn't coupled to any particular app. This modeling language is called RDF (Resource Definition Framework).

Slide 4. The most important part to understand about RDF is that it allows to define entities and attributes. A collection of definitions with related entities can be published under an RDF vocabulary. One of the most popular vocabularies can be found at schema.org, and it defines entities such as a Movie, a Person, an Event, etc. If your applications stores data using popular vocabularies, it's more likely that it's compatible with other applications. This achieves the possibility of using different applications to interact with the same data without any migration. Another popular vocabulary is OpenGraph (ogp.me), and you can define your own if you struggle to find one that fits your data model.

Slides 5-6. In order to manage this data in my application, I have used an ActiveRecord library for javascript called Soukai. I implemented this library before knowing of the existence of the Solid protocol, but it's been implemented being database agnostic so it was possible to create an extension to adapt it to Solid.

Slide 7. Here you can see a class diagram of the entities in the task manager. They are fairly typical for such an app, there are tasks and lists holding these tasks. The important thing here is that these models have been defined with open RDF vocabularies, so it's easy for any other application to interact with this data without knowing that my application created it.

Slide 8. Here you can see how this is actually implemented in code. A model can be created by extending the SolidModel class. This adds some properties to define how the model will be mapped to Solid, such as the vocabularies being used (called contexts) and which RDF classes this model is.

Slide 9. The fields definition is something from base Soukai, and it permits declaring the data types of fields together with some validations such as being required or not.

Slide 10. Fields can have complex types such as Dates and this will allow working with native objects to interact with the model. These will be properly serialized when sent to the storage, and you can also define your own types.

Slide 11. Here we can see how easy it is to create a new instance and store it in a POD. The only thing in this code that may be different from other ActiveRecord implementations is that we indicate where to store the data using a url. This url should be obtained when the users open your application, together with the proper permissions to store data.

Slide 12. After the instance is created, interacting with it is completely Solid agnostic.

Slide 13. I encourage you to try the application, which is live at https://noeldemartin.github.io/solid-focus. If you want to use it with the Solid protocol, you will need your own POD and you can get one at https://solid.inrupt.com/get-a-solid-pod. If you only want to play around with it, you can also login offline. Because it's a PWA and it uses Soukai's LocalStorage engine, you can use this application being offline completely.

Slide 14. If you want to learn more about this, I've been journaling what I learned in the development process. You can find my dev journals at https://noeldemartin.com/tasks.

Noel De Martin

February 27, 2020
Tweet

More Decks by Noel De Martin

Other Decks in Technology

Transcript

  1. Showcasing an app that uses the Solid protocol for decentralized

    storage By Noel De Martin February 25th, 2020
  2. What is Solid? = Social Linked Data It’s a web

    standard based on the Semantic Web
  3. What is Solid? Solid Applications store data in your POD

    (Personal Object Datastore) This is possible because data is modeled using RDF (Resource Definition Framework)
  4. Making sense of RDF in your app https://soukai.js.org + Solid

    engine: https://github.com/NoelDeMartin/soukai-solid With a JS Active Record library
  5. Try it yourself! https://noeldemartin.github.io/solid-focus • Get your own POD at

    https://solid.inrupt.com/get-a-solid-pod • You can also login offline (thanks to Soukai’s LocalStorage engine!)
  6. Thank you! noeldemartin.com @NoelDeMartin To learn more, you can read

    my Dev Journal: • Implementing a Task Manager using Solid • Improving Solid Focus Task Manager • Configuring a self-hosted Solid POD server find these entries at noeldemartin.com/tasks noeldemartin.social/@noeldemartin