# Is it possible to have a top level module? (dry-system)

**URL:** <https://discourse.dry-rb.org/t/is-it-possible-to-have-a-top-level-module-dry-system/967>\
**Category:** Support\
**Created:** [December 9, 2019, 2:10pm UTC](https://discourse.dry-rb.org/t/is-it-possible-to-have-a-top-level-module-dry-system/967 "2019-12-09T14:10:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miral](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Miral](https://discourse.dry-rb.org/u/Miral)\
**Post date:** [December 9, 2019, 2:10pm UTC](https://discourse.dry-rb.org/t/is-it-possible-to-have-a-top-level-module-dry-system/967/1 "2019-12-09T14:10:08Z")

</div>

Hey all,

Is it possible to have a top level module with dry-system? Standard ruby app, using agoo as the web server. File structure is as follows:

```auto
lib
├── orders
│ ├── repositories
│ │ └── repo_1.rb
│ ├── consumers
│ │ └── consumer_1.rb
│ ├── tasks

```

Before adding dry-system; everything is under the Orders module and works fine. So `Orders::Repositories::Repo1` etc etc. I can’t see to figure this out with dry-system however.

This is what my current container looks like:

```auto
require "dry/system/container"

class Application < Dry::System::Container
  # use :logging
  use :monitoring
  use :env, inferrer: -> { ENV.fetch("RACK_ENV", :development).to_sym }

  configure do |config|
    config.name = :order
    config.auto_register = %w[lib]
  end

  load_paths! "config", "lib", "system"
end

# requiring other dependecies here like pry, bundler/setup etc.

```

I’ve managed this in a previous project with nested containers. We had an application container, and another container for the top-level module. Is this the expected way to do it?

Because we had weird issues where a file out of the blue, didn’t get auto registrered (After working fine for months) and we had to require it manually after that. If it’s the expected way to to do it then that’s fine I will do it again, if not then can somoene advise on how they achieved it? Thanks.

I feel like this file structure is a common pattern in ruby so I’m suprised there is little documentation/examples covering it. Will add one if I get a solid solution.

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [December 11, 2019, 9:40am UTC](https://discourse.dry-rb.org/t/is-it-possible-to-have-a-top-level-module-dry-system/967/2 "2019-12-11T09:40:43Z")

</div>

I strongly recommend using an application namespace. I’ve no idea how and if dry-system can work correctly without this. If you’re having issues then please create a sample setup so we could look into it.
