SAFEpress: A Web App that builds websites/blogs on SAFE Network

UPDATE: This proposal is now a live project, find out more at safepress.io and github.com

Ok folks, anyone wants to collaborate/offer feedback etc on an actual project in this direction let me know. I have started to formulate a plan, but as its almost certainly too ambitious for me to carry to conclusion alone, I’m looking for folks who are eager to get their teeth into a collaborative project:

Essentially I think I know enough to start outlining how to build a CMS/blog that works on SAFE network using the Web browser with simple SAFE REST API accessible in JavaScript via a plugin (to be built by MaidSafe I hope ;-)). My plan is:

  • implementation will use HTML/CSS/JavaScript served from SAFE, and gradually
  • prove this in principle by stages, for example:
  1. create the data (web pages/blog posts/comments) manually in CouchDB, 2) adapt an existing CouchApp CMS/blog to use this data and provide a website/app served from CouchDB, 3) write scripts to create additonal data structures and store in the DB alongside the documents. (Additional indexes will be needed by SAFE to enable the client to use only the REST document API, and replace any code that uses more sophisticated CouchDB database functions).
  • extend the web app to provide document creation/edit/update/delete that also updates the indexes, first for posts/pages, then for comments. This will need to take account of ownership/write permissions on different elements (document types and indexes) and have these reflected in the UI that the web app provides, so it will appear differently for the website owner, an author, and a visitor (cf. WordPress or similar CMS).
  • once the SAFE REST API is available in a browser plugin, switch from http: and CouchDB to safe: and SAFE API

Well, that’s a very brief outline. You’ll see that there’s a mix of skills, and not necessarily just programming. I’ve focussed on that, but as a web app, it would also need design skills (graphic, CSS etc) documentation and so on, so if you have a hankering to be involved please get in touch whatever your interest or experience.

I can see this evolving both into a Web App that builds websites, and also a template for a JavaScript framework that bridges the gap between existing old www, web app frameworks, and the SAFE Browser Plugin API, so making it easy for people to code / port their own websites rather than use this CMS.

If this gets to be something that others use and starts earning Safecoin rewards we’ll get everyone who contributed together to agree some way to divide any rewards. I don’t want to focus on that now - at least not until it looks like there’s a team building something, though am open to it if that’s what people want.

Thanks to all who helped me get to this point - you know who you are :smile: Let’s see if it can get to the next stage!

How To Get Involved

Head over to github, clone the repo, PM me your email and ask for an invitation to Trello (Trello).

For anyone just starting on this topic, here’s a couple of earlier threads with some background that lead me to this point:

21 Likes

Thanks a lot for your work. I understand Just enough to recognize the database challenges. A work around is very much needed and I am looking forward to using a forum engine on the SAFE network!

1 Like

This would be so useful. Make sure you add shopping cart or purchase capabilities! Everyone could have a website :stuck_out_tongue_closed_eyes:. Would it be a free service and simply earn safe coin based on visits(gets)?

Hi @happybeing you can always count on me for feedback. Maybe you want to take a look at this:

Unfortunately the DB stuff is over my head for now.

2 Likes

The plan is that this will be a free app (also open source). I just added a repo: GitHub - happybeing/safepress: SAFE Network website creator - CMS / blog. A SAFE Web App that creates websites/web apps on SAFE

3 Likes

There is this shoppingcart named Ecwid.com it’s basically copy and paste and you have a shoppingcart

bitmerchant could also be code to accept SAFEcoin

1 Like

As a help, I generally setup a few free handy things when I set up a repo. To check

  1. Travis.(linux and soon osx CI)
  2. Appveyor (Windows 32 and 64 CI) [ we switched to jenkins for SAFE as appveyor too slow for our sprints, but its very good and will get faster]
  3. coveralls.io - code coverage (syncs with travis fro auto coverage checks)
  4. reviewable.io for code reviews
  5. waffle.io (turn github issues into a wee project plan)

Hoep that helps a bit, you can see our .travis.yml if it helps and go back in commits to see appveyor as well.

4 Likes

Thanks David, I’ve updated the collaboration todo to point to this :slight_smile:

1 Like

I see where you’re going here and I’d be happy to help where I can. Sounds like you’re basically after writing a CouchDB based CMS (or?). Have you seen Kleks (GitHub - markuso/kleks: Kleks - Pure CouchDB based CMS as a Couch App using Kanso with CoffeeScript and Stylus. Supports multi-site setup and Markdown authoring.)?

I’ve not used it. But I’m downloading now to check it out. At first glance it looks like a fork of that for Safe could cover a lot of the basics that are needed for the project, and just need some adaptation for the SAFE protocol once everything is up and running.

Another alternative is a setup of wordpress (as any couchDB implementation will need a server to sync to at some point also, we’re not really losing much there); but I’ve been working with a plugin for that called staticpress (StaticPress – WordPress plugin | WordPress.org) which’ll let you easily spit out static HTML files / structure and adapt it to any domain. So could also be ideal for transferring sites to safe. (right now the plugin isn’t the best; but it’s a good foundation).

The joy there is that wordpress is almost defacto standard for blogging and is super powerful and has a great community. It just needs to be adapted for SAFE, which staticpress goes a long way towards.

2 Likes

@joshuef I was hoping you’d be interested :wink:

I’m thinking along those lines yes, but hopeful to only make use of the features of the REST API, and do the rest using structured data and indexes that are updated using client side code. I believe this can be done without needing a database on the client, and in a way that allows users to post data to the website, but without being able to mess up the integrity of website data. So I don’t see this as needing a server, at least not in the traditional sense, and so no need for synching, in the normal sense of this.

I do think that WordPress is a good model, so will be very interested in your input on this. I’ve used it to build several websites for myself and others, so I know the basics of deployment and customisation, and something of how it works internally. I think we can do better than creating a static version of a CMS website, but some of that kind of approach might be useful, so I’m very keen to learn from you about what can and can’t be done with that approach.

I envisage us taking existing CMS based sites, WordPress, Drupal etc. and writing tools to import them into SAFEpress. Static generators are great, but I’m aiming for the next step - web 2 interaction directly on SAFE. This, plus the ability to import is what will make this a killer app in the short to medium term. It would be amazing if if can grow into something as capable as WordPress in the longer term. Browser based web apps is still a pretty good approach to client side security, so I think it could have a decent lifespan, as well as the other development and deployment advantages of web apps - anything written to run in a browser.

Let me know how you get on with klerks. I found two or three CouchDB CMS/blog apps. Some may have the same root, so you and/or I need to evaluate them and decide whether to use them as a starting point. One is the tutorial from the O’Reilly CouchDB book which is available online. I’ll PM you my email so we can continue offline and then email you links to what I found. I have a big list of CouchApps, not just CMS/blogs. I think most are not much more than demos, but useful all the same.

We can use email and slack. @eblanshey is working on similar stuff (to build a Discourse like forum), so chatting on slack will make it easy to share what we’re up to and what we’ve learned. Maybe we should start a webapps channel, I’ll suggest it to Francis.

I agree totally about wordpress. It has been revolutionary. The quality of sites I’m able to quickly produce and sheer number of coders available to help (I’ve happily paid them) me when I’d get stuck is unheard of.

2 Likes

I’ve been pondering this a wee bit just now.

I’m not entirely sure what you mean there. We’re not able to have any sort of ‘server’ response for SAFE at this time. So traditional things like that require server resources aren’t really an option for sites directly on SAFE right now (… or?).


If we’re looking at something serverless, I think it makes sense to move to something in the browser, like PouchDB (which can sync with couchDB / databases in general), but will operate in the users browser via IndexedDB or WebSQL (depending on the browser).

I think we could make a database available to many users via NoSQL and saving it to SAFE as json files etc, that anyone with write access can update.

And, if what we’re looking for is to generate a site for SAFE, then (as is my understanding), it has to output static content for each page (and I think this would be preferred, as opposed to using JS based routing).

We have a few options if we’re going down this road:

One option considering both of those things is perhaps to build a Chrome Application, as this gives us file system access, and an easy way for users to set it up, whilst still being essentially a JS app.

Another alternative would be to a nodejs package that would essentially start a local server for the user. If we’re using PouchDB and browser based databases then that would be enough (and should be able to be converted for chrome apps also). Node has filesystem access, so that would allow us to output to SAFE also.

The third option, that I’m not so hot on is building something SAFE specific in Rust or so, that would do something similar through an actual app. But I don’t even know where to begin there, so I’m leaning towards some combination of the first two above.


If we’re happy with requiring a database somewhere, there’s keystone.js (http://keystonejs.com/) which uses mongoDB could be a good fit. This could be synced to any number of cloudDBs for easy sharing/access to the CMS for multiple users. This’d require only some small tweaking to actually output a site for SAFE. But there again we’re back into adapting / generating from current frameworks

Hi @joshuef, I was thinking like you about this for some time, but I no longer think it is the case. I think we can do most or all WordPress type functionality as is - not static. There are areas I haven’t cracked yet or where there will be compromises (search is one, but there will be ways to handle this I think).

Just in case I’m going mad, you might like to throw some test challenges at me to see if I can answer them. If you like send me an example you think can’t be handled and let me see if I can figure out how to do it!

You might like to check my next post first though…

1 Like

I’ve written an Outline Design for SAFEpress and would appreciate some eyes on it and feedback (here or by submitting comments on github - the latter might be easier for me but either is fine). See:

2 Likes

I’m taking a fair bit of interest in this because my website is mainly wordpress based and if I can just export it there and import it onto SAFE that would save me a whole lot of trouble.

5 Likes

Import or export my wordpress site would be so far beyond what my expectations would be with this at the start…but if that could be done I see the majority of end user websites (Wordpress is by far the most popular) making the import to SAFE over night.

3 Likes

Which in turn would mean a good chunk of the web population converting to SAFE and a hit to traditional web hosting and ISPs.

On the import/export wouldn’t you just need to define the differences between the two and then design a translation matrix. I mean ultimately we’re talking about files here. Every CMS has SOME kind of system. They store pics in one place, blogs in another, informaton in another, etc etc. So even if SAFEpress organized things differently wouldn’t it be a case of “Find it here and put it there and label it like this.” If we know how wordpress labels something, we know how safepress labels something, we know how SAFE needs to be organized and we have the user’s data somewhere then can’t we design a translation matrix that sorts it all for import/export?

5 Likes

Take a look at StaticPress. You can export it easily to a folder, automate the URL rewrites etc. Right now it’s only operating via a ‘generate’ button, but I’ve been working on a fork that binds to updating posts/pages etc so the entire experience would be seamless.

In terms of automating putting an existing WP build on SAFE (without the generated pages / server / search functionality), this works.

Even stuff like a homepage showing latest posts can be updated, although right now you’d simply have to save the post again.

1 Like

@happybeing static search is still possible. Again, I’ve been toying with various search options, and depending on the scale they’re viable.

Building a sitemap/index json and searching this with JS is one option (or a variation here). With small to medium sites, this would weigh in at <1mb and allow instant fuzzy search. (quality of the search results returned is the main problem right now).

1 Like

Will one be able to build dynamic websites on SAFE and if so now will we rerig them to work on SAFE? Say we converted a wordpress blog to be static how would we reengineer it to work dynamically again on SAFE? (This could apply to any CMS).

I’d also like to point out there is an company in the works creating an A.I. based web development service called “The Grid.” Perhaps something we should keep an eye on during all this. A.I. based web development might be another emerging technology in the near future.