No beginners app on dev hub

Hi guys,

looked around on the dev hub site for the website starter kit, but there isn’t one. It has been removed?
Maybe something new I missed out?

Hi Aquaphobia, yes the starter tutorials have indeed been removed from the devhub site. They were written to work with the Alpha 2 network, which you may have read was taken down in November as we had moved onto local and shared vaults. See posts here and here for vote and discussions on Alpha 2 takedown.

The intention is to rewrite the tutorials to include the latest updates, however we are in a time of flux at the moment with Vaults Phase 2 and several other changes in the pipeline, so it didn’t make sense to rewrite multiple times. In the meantime, please do reach out if you need some guidance or have specific questions, the team and the community surrounding us will do our best to answer and help.

1 Like

Thanks for your answer! I want to know what is the best way to start with a website on the safenetwork. Folder structure, establishing a connection to the network etc…

1 Like

Excellent! By safenetwork do you mean the current shared & local vault setup (see post here)? Or do you mean once the network is actually live?

1 Like

I mean both or is it not possible to do so? I mean when I develop a website for the shared/local vault setup is it possible to run it later on the live network too?

1 Like

I would imagine they will both be very similar. Just note that the CLI is still in active development, as is the SAFE Network App, so no doubt there will be tweaks here & there on our road to launch so you may get changes in commands that are run. I would imagine the file structure that you upload would be the same for both though.

For the current setup I’d recommend using the Shared vault. The link I posted in my comment above gives some instructions on where to download the vault_connection_info.config file from and where to save it, depending on your platform. But the steps below are valid whether you are using a Shared or Local vault.

You may have a preference over using the CLI or the SAFE Network App from then onwards to actually connect - if you want to use the CLI the repository readme is excellent and comprehensive. Follow that to start the authenticator, create an account, login and authorise the CLI. Once you’ve done that there are instruction in there to push your data up to the vault, how to give it a readable NRS, and how to modify it. You can then access that site via the latest SAFE Browser, download from its repository here.

If you feel more comfortable using the GUI of the SAFE Network App then you can grab the latest version here. Make sure you have your config file in place before launching the app and from then onwards it’s hopefully intuitive to create an account, or log in with a previously created account. Launch the SAFE Browser from within the SAFE Network App and enter the URL of a site you want to create - if it’s not already taken then you will be given the option to register it. Once registered you can upload your website files and watch it come to life.

I think I’ve just about caught all the main steps I can think of!

I’m not a web developer so I’m not qualified to give you advice on how to structure you site files, my test site literally consist of an uploaded folder containing a jpeg and a basic index.html to display that jpeg. Very basic :smiley:
Maybe someone else who has created a site with a bit more complexity could chip in here & give you some pointers.

Hope that helps!
Some recent discussions on Shared vault sites here

2 Likes

Ok thanks anyway for your detailed answer! :grinning: I will try it out for sure

1 Like

I tried right now to create an Account via the GUI and I got the following error
Authd Failed to read certificate from …
I put my config file in place is there something else to do?

If you are building a static website the above is probably all you need.

If you want your website user to be able store data on SAFE (ie a web app) you will need to be able to authorise your app with the network. This can be done now but it is not documented. Nor are the APIs for storing data, and many are still incomplete.

You can still build an app which lists and uploads files stored in the user’s account for example (with some limitations). I’ve done this, although it isn’t a simple tutorial style app I’m afraid.

If you want to do things like that, myself and others can help when you get stuck but I expect the browser APIs will be expanding again, and that documentation will be added for them before too long. That’s my new year’s wish anyway! :star:

My API related code is in a library: safenetworkjs. This was written for alpha2, but recent changes in the fleming-apis branch show how to authorise with the network, list and edit files, so if you are ok learning from other people’s code I can point you to the bits that are relevant, or you could just look for files that have been worked on within the last four months when I started updating it from alpha2 to Fleming:

1 Like

Thanks for your replies! I tried now to upload my website but I cant register my url. I am ask to create the site I wanna have but then get the error: Not found - Nothing has been published at this address, no page or file can be found

No one can help me out?

I suggest you explain in more detail what steps you have taken, what versions of the utilities you are using (check they are up to date here), what command you issued and the error you got.

2 Likes

Put my config file in place downloaded the latest browser and tried to register a site, but no success got the error from above. The Browser version is 0.15.4-beta

Whenever I press the button “create site” I get this error

Are you also running the SAFE Network App (v0.0.5-beta.1)? Or the SAFE CLI (v0.6.0) with the Authenticator daemon?

To register a site, you need to create an account and log in. You can do that using the SAFE Network App (currently, only the beta version includes the Authenticator daemon) or SAFE CLI (follow the instructions here to install and start the Authenticator daemon using SAFE CLI v0.0.6).

3 Likes

Thanks a lot it works now

1 Like

Now I get the error : Cannot read property ‘initialiseApp’ of undefined. So I am not able to connect to the safenetwork it seems…

Tried to connect to the network with:

$(document).ready(async function () {
  /**** initialize SAFE app and data sets ****/
  await safe_authoriseAndConnect();
  //await initialzeData();
});


let safeApp;

async function safe_authoriseAndConnect() {
    let appInfo = {
        name: 'maidsafe',
        id: 'net.maidsafe.web-app',
        version: '1.0.0',
        vendor: 'Maidsafe'
    };
    safeApp = await window.safe.initialiseApp(appInfo);
    console.log('Authorising SAFE application...');
    const authReqUri = await safeApp.auth.genAuthUri({}, {
        own_container: true
    });
    const authUri = await window.safe.authorise(authReqUri);
    console.log('SAFE application authorised by user');
    await safeApp.auth.loginFromUri(authUri);
    console.log("Application connected to the network");
    const mutableDataInterface = await safeApp.auth.getOwnContainer();
    console.log("container has been created");
}

That’s the old API you are trying to use with latest Browser, we don’t have yet tutorials in dev hub for the new JS APIs, but you could look at some of the tests we have here in safe-nodejs repo if you are happy to learn from there: https://github.com/maidsafe/safe-nodejs/blob/master/test, you may find some the code here helpful too: https://github.com/bochaco/electron-neon-safe/blob/master/renderer.js (not sure if the project itself still builds and runs but the code should be close to current state of JS API)

1 Like

Ah Ok will give it a try :slight_smile: Thanks for your help guys!

1 Like

Also see my post above for up to date code (note as in the post that only the most recent commits to Safenetworkjs relate to the Fleming APIs).

1 Like