Requesting review for a simplified AngularJS Architecture!

Greetings everyone,

Over the last couple of months, we have been integrating our 2.x pages with AngularJS.

The main problem we faced at the initial stages was to find a standardized-openmrs-way of writing and organizing modules.

We came up with a simple architecture that I’d like to describe and hopefully get your input.

PS: We realize that AngularJS is not Java, but we relied heavily on its Object Oriented features to fit our needs.

We have a reusable-components folder that has the following main “packages”:

CONTROLLERS – Generic Controller: Provides an abstraction for Controllers. Implementing controllers only have to pass basic configs (like the module name, version etc) to get basic functionality.


  1. Generic Object – like a basic openmrs object.
  2. Generic Metadata Object – extends a generic object and defines basic fields (name, description, retireReason, purge, retired). Our models extend the Generic Metadata Object with an option of defining custom fields.

SERVICES – Any generic service (e.g restful, cookies) is bundled up here.

With the abstracted functionality in place, it becomes very easy to write a new module.

Code: Re-usable components

[Examples of modules which inherit and use the abstacted code] (

We used requireJS to load dependencies and initialize our application.

It would be nice to hear your thoughts on our design, and if anything is not clear kindly let me know!


-Andrew, OpenHMIS Team


Any reason for not using ES6/ES2015? You’d gain a lot of wins with this architecture.

We wanted a simplified architecture (easy to understand for newbies), yet making the most out of angularjs features.

ES5 is the exact opposite – ES6 actually made jS saner though…

Thanks for the suggestion. We will look into it.

I think this looks good @insiderish - thanks for building something that can potentially be used by others! I agree with @r0bby that using the current version of JavaScript could be one improvement.

Will you be providing some documentation and a way to install your framework using something like npm?

Thanks Pascal.

I will be providing documentation. We will look into a way of installing the framework and share it!