I'm struggling getting my head around writing a server for a mobile app. The app is quite simple and would manly rely on geographic data and some other basic stuff liker users etc. nothing special about that.

What I just can't find an answer to is what I should use when it comes to a Web-API for server/client communication and what relational database system I should use.

I'd just need somebody to draw me a picture about how a server looks like and what options there are (just a few) for the main parts of it. I am not an unexperienced programmer - just one who has never written a server for a mobile App.

  • 1
    You'd probably find an answer if you Google searched "[language you know] MVC REST"
    – thexacre
    Apr 18 '15 at 23:38
  • @thexacre Well I have already some experiance with Java REST APIs but I have no idea what libraries are suitable for relational database models. I wouldn't mind to dig into php as well but it's just that there are so insanely many options when it comes to RDBMS. Apr 19 '15 at 0:21
  • 1
    Your question doesn't mention database modelling or ORM at all, although if you Googled Java ORM I'm sure you'd find several suitable options. I believe Spring + Hibernate is a common stack for developing these kinds of things in Java.
    – thexacre
    Apr 19 '15 at 0:30
  • Find a RDBMS you can afford and develop. Android won't care which on you pick.
    – JeffO
    Apr 19 '15 at 8:56
  • @thexacre I took a look at Hibernate + Spring. This looks quite nice. I guess that might be what I was looking for :) Apr 19 '15 at 10:12

what I should use when it comes to a Web-API for server/client communication

  1. Use a REST-style API over HTTP(S) (e.g. /customer/<key>, /product/<key)
  2. Use application/json as the content format
  3. Use a user/apikey or better OAuth2 authorization scheme
  4. Don't fall for the WS*/XML variant with all their proclaimed advantages like security contexts or well structured documents. YAGNI

I found this guide useful.

what relational database system I should use

Depends on your specific use case, and your web framework. Typical options:

a. NoSQL like MongoDB, CouchDB - provide JSON APIs out of the box. If you don't need any server logic other than data persistence & query, maybe a good choice

b. SQL like MySQL, PostgreSQL - the internet workhorses. Only makes sense in combination with a webframework. My preference: Python-based Flask (somewhat hard to grow with) or Django (somewhat harder to get started, easy to grow with) - depending on your language of choice there are many more to choose from.

c. Commercial BaaS (backend as a service), e.g. Parse or many others

I'd just need somebody to draw me a picture about how a server looks like

I have ample and positive experience with the following stack:

In this case the server implements the data model as Python classes, which are mapped by Django's ORM to the DB backend (pluggable backends, so the actual DB is of litte concern). The models and/or additional modules contain the business logic, which is agnostic to whether it is used by a remote client or in server-side view code.

The REST API sits on top of these models, and is provided by several tastypie-based resources that in most cases map 1:1 to the models, in other cases they provide some intermediate processing logic such as when there are multiple models involved to satisfy a query.

  • Thank you this is a great answer! The REST API Guide looks indeed very helpful and I surely will have a deeper look at it. I'll have to take a look at your suggested frameworks too but in the meantime I'd like to ask you what you think of Hibernate. I was thinking about using Java to implement a REST API and to keep things uniform I thought Hibernate (for Java) is a good choice. It looks like a way to go. Thanks for giving me that overview! Apr 20 '15 at 9:08
  • 1
    Hibernate is certainly a good option in a Java environment. Having a Java background myself, I chose Python due to its development productivity gain, which I find it absolutely meets.
    – miraculixx
    Apr 20 '15 at 11:31
  • Thank you! This is very helpful for my decision making :) Apr 20 '15 at 11:54

There are a lot of tutorial type articles on the web around node.js which was the new hotness for writing applications for the other new hotness of mobile development. In the ones I read they all seemed to want to use a NoSQL DB such as mongodb.

But the concept is the same - you write a server in whatever language you like, that exposes a networked interface to the clients that connect over the internet - so it makes sense to write your server as a web server that exposes a REST interface. The server then stores data in a database, whether its a relational one like MySQL or something new like MongoDB doesn't really matter.

So its very simple: client -> webserver -> DB.

Not the answer you're looking for? Browse other questions tagged or ask your own question.