How to use database on Safe?

I am trying to create a website and is currently done with HTML and CSS. I read from some posts and someone said that SAFE can already be used like a key value database, is there any guidance document or tutorial links that I can learn for further implementation?

I don’t have time to direct you (actually I seem to have managed a bit :slight_smile:) but the main area for this is “Mutable Data” so you can start to look at the API documentation on that, and maybe dig into some apps /website code (several published on the community forum) to see how different people are using it.

Specific things to look at:

  • Safe CMS, a desktop CMS that published to SAFEnetwork
  • Safe API etc (under Docs)
  • my SAFE Web API code which does quote a bit with Mutable Data and I hope it’s fault clear, well commented (feedback and questions welcome BTW)

Hope that helps - keep asking where you need help and people will answer when they can. Good luck :slight_smile:


@happybeing Thanks for the tips. Anyway I have 2 problems:

  1. The Safe Web API code link which you gave is showing that page not found.
  2. In the SAFE Network API page, there are a few webapp example that demonstrates to do several things. However, where do I place the code for it to work? Is there anything I need to download first?
    Sorry that I may asking some simple questions but I am a totally beginner of doing this. Hope you can help!

Hi Jack

I’ve fixed that link and added some usage information to the so please take another look there, but the information is still probably not too helpful for a beginner.

It is javascript would normally be in a ‘.js’ file which is then included in the HTML using a <script> tag. Best way to get started would be to create a simple website and then start adding some basic javascript - not using the SAFE API until you have grasped that. Then start looking at the work of others who are already making websites that use the SAFE API and go from there. My websites are not the best place to start really, because they are more complex than something which is written directly for SAFE (I’m porting code written for other things, so that tends to obscure the bit you would be trying to learn).

Good luck.

1 Like

My site was pretty simple…just the index.html and a .js file, so maybe take a look at that @JackTiew for something basic.

1 Like

You can also take a look at this other one @JackTiew, the app authorises with authenticator and then connects to the network: safe://noleak.pp1

1 Like

Thanks guys. I will try to take a look and learn from it. Anyway which browser you guys use for development? Because I found that there are Safe Browser and Peruse Browser.
Besides, how to use the web hosting manager? I’ve tried to authorise the hosting manager but it just waiting forever…

Hi @JackTiew, you can use any of the two browsers, Peruse browser is still lacking some UX/UI enhancements but it’s fully functional and they both expose the same API.

As per the WHM, the packages we released for it are only for connecting with the live network (not the mock), so make sure you use it with a browser packaged to work with live network as well. Also, make sure you run the browser at least once, and then try to run the WHM. Are you at least getting the authorisation pop-up in the Authenticator?

I’m using peruse browser with localhost right now…
I will let you know when I start to use the WHM

1 Like