Can this be done? (The current state of the "write once run anywhere"-stack)

I’m currently wondering how much one can do with Meteor right now.
Especially when it comes to “write once, run anywhere” idea.

So let’s take a fairly simple app like the meteor create --example todos app.
(Any simple app will do)

Now I add these things to the mix:

  • meteor add-platform ios
  • meteor add-platform android
  • meteor add arboleya:electrify

With this is it currently possible to:

a) deploy this app so it’s available on the web (yes, definitely)
b) output a .ipa file (ios app) that I can install on an iphone
c) output a .apk file (android app) that I can install on an android smartphone
d) output an .exe file (using arboleya:electrify) that I can launch on a pc

and of course

e) link them all together so they share the same set of data/collections

If it’s possible, are there any requirements you would suggest?
For example always use a mobile framework like ionicframework?
Anything I’m missing?

I’m really interested in any kind of experience you can share on this.

#In other words
Basically what I’m asking is:
I want to start prototyping a simple app in the morning and have a web-version, an .ipa, an apk and an .exe ready in the evening. Can this be done?

I haven’t done the .exe part personally but yes, it can be done. Meteor-ionic will speed up your prototyping but it had some issues which prevented me from using it in production.

1 Like

Yes, I am working on this right now.

The main thing is that you have to DDP.connect to the same server on all of them. That is all.


Thats awesome to hear!

Do you have to do any extra work for each of the android/ios/desktop versions?

I’m guessing the DDP.connect is just a few lines of code, right?

Other than that is it just a process like:
a) write my simple app
b) type the build commands for android/ios/desktop
and be done with it?

Or do you have to rewrite your code a bit for each plattform and store it somewhere separately?

Thanks a ton for your replies. :smile:

If you want a “client only” application, you can basically just choose the server you want to connect to, the collections you want, and make subscriptions. I have a client application which accesses a subset of collections from my main application, as an “admin dashboard”.

let remote = DDP.connect(Meteor.settings.public.remote.url);

Meteor.connection = remote;
Accounts.connection = remote;

Meteor.users = new Mongo.Collection('users', remote);
Orders = new Mongo.Collection('orders', remote);

FlowRouter.subscriptions = function () {

// handle the reconnect annoyances
if (Meteor.isClient) {
  Accounts.onLogin(function () {
    Meteor._localStorage.setItem('_token', Accounts._storedLoginToken());
  remote.onReconnect = function () {

edit: Sorry I’m tired, I meant you can point your client build to the same server URL as your main web app.

meteor build $DIST_FOLDER --server=$SERVER --mobile-settings=settings.json
1 Like

Thanks a lot.
If you happen to have some sample code on that, could you post it?
Really curious how that works.

Edit: Thanks a ton!

Ah I see. Thanks man! Looks doable. :slight_smile:

You may find this blog a useful resource for building a series of micro-apps using a common structure. I will say that I would have preferred to see the use of the PACKAGE_DIRS environment variable than using symlinks, which are a pain to manage.