DataKit makes it easy to add web backends to your apps!
Objective-C JavaScript Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Don't reinvent the wheel every time you need a web backend for your apps, add one with DataKit in minutes!

Just spin up a server with node and MongoDB installed, integrate the SDK into your app and you are ready to go! Have a look at the SDK Docs. DataKit requires iOS 5 and ARC.

Author: Erik Aigner @eaignr

Server Configuration

Make sure you have node with npm and MongoDB running on your server. Setup your node project and install DataKit.

npm install datakit

Then create a file run.js (or any other name you prefer) containing the following:


Now start your node app and DataKit will present the following warning

WARN:  No secret found in config, generated new one.
       Copy this secret to your DataKit iOS app and server config!


       Terminating process.

Copy the newly generated secret and put it in your DataKit config. Now you can also specify additional config parameters. Although only the secret parameter is required, you should also specify a custom salt.

  'secret': '66e5977931c7e48aa89c9da0ae5d3ffdff7f1a58e6819cbea062dda1fa050296',
  'salt': 'mySecretSauce',
  'mongoURI': 'mongodb://<user>:<pass>@<host>:<port>/<dbName>',
  'port': 3000, // The port DataKit runs on
  'path': 'v1', // The root API path to append to the host, defauts to empty string
  'allowDestroy': false, // Flag if the server allows destroying entity collections
  'allowDrop': false, // Flag if the server allows db drop
  'cert': 'path/to/cert', // SSL certificate
  'key': 'path/to/key', // SSL key
  'express': function (app) { /* Add your custom configuration to the express app */}

Integrate the SDK

Link to DataKit and import <DataKit/DataKit.h>. Now we only need to configure the DataKit manager and we are almost there (this needs to be done before any other DataKit objects are invoked, so the app delegate would be a good place to put it).

[DKManager setAPIEndpoint:@"http://localhost:3000"];
[DKManager setAPISecret:@"66e5977931c7e48aa89c9da0ae5d3ffdff7f1a58e6819cbea062dda1fa050296"];

Start Coding

Here are some examples on how to use DataKit. This is in no way the complete feature set, please look at the documentation. You can throw almost anything at DataKit.



// Saving
DKEntity *entity = [DKEntity entityWithName:entityName];
[entity setObject:@"Erik" forKey:@"name"];
[entity setObject:@"Aigner" forKey:@"surname"];
[entity setObject:imageData forKey:@"avatar"];
[entity setObject:[NSNumber numberWithInteger:10] forKey:@"credits"];
[entity save];


DKQuery *query = [DKQuery queryWithEntityName:@"SearchableEntity"];
[query whereKey:@"text" matchesRegex:@"\\s+words"];

NSArray *results = [query findAll];


// Saving
DKFile *file = [DKFile fileWithName:@"BigFile" data:data];
[file save];

// Loading
DKFile *loadMe = [DKFile fileWithName:@"SomeFile"];
[loadMe loadDataInBackgroundWithBlock:^(BOOL success, NSData *data, NSError *error) {
  // Invoked on finish
} progressBlock:^(NSUInteger bytes, NSUInteger totalBytes) {
  // Track progress

Donate if you like it!

Click here to lend your support to: DataKit and make a donation at !


  • Add some sort of ACL and user authentication instead of shared secret
  • Add DKChannel class for push notifications and async messaging