1

The last week i started working on a small startup company,which is developing an iOS app. My position in the team is backend developer. I spoke with the mobile developers of they told me that they use Stackmob Backend-as-a-Service provider for the mobile application. Now,as a backend dev,i have to create a custom php (using CakePHP framework,if it matters) API which will store all data exchanged in the mobile app (in a MongoDB database,if it matters),run some algorithms that are required (including taking an input from the mobile app and then returning back a response,after filtering the input via the backend algorithms) and implement a user-to-user messaging feature for the mobile app again.

As you understand,the php part will be totally invisible for the user,it only contains algorithms.

Now,i'm a bit perplexed at the Stackmob part. How can i "connect" (or what?) the stackmob platform with my backend php algorithms,so that the mobile app makes use of both? I mean, the Auth users feature for example is powered by Stackmob. But how would i save into the database (into our infrastructure) the users' info? And also manage users' data and much other stuff? As they explained me, the iOS app has to use both stackmob services AND our custom algorithms (via our private API) which runs on our servers..

Please,any tips about anything about that would be highly appreciated,or anything that could help me understand how should i work.

Thank you in advance guys!

Kostas Livieratos
  • 965
  • 14
  • 33

2 Answers2

1

I am working exactly on that, writing PHP cron daemon to import third party data and upload to Stackmob. They have a PHP library and I wrote a simplified shorter version.

The whole database communication breaks down to simple CRUD interface. Good luck.

EDIT. The code I am working on has the following structure.

  • 3 Storage objects: inStore, locStore, outStore. Incoming data, local Cache and outgoing. See my locStore code here.

  • 3 Proxy objects: inProxy, locProxy, outProxy to talk to their corresponding stores. They provide my app specific methods as they have access to my config, where the Stores don't.

  • Config object to deal with config-related methods, used by the proxies.

  • Top level Data Mover objects that only talk to the Proxies.

Community
  • 1
  • 1
Dmitri Zaitsev
  • 13,548
  • 11
  • 76
  • 110
  • awesome! if you have also any other code that you think it could help me,send it also:D thank you!! – Kostas Livieratos Dec 14 '13 at 19:25
  • 1
    Just updated the Gist with new version. What other code do you need? What kind of task to perform? – Dmitri Zaitsev Dec 14 '13 at 19:31
  • What i need to do is to find the optimum way to exchange users' data between our MongoDB database and stackmob's users' datastore,in order to run some app-specific algorithms. Actually,is there any chance i could "sync" anything between stackmob and our servers? Or even use stackmob only for push notifications and run anything else on our infrastructure..? what do you suggest? – Kostas Livieratos Dec 14 '13 at 19:37
  • 1
    See my EDIT about what I am doing, sounds similar to what you want. I only move to Stackmob the part of the data I need in the form I want (denormalized) but you can surely sync if you like. – Dmitri Zaitsev Dec 14 '13 at 19:54
  • Now i think i can see things way more clear! So,i'll manage (store,filter,process or whatever i need) all mobile app's data in our infrastructure and i'll just send to stackmob what i need for push services etc? great,seems simpler now! – Kostas Livieratos Dec 14 '13 at 20:51
  • @koslibpro BTW if you are happy with the answer, would you awfully mind accepting it? – Dmitri Zaitsev Dec 15 '13 at 01:30
  • done! thanks for your help also. i may come back if i need anything else in the future! – Kostas Livieratos Dec 15 '13 at 11:03
  • @koslibpro Sure, you can also post your code in Code Review and comment here. – Dmitri Zaitsev Dec 15 '13 at 12:08
0

It looks like you can use StackMob's REST API from your PHP to access the list of users. The full API is described https://developer.stackmob.com/rest-api/api-docs#a-rest_full_api_reference, and you can get a list of users with GET http://api.stackmob.com/user.

But exactly what you need to do depends on your requirements. It also looks like StackMob allows you to implement your own code on their platform, but it has to be written in Java, Scala or Clojure (ie it runs on a JVM). I suspect this might be a much better idea for you to investigate, that to be trying to configure your PHP to talk to their API...

craigmj
  • 4,827
  • 2
  • 18
  • 22
  • So you propose to write the backend in Java and implement it into Stackmob instead of PHP? – Kostas Livieratos Dec 13 '13 at 22:10
  • Depends on what you want to do, I guess, but it does seem like it might be easier. At least I'd investigate that before heading into a PHP dev, because you might need to poll StackMob to find out when new events occur, whereas if you're running inside StackMob, you might avoid polling... just an idea. – craigmj Dec 14 '13 at 16:06
  • okay,gotcha! I'll consider what you suggested me and i hope to find the optimum solution. thank you :D – Kostas Livieratos Dec 14 '13 at 18:55