The steps I follow at the moment (they may become obsolete when the new Authenticator and safe_client_libs get released) to create a SAFE web app are the following:
- Install nodejs and create the skeleton of the app with create-react-app
- Add safe-js module to the app: npm install safe-js --save
- Place the following code in your app:
if (process.env.NODE_ENV !== 'production') {
require('safe-js/dist/polyfill')
}
- Place your code which calls the safe-js functions, e.g. window.safeAuth.authorise(app).
- Run the SAFE Launcher.
- Run your app: npm start
- Open the SAFE Browser, and select from the menu: “BeakerDev” → “Toggle WebSecurity for new tabs”
- Open a new tab on the browser, and go to your web app’s URL, e.g. http://localhost:3000
You might need to manually patch the polyfill.js located at node_modules/safe-js/dist/polyfill.js if you invoke window.safeStructuredData.readData (see issue 21)