A simple example app for Solid, created for educational purposes
Yo is an app to send “yo” messages to people. That’s all it can do. I blatantly copied the concept from the existing Yo mobile app.
However, this app is intended as a step-by-step instruction on how to build apps on top of the Solid platform.
I made a public version available.
You can register with any Solid server or set up one of your own. An example server is solid.community.
- The application and data storage are decoupled: you can store your list of Yos in a Solid pod of your choice.
- The list of Yos is stored separately from profiles: the sender's and recipient's names are retrieved from their store.
In the future, we might want to store every Yo with its creator, and send notifications to the recipient. But that would make the app a bit more complex, whereas now it is an easy introduction to Solid apps.
- The app accesses an RDF document in the Turtle syntax, which contains (possibly among other things) a list of Yo messages.
- It fetches and parses this document into an array of triples.
- It then searches those triples for “Yo” messages with a sender and a recipient.
- First, it select the triples that have “Yo” as a summary.
- Then, for each of those triples, we try to find senders and recipients of the same message.
- Finally, if there is exactly one sender and one recipient for the message, we return them.
- Note in the above steps how we don't make any assumptions about the RDF data: sender or recipient might be missing, or there might be multiple.
- It tries to find human-readable labels for sender and recipient (which are IRIs in the document).
- It does this by dereferencing them, which means retrieving the associated document.
- Inside of that document, it looks for the first label for that entity.
- Adding Yo messages happens by sending an HTTP
PATCH
request with a SPARQLUPDATE
query as body. - For
PATCH
to work, the user should be logged in.- This is done with the solid-auth-client, which provides an authenticated
fetch
function that the Yo data source uses instead of the defaultwindow.fetch
. - The access control document explicitly gives append permissions to the public.
- This is done with the solid-auth-client, which provides an authenticated
Step through all of the commits and see the app grow incrementally.