I’m currently wondering how much one can do with Meteor right now.
Especially when it comes to “write once, run anywhere” idea.
#Example
So let’s take a fairly simple app like the meteor create --example todos app.
(Any simple app will do)
#Output
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
#Requirements
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.
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 () {
this.register('workstation', Meteor.settings.remote.id);
}
// handle the reconnect annoyances
if (Meteor.isClient) {
Accounts.onLogin(function () {
Meteor._localStorage.setItem('_token', Accounts._storedLoginToken());
});
remote.onReconnect = function () {
Meteor.loginWithToken(Meteor._localStorage.getItem('_token'));
}
}
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.