Suggested architecture for a simple Meteor app


#1

I’m a rather experienced full-stack developer (coming mainly from Python and system architecture, but familiar with various other environments) currently in the process of learning Meteor, and using it to build a simple application for a small side project. I’d appreciate some advice on how to structure my app.

The app is very simple: it has a home/login page where users authenticate via a third party, and then follow a sequence of screens, some of which are sequenced to transition after a certain time period (a few seconds) and some require user input. All of the data is client-side and there is no persistence required other than the user auth tokens. Obviously I make heavy use of Session variables to maintain client state.

So my architectural questions are these:

  1. I currently use Iron Router to manage transitions between some UI states, but noticed it’s deprecated(?). What’s a better way of managing routes?
  2. How should I structure UI states that occur on the same route? I’m currently hiding/showing elements using CSS/JS on certain actions but that feels like a hack.
  3. Is there a better way to bind certain events on Session variables to UI changes instead of glue code that I hack?

Note that I’d like to use Meteor-native features as much as possible and avoid any additional client side frameworks unless absolutely required.

Thanks!


#2

Iron Router isn’t deprecated. I am currently using it for three big projects and it works great. You could try Flow Router if your not satisfied with Iron Router.

I’ve used URL’s in the past to manage state for a particular route. Throw in some query params to keep track of your state.

Have you tried using instance.autorun(function() {}) for binding events to session variables?


#3

You could try this package that might address your concerns for item #2 and #3:

https://atmospherejs.com/manuel/viewmodel

It introduces the MVVM way of application structure where you bind data to the HTML and the view model’s concern is only the state of the UI. The video on the documentation page below should provide a clearer picture:

http://viewmodel.meteor.com/

Hope this helps!
Jay