Search code examples
ruby-on-railsnode.jscompoundjs

How to run multiple "Applications" under one compoundJS instance?


I've been using nodeJS + expressJS for several years now developing a custom Application Platform for our organization. Our central framework provides a common set of services (authentication, language, administration, etc...) for any installed Modules/Applications under it.

I would like to switch our framework out with compoundJS. However I'm not familiar with the design constraints imposed by it (and Rails apps in general) and can't seem to figure out how to accomplish what I'm after.

  • I would like to only have a single server instance running: all requests first process through our common authentication checking. Then are passed on to an application's controllers.

  • I would also like to have each application separated out: preferably under a separate site/applications/ directory. Each of these applications could be designed using compoundJS normally. And I would like to install them like:

    cd site/applications
    npm install site-hr
    npm install site-finance
    npm install site-payroll
    

    this would then have all the routes from /hr, /finance, /payroll operational.

How do I accomplish this?

Is there a way to get compoundJS to search the nonstandard /applications/* folders for models/controllers/views and load them while keeping the central /site configurations?

Or is there a better way?


Solution

  • Sorry for the late answer, but I needed something similar: I needed to put together tool applications in a portal.

    I found a way to include child applications in a parent's Compound application as node modules. I wrote a guide on how to do it and sent a pull request to add it in the advanced folder of CompoundJS' guides. It is also available here. It requires a bit of work, but it works fine with 4 applications for us.

    Hope it can help.