Ways to use MaidSafe/SAFE on a website

Hi, folks!

< chit-chat>
My name is Daniel and I’m software developer since 2002. Today I work primarily with Rails and Angular (and everything required to build a website), but I worked many years as PHP and C developer. Although I’m what is called “full-stack developer”, I’m an eternal newbie.
< /chit-chat>

I’m trying to understand how can I use SAFE on my websites.

Let’s say that I’ve a PHP + PostgreSQL website and it’s running on a cloud server (like Digital Ocean). How can I use SAFE on it? I’m thinking on these ways:

  1. use SAFE as storage: mount my app files folder (php, html, js, css)
    on a private NFS SAFE folder. Do the same with my database folder.

  2. use SAFE as CDN: move my assets files (js, html, css) to a public
    mounted NFS SAFE folder. Use the SAFE DNS to point to this public
    folder and rewrite the js/css references to use this url. This
    unfortunatelly will only work with SAFE DNS compatible browsers.

  3. use SAFE as database: change the current database from PostgreSQL to
    SAFE-DHT (change the code and migrate the current data). As I
    understood, SAFE DHT is a no-sql database, like Redis or MongoDB
    that supports private collections with key/value pairs.

  4. run the entire website on SAFE: this is the best scenario. On this case,
    we won’t need a cloud server anymore neither to understand any language
    than JS (we’ll need client-side JS not server-side JS like nodeJS), as we
    don’t have a backend anymore.

The best approach to make a 100% SAFE website is to make a SPA application without any API call. No backend required. To make the website dynamic, we can access some simple JS functions that allows us to interact with the private SAFE-DHT no-sql user data. These functions are similar to the other no-sql databases and are provided by some browser plugin. Also, we can read data (or even write) from other users if they are labeled as “public”. To publish the website/app, we use the approach #2 (use SAFE as CDN).

Are my conclusions right? Or I misunderstood something?

PS: sorry my english, I’m not a native english speaker.

7 Likes

@anon20895533 Great to have you on the forum. I am not technically adept enough to know the answers to your questions. But I from what I have read so far, the forum collectively expects SAFE to support #3 of your options right out of the box.

Long-term we expect to reach #4, but my understanding is that there is some difficulty with having dynamic user interaction. I suspect that the solution will involve the website owner posting a certain amount of safecoin to allow people to comment for free.

5 Likes

Afraid I don’t know the answers to your questions either.

One thing that I had pondered was using the safe network as a public backup/ mirror of my content.

Suppose I’m a blogger in some repressive regime. I want my site on the public internet for maximum exposure. But I’d also like to know (and for the authorities to know) that if they take my internet site down then all of my content remains available via the Safe network anyway. I might also want to put a badge on my internet site “also available on the safe network” to let my users know they can access my content there.

So how easy would it be to create a RSS app for Safe that grabs the RSS from the public internet and adds it to my Safe site?

3 Likes

Welcome @anon20895533 :slight_smile: You have it in a nutshell I think. There is little point in scenarios 1 to 3 IMO, though people are no doubt going to attempt them anyway. My my reason is that if you just build a bridge from a today’s broken web/internet (insecure, unstable, censor-able, hackable, DDoS’able etc.), you miss out on the purpose of SAFE (a secure, anonymous, decentralised alternative internet). [edit:] notwithstanding @sam_uk’s suggestion which is a great idea. I’m wrong as usual :wink: Most people here at the moment are interested in using SAFE to create a better alternative, rather than to bolt it onto the existing internet.

The plan for websites and web apps which live on SAFE is for MaidSafe to produce a browser plugin that gives access to the API.

The SAFE Browser Plugin will work seamlessly alongside the existing web, with a SAFE resource being accessed with a “safe:” prefix rather than “http:”, so “safe:blog.dyates” typed into the browser would retrieve your personal blog on SAFE. Or “safe:dyates/homepage” would retrieve the “index.html” file from a directory in your public SAFE storage, called “homepage” etc. An early version exists and can be played with (see MaidSafe Dev Update 31st August 2015).

You may be wondering, ok that works for a static website, but what about dynamic? This is still being worked on. I initiated a project (http://safepress.io) to provide the client side and help develop the way of working for this along with the community, and MaidSafe of course.

I had some preliminary thoughts on how this might work (see: SAFEpress Outline Design and RFC: SAFE browser plugin URL handling - dynamic HTML on client side) but these are stalled awaiting developments on the implementation of SAFE “Structured Data” which it appears might mean the network can do some of the backend processing after all (previously it looked like only REST style CRUD operations would be possible, but it seems we’ll have a way to enumerate documents too).

So part of SAFEpress is intended to figure out and provide a framework (Javascript+Plugin) to do the traditional backend stuff in the client, and the other to provide an interface frontend designers can use without caring about the backend. We’re stalled at the moment, as the initial SAFEpress volunteers have gone quiet, including myself (!) - I’ve been both too busy and awaiting details about Structured Data to continue with thinking much about the backend. We have a task list though, which anyone can work on, or add to on Trello, see: https://trello.com/safepress There’s a good overview of SAFEpress at http://safepress.io with links to all the SAFEpress tools and resources, including a Google group for SAFEpress discussions.

EDIT: By the way Daniel, your English is excellent, and even those who are not so fluent are welcome and flourish here. And if you wish, you can add yourself to the Introduce Yourself topic.

4 Likes

So I’m only just beginning to get my head round the public part of the safe network. That browser plugin sounds great! So I can access Safe sites in my current browser…

In that case as a dissident blogger I might just put up a page with a link to download the plugin and a link to safe:blog.somedissident.

I’d probably still want a RSS feed to get my content into Twitter/ Facebook though. So would the reverse of my original question be possible: Could you get a RSS feed on the Internet from a Safe network site?

2 Likes

Things like this are possible, but would require posting your content to a server on the old web I think. I’m not sure, but I think that RSS services would want to be able to verify the link, and they would not understand a “safe:” style URL and so are likely to reject it. So your original mirroring approach would probably be the best way to achieve this.

1 Like

Thank you all for the quick replies, it’s the kind of thing which defines an active community :smile:

that’s a great idea. I can presume on how you’ll manage the posts, but I’m wondering how the blog readers will comment.

Let’s call “collection” the collection of key/values (is this the correct term on SAFE-DHT?). As I understood, the blog posts will be stored on a collection with read-only permission to everyone and write permission to the blog owner (admin). Each post will be a new key/value on this collection. The admin will use a private app to manage the posts.

To the comments, I presume that each post will have a set of comments, which will be stored on another collection. Each comment will be a new key/value on this collection. This collection will be also created with public visibility, and each key/value will have read permissions to everyone, but write permissions only to the key/value creator (the commenter). Is that possible? SAFE will allow to manage permissions at key/value level? How are you planning to implement the comment section?

1 Like

I’m wondering this too! There are different methods and my thinking has been to follow the traditional website with curator model for now, though others have said they prefer something that is truly decentralised. Anyway, this would be a great SAFEpress discussion, but not one for this forum. If you would like to pick it up over on the SAFEpress Google group (we could do with the activity! :-)) by all means post your thoughts and questions over there.

2 Likes

The decentralized way would be to define a rule-based forward referencing system, like I proposed in this post (under Linked lists): Public Ledgers and Proof of Transparency on SAFE

1 Like

Is the SAFEpress trello board currently empty or is it just me?

it’s empty to me too.

I’m not part of SAFEpress but they probably need to grant you access to the board.

right @happybeing :smile: ?

Maybe you need to be logged in? It’s certainly not empty! :smile:

Edit: I made it public, so you should not need permission from me. Please let me know if you try when logged in.

I was logged in. It’s still empty. I only see the SafePress description, then below that are two tabs: Boards and Members. Boards is just a white rectangle ^^

1 Like

Ok thanks, I’ll look into it. In the mean time, if you want me to try sending you an invite, which should work, please PM me your email. @DrrT @anon20895533