Mobile Application Architecture Question

Hey Meteorites :smile:

This is my first post here, I started following Meteor a long time ago, and I even played with it here and there.

But, as of late, I started a most serious project (well, it’s a app for gags).

The way I envision the APP (android, ios etc) is that on each phone we have the full app running (CLIENT + SERVER) but I still need a central server somewhere from where to manage all the things and actually create connectivity and communication between the various clients.

I can’t picture this image in my mind yet, how does one do that with Meteor ? Using only Meteor, or is it another backend somewhere where the APP’s Meteor server connects to?

I honestly have no idea, I read here and there about it, but I guess that I could use a description in a single post oriented directly on this issue :smiley:

Thanks, have a nice day!

When you write a Meteor app, you effectively write client and server parts. These will be in a single code base for development. Separation occurs when you build the app. At that point you get:

  1. A client part (HTML, JavaScript, etc), which gets bundled in a fairly conventional manner. You may also choose to build out for mobile platforms (ios, android) with Cordova, which permits a more native look and feel for those devices.

  2. A server part, which is built as a nodejs application and runs centrally, serving the various clients you have targeted (browser, ios, android). The server part is common to all clients.

So, to your question: on each phone you have the client part (may use Cordova for a more native look and feel), and centrally, you have the server part (a nodejs app).

Connectivity and communication is handled for you as part of the Meteor Magic :wink:. What you communicate (your data) is part of your design, is normally maintained in collections, and uses a publish/subscribe model to allow the client to see server data. In addition Meteor methods may be used for an RPC-like way of invoking server side functions from the client.

1 Like

Could you elaborate on why you want the server on the phone?

If it’s for offline database take a look at GroundDB - https://github.com/GroundMeteor/db

the server can’t run on the phone. You need either a internet connection or the ability to emulate the server logic an synch later.

A server part, which is built as a nodejs application and runs centrally, serving the various clients you have targeted (browser, ios, android). The server part is common to all clients.

Yes, this is exactly what I was asking, I haven’t deployed a meteor app before, but I have played a lot.

This explains it, on deployment there’s two separate packages, one client, one server, client goes in cordova, server goes once on a hosting somewhere.

Awesome. Thanks!

I was thinking that part of the app should also be stored on the phone, more exactly in my case, all what the current user has (images, logs, etc) for quick access / convenience and offline use.

You should look at appcache for offline static resources, and possibly also ground:db for offline data.

Yes, Thanks!

I already installed ground:db

I am defining my DB structure now and hopefully I’ll manage to play with it in the next days.