Project, Types and Views
All data in SketShDb is organized within so-called projects. A project is a closed collection of data of different types. When sharing data with SketShDb then you're always sharing projects. Templates and backups are created regarding projects (that's why they're commonly called "project templates" or "project backups"). Technically a project is equivalent to a "database". A project may contain data of multiple, different types which somehow belong together and, in most cases, are related with one another.
Types and type fields
Before you can start entering records, you need to define how your different types of data records will look alike. A record type ("type") can be composed of any number of fields, which by themselves each have a field type (such as "text", "number", "date", ...). Each record type is defined by composing its input form out of fields of the different field types.
Record type examples:
|This project||would contain record types|
|Address book||Person or contact|
|booklist||book, genre, publisher|
|password list||password entry|
|restaurant list||restaurant, type of food|
Each record type consists of one or more fields (e.g. a restaurant record would probably consist of name, address, type, price level, photos, comments, rating, ...) which make up an input form. When configuring a type, you automatically define a record type by composing its input form out of different field. These are the different field types:
- Text (single oder multi-line)
- Date (date, time or datetime)
- Switch (yes/no)
- List with single selection
- List with multi-selection
- Reference to another type (single, multi)
- User-selection (single, multi)
- Phone number
- Email address
- Audio messages
- Separator (For a better user experience you can structure the form by inserting one or more separators)
|Type and their fields examples: This record type||would contains the following fields|
|Person||First name,Last name,Address,Phone number,Email address|
|Book||Title,Author,Release year,Genre (e.g. referencing a record type "Genre"),Publisher (referencing type "Publisher"),Page count, etc.|
|Password entry||Title,Website url,Username,Password,Notes|
The input form of a record type shows the data of exaclty one record. In a restaurant database (or any other database) you most probably want to store multiple records, therefore you need one or more views: Views show multiple records of one record type. Currently there ist only one view type in SketShDb: List views. (Later on, there might be others like a map view oder table view) Within view administration you can configure many features for your (list) views:
- Which field should be shown in the list? (layout)
- How should the records be sorted?
- Which fields should be queried when entering text in the search field?
- Should the list be divided in sections?
- Should the list be filtered to a subset of records?
- Which color shall the list be presented in?
- If you are sharing the project:
- What are other users allowed to do when viewing the list (e.g. view or edit records, add comments or pictures, etc.)
- Who should be allowed to open the list view?
To allow for fast creation of similar lists, you can copy view configurations.
The project on your mobile device can be synchronized with other instances automatically, keeping any device up-to-date with changes made on other devices. (as long as the device is connected to the server, e.g. via internet)
- The project on your or a friend's mobile device
- A database on a server, desktop or laptop computer at your home or somewhere else connected to your device, supporting the Apache CouchDB1 Sync Protocol like Apache CouchDB or Couchbase2 Server.
- A database "in the cloud" either provided by a ready-to-use Service like IBM Cloudant3 or installed on your own cloud server.
Unfortunately there is no "direct" (without a server in the middle) and automatic replication between two mobile devices, because this would require a permanently opened network port on at least one of the devices and publishing your device IP via (dynamic) DNS. This procedure is not very feasible and would also be a major security risk. For this reason we're planning to supports a feature called "LiveSync". This function will let you synchronize projects manually to another device when both devices are connected to the same network.
Local server instances
A compatible database server can be installed on any computer on most common operation systems by using freely available software (e.g. Apache CouchDB or Couchbase Server). Server access can be configured under
Settings / Configure server. The sync/replication settings for each project may be configured under
replications in the project's configuration. Using the
Share... button you are able to send the connection data for a server to a friend. Your friend will be able to connect to your project by simply tapping a link.
If you can enable internet access to your server under a static address (either via static IP or DNS) you can sync at any time when your mobile device is connected to the internet. Your server would then act as your own cloud server without having to pass your data to anyone else!
TAKE CARE: ALWAYS enable HTTPS when setting up a database server, especially when the server will be connected to the internet, even though installation and configuration are more complex. When not using SSL anyone with network access to your server would be able to read your data! A self generated certificate is better than none! Installation, configuration and operation of local database servers, software and network configuration is at your sole risk and cost!
Maybe the simplest way of syncing your data is using a ready-to-use cloud service like IBM Cloudant. In this case you do not need to install software, HTTPS certificates etc. but this solution also comes with some drawbacks:
- Your data will be stored "in the cloud" (if you're concerned about that)
- There might be extra cost. (At the time of this writing, there is a free plan, which will throttle down if there are too many requests within a short time interval.)
Naturally, you can choose any other cloud service that offers either pre-installed instances of CouchDb compatible servers or lets you install the necessary software.
Each cloud instance must be configured just like any local instance under
Settings / Configure server and afterwards will be available to configure replications or connect to existing projects.
Server instances typically can host any number of databases (unless restricted by service vendor or server resources). A database on a server is equivalent to a project in SketShDb.
Backups and templates
From a technical perspective backups and templates are very simiar: Both are archives containing the configuration and (partly) the data of a project. They differ in some details and expecially in their use.
The intention of backups is saving a project to protect against data loss. Replications are not equally suitable for that purpose because they get synchronized incrementally and instantly in most cases. That would mean if a user deletes a record by mistake, the record will also be deleted in the replicated database. You can use backups to exchange projects between your OWN devices (i.e. any device registered under the same email address) for example by email. Nevertheless, using a replication for that purpose would be better because it will keep your data in sync automatically. Backups always contain ALL data of a project and the data records are signed, i.e. only admin users of the project will be able to restore the backup without errors. If a project has been restored from a backup the project instance may be synchronized with a server instance of the same project. (Both projects are the same.)
The purpose of templates is to only store the structure of a project, not the data. The template can be passed to any other SketShDb user who in turn can create a new instance of a project with the same structure. Sometimes the "structure" also contains some basic data records, therefore you can choose to include data of a subset of your types when generating the template. When generating a template all signatures get removed which allows any user to import the template but prevents synchronization between the newly generated and the original project.