App vs. container architecture

I’ve raised this on the chat as well but wanted to move it here to not hijack the chat for that discussion.

I was wondering what the added benefit of “app” architecture is. @hieuk09 was giving me some help:

Actually, it does not give you more features or performance. It just makes the app structure clearer. For example, why do you need apps/web when app is enough? It’s true that it adds complexity in the codebase, but the directory structure looks more reasonable.

To me it looks like “app” is just a “container” with a different directory structure and the limitation of one app.

I see problems with following points due to the different directory structure:

  • documentation: need to explain the differences and benefits of each architecture
  • support: for questions asked in chat/mailing list the answer might depend on the architecture
  • change the archtiecture: people might want to change the architecture => support needed in CLI
  • code complexity: calls to env.container? will be sprinkled throughout the code to modify the behavior depending on the architecture, this is mostly for includes.
  • extensions/gems: they might need to check for architecture as well

While it does not seem add much more complexity: in a lot of the tests this might actually result in twice as many tests if one wants to properly test all the cases. So it happened in my cli refactoring. Besides adding a lot of “if” statements in the generator for action, it also doubled the tests and fixtures because i wanted to test all combinations.

To me sounds like a lot of trouble for no functionality but a different directory structure. If someone want the “app” setup, he can easily do it by creating different lotus applications but only adding one app each.

With my current knowledge of lotus i’d actually remove the architecture feature (though it only has been added recently) in favor of clean, simple code. But … perhaps i’m missing something important?

So i was wondering: who is using “app” architecture and why?


the idea is to start with a monolithic app with simpler architecture. Though I am not a big fan with this idea, I think @jodosha could explain better on this decision.

@trung_le thanks for joining.
I hope @jodosha has some feedback about the differentiation between container/app and the intention.

Community considerations

I think multiple architecture support will be deal breaker for Lotus adoption. We can keep it extensible and flexible to support even more options than app and container and it can bring a full deck of possibilities.

From where I see only a few number of users will take a SOA at first, and more important, take Lotus to build a new app to compose all their stack. Is more likely users will be dealing with one or more Rails app and would like to build a particular component, and maybe they choose Lotus to do that. At this point having app architecture (that is much more easy to assimilate by someone working years with Rails) would be awesome for the user.

One can say that “replace” Rails isn’t the goal of Lotus (sorry, I’m new here, I don’t even know the whole philosophy of the project), but I’m pretty sure that are a bunch of people that are not happy with Rails neither having something to use instead, I think we need to help these people (me included) :smile:

Technical considerations

I totally agree that maintaining it maybe would expensive, however I got curious when @pascalbetz said:

To me it looks like “app” is just a “container” with a different directory structure and the limitation of one app.

And occurred to me that if the main differences can be said so easily why our implementation make this so complex?

Is worth solving this the same way Rails solved, using templates?
Can we build self-contained components and then declare an architecture in a simple ruby file? You can even only support one kind of arch per application…

Note: I have clear idea that in me head is much more simpler than it really is (I barely know the components involved and much less the codebase). Please if I’m rudely wrong with any assumption, forgive me :wink:


Thanks for your thoughts!

The complexity stems from the fact that, depending on the architecture, files will be in different locations and that some files might exist for every application in ./apps directory.

It’s not that it is impossible to handle. It’s just adding complexity for little gain, IMHO. And, let me say this again: perhaps there is more to it, perhaps i miss something. Also new to lotus.

Currently my undertanding of the app architecture is: it is the same as container architecture with just one app.

So instead of putting your application files in (container):


You need to put them in (app)


I don’t think that is complexity that can not be understood and dealt with by a developer. If you want an app-like architecture, then just put one app in your container. If you want to move from container to app: just create several lotus applications, one for each directory in ./apps and you are done.

I’m not against multiple architectures, if they offer a real benefit. But the main deal breaker for lotus adoption is that it offers a different architecture already from rails, mainly offering the promise of less clutter in models/controllers.

Given that Lotus is very young and the community is small i’d restrain from adding complexity to the code. Concentrate on the real problems (deployment comes up often in the chat, i can not use lotus because it’s missing a built in i18n solution, assets and so on).

Again, i’d be interested from someone who is actually using the app architecture and why it was chosen over container.

1 Like

Totally right, I agree with your points. I think now is the time we need to considerer pros and cons, and the impact of stepping back this feature. We made clear our thoughts, let the core maintainers digest this and come up with a decision :smile:

I was recently thinking about this again. Still think that app-architecture is only making things more complicated than they need to be without adding real-value (to me it’s at most a marketing feature).

Because Lotus is a new framework and has little resources i think this should be removed so there is less complexity in code and doc and education.

Anyway, if this is not an option, then the topic should probably be closed.

I agree with you on that, I don’t see any reason to support app architecture.