SAFE Apps are programs which run on the user’s device (client) and access data stored on the SAFE Network (decentralised server). Input of user credentials and authorisation are handled by a separate program, the SAFE App Launcher, which passes authorisation to the App so that it can access the network.
To create a SAFE App you will need:
-
access to the SAFE Network, either via the API or as a virtual drive mounted on the user device file system.
-
a development system (programming tools) that can create programs for all the devices (e.g. PC, tablet, smartphone) and operating systems (e.g. Windows, OS X, Linux, Android) you wish to support. This FAQ does not discuss selection of a development system, which is often a matter of personal choice, and because a very wide range of possibilities will be available. You will need to make sure your choice can access the SAFE Network (see below), and create Apps for the target systems you require
SAFE API
The following is my understanding based on MaidSafe-API, MaidSafe-Drive, MaidSafe-Network-Filesystem and MaidSafe-Ports repos, and some help from the devs. Errors and omissions are all mine! ~ @happybeing
The API is primarily in Rust (and some low level libraries in C++), a range of other languages are also supported (see Ports below). An alternative to using the programmatic API is by accessing a virtual drive mounted on the client device file system (see MaidSafe-Drive below).
Overview of SAFE Network API:
-
MaidSafe-API: enables an App to register a session with the network (via the SAFE App Launcher) and retrieve a list of directories it is authorised to access (using
DirectoryInfo
objects). See MaidSafe-Network-Filesystem. - Maidsafe-Network-Filesystem: allows the App to treat SAFE Network as a file system using a RESTful style API (GET/POST/PUT/DELETE). Access is obtained via the RegisterSession API (see above) and via the SAFE Launcher, which handles user credentials and network authorisation. The MaidSafe-Network-Filesystem is different from the virtual drive provided by MaidSafe-Drive.
- MaidSafe-Ports: contains support for several languages, with API wrappers to the MaidSafe-API & MaidSafe-Network-Filesystem from languages other than Rust.
- MaidSafe-Drive: provides access to SAFE Network storage as a virtual drive mounted on the user’s device operating system, accessible through standard file system library calls (for Windows, OSX, Linux) as supported by the development system used to create an App.
- SAFE API Documentation & Examples: documentation, including sample code for each function and data structure, can be found for the entire API within the ‘docs’ folder of each MaidSafe library. This documentation is included within the source and automatically generated by the Rust cargo build system (and code samples checked by the Rust compiler).
-
SAFE App Examples: there is no sample code at present, but some helpful information. At least one complete sample App will be provided in source form to help developers understand the API from a working example written in Rust. In the mean time, we have:
- examples documentation showing how to set up a local test network.
- an old video showing the UI for typical App functionality (authentication, file sharing, messaging etc.) though the plan is that authentication will happen separately in the SAFE App Launcher, which will pass authentication to individual Apps.
- SAFE App Builder Documentation: there is an App Builder section in the System Docs which acts as a starting point for access to all the resources available to build Apps on SAFE Network.
SAFE Software Stack Showing API
This diagram is from the MaidSafe blog: What Is The Architecture of the SAFE Network
What Tools and Languages Can I Use?
You can use any tools for the platform(s) (mobile, tablet, PC etc.), and operating systems you wish your App to run on.
Rust
The SAFE API libraries are written in Rust, so if you want to use Rust that’s a no brainer. Rust is a very new language (v1.0 launched in May 2015) so in the early days the build environments are limited, but some options to consider for UIs are:
- KISS-UI. (happybeing evaluation status: sounds promising but not tried yet)
- PistonDevelopers/Conrod (written in Rust). (happybeing evaluation status: examples working)
- Qt5 via qmlrs. (happybeing evaluation status: example working)
- Rust GTK (thanks @Liamsi)
*If you have feedback on any of the above please post it on this thread so I can incorporate or refer to it.
Other Programming Languages
MaidSafe provide wrappers for different languages for the APIs (in MaidSafe-Ports), or you can write your own wrapper for languages that are not supported (and share it by submitting a git pull request to the MaidSafe repo!)
“Web” Apps
There’s no reason you can’t build true web Apps on SAFE by writing them entirely in HTML and JavaScript to load directly from SAFE Network and run in a standard web browser, either from the user’s SAFE Drive, or via a SAFE URL if the browser has a suitable plugin to access SAFE Network URLs directly, and to authenticate the use for PUTs to their private storage.
Such an App would be stored entirely on the network and run just like a normal web service, but without a server, so they are entirely secure from data theft, snooping, malware etc. and load fast, directly from a user’s SAFE storage.
There is no JavaScript library to support this yet, but who knows, maybe someone is working on one ;-). For simple Apps it wouldn’t be hard to write yourself, because you can use the SAFE REST API very much like a normal web App/service.
Can you help?
This post is editable by anyone, so please fix any errors and omissions, and update it as things change.