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.
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.