Safe network, PHP and mySQL

Hi,

First of all, sorry for my bad english.

I am a web developer in Malaysia and my job is to develop website for my client base on the requirements.

One of my client had ask me to learn about maidsafe and maybe apply into the web development as well.

My question is pretty simple how can i create a normal website that contains like HTML files, PHP files by applying the safenetwork concept?

From what i know from developing website, it require a server to host all your database and files, but if i am using safenet, where are those file storing and where can i access to my database?

So far, i am able to create a plan html site using the safelauncher and the demo app, but when i am trying to upload a php file, it keeps on loading non stop. Eventually the file failed to upload.

Actually did i misunderstand about how safe network should works, or actually safenet only able to create client sided website?

2 Likes

I think somebody is already working on a solution called safepress @happybeing

2 Likes

Hello Sylvester,

welcome to the safenetwork community forum. And please don’t worry about your english, it’s more than fine enough!

To get to your questions:

While safe already provides hosting of static HTML-pages, it is a server-less network without computing capability right now. That means that what you’d usually consider the backend (PHP, Python running on a server) isn’t possible in that manner. However, you can run any code locally (like static-website-renders) and upload the result into the network and make that accessible through the browser or use Javsacript to load other information from the network when the user displays it.

Well, in SAFE, the network itself acts as the database. You can store and retrieve information directly. However it is more like a Key-Value-Store (redis or couchdb) than it is like a traditional relational database (like mySQL). So this requires a different way of approaching your data model. You can see some examples of this in the safe-dev tutorials, in particular the website with comments.

4 Likes

Welcome @peter910921. @lightyear gives a good summary.

Personally, I’ve still not grasped all the threads of this system (key-value store etc) to be able to answer in depth, but if you want to read some of our collective attempts at figuring this out, search the forum for “dynamic websites”.

So while I’m still trying to get my head around the SAFE way of doing this stuff, I’m working on porting a client side backend remoteStorage.js as part of my learning. This is a client side JavaScript backend for talking to self hosted storage, and provides an easy way of building offlineFirst web apps: Apps that work even without Internet, but sync their data to a server when connected. So I am extending it to work with SAFEnetwork.

This is just one way of creating dynamic web apps on SAFEnetwork. It will be more familiar and so easier to get the hang of I think, but won’t take full advantage of SAFE API capabilities (it uses SAFE NFS and not the lower level features) but will cover a lot of use cases very well.

Digging into the tutorial examples as @lightyear suggests will help you understand what else is available by showing you what the low level API is capable of, and will be the way to go for more ambitious and groundbreaking projects.

@Lisa_Brown mentioned I’m working on SAFEpress too. That’s a CMS and a bit big for me to do on my own, but still in my sights longer term and my remoteStorage.js work is aligned with that to a degree.

This is a friendly well run forum with lots of knowledgeable people trying to help each other and the project, so don’t hesitate to ask questions, or be concerned that they might have already been asked.

EDIT: also take a look at @whiteoutmashups’ “App ZERO” which is a stripped DOWN web app which shows how to get started with the SAFE API.

3 Likes