Multiple apps under one ember-cli project

Hello!

Is there any way to organize one project with ember-cli for building several apps with their own sets of controllers,models …, but all having access to some shared set of components|models|templates|helpers?

I would love to know the answer to this too. I’ve got a front-end and back-end app in a project I’m working on, and they’re currently having to live in two completely separate repositories to avoid having nested package.json and other configuration files. I can’t get users to download the repository, then cd here and npm install then cd there and npm install then cd to this other place and npm install…

You can do it by putting multiple EmberApps in a single Brocfile. The basic idea is:

var merge = require('broccoli-merge-trees');
var app = new EmberApp(...);
var otherApp = new EmberApp(...);
module.exports = merge([app, otherApp]);

Then you’d customize the trees and outputPaths of one or both apps so they’re building different input directories and producing different output files. Shared source files can get merged into the input trees.

4 Likes

Thanks! I’ll look into doing this.

Did this work out for you at all?

Hi ef4, Since i am new to ember, can you please explain in details/or provide me some demo code? Thanks

I recently answered a similar question and before that I asked it on StackOverflow. In the end, I made a demo for the solution I ended up using. https://github.com/workmanw/ember-multi-app. We use this pattern in production and it works quite well.

** Disclaimer. Ember-CLI does not officially provide support for this. It’s possible future Ember-CLI changes could break this pattern. Etc, etc, etc. Use at your own risk.