# Why are entities and repositories put on global module?

**URL:** <https://discourse.hanakai.org/t/why-are-entities-and-repositories-put-on-global-module/211>\
**Category:** questions\
**Created:** [February 12, 2016, 5:59pm UTC](https://discourse.hanakai.org/t/why-are-entities-and-repositories-put-on-global-module/211 "2016-02-12T17:59:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zakuro](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/zakuro/32/174_2.png) [@zakuro](https://discourse.hanakai.org/u/zakuro)\
**Post date:** [February 12, 2016, 5:59pm UTC](https://discourse.hanakai.org/t/why-are-entities-and-repositories-put-on-global-module/211/1 "2016-02-12T17:59:31Z")

</div>

Hi all.

Files that have written entities is put on ‘/lib/myapp/entities/my\_entity.rb’. Thus I think MyEntity is put on MyApp::Entities module.

So, I think my\_entity.rb is following.

```auto
class MyApp::Entities::MyEntity
  include Hanami::Entity
  ...
end

```

But actual MyEntity is put on global module and my\_entity.rb is following.

```auto
class MyEntity
  include Hanami::Entity
  ...
end

```

Repositories are also same.

Why is this?

---

<div class="post-metadata">

**Author:** ![rogeriozambon](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/rogeriozambon/32/189_2.png) [@rogeriozambon](https://discourse.hanakai.org/u/rogeriozambon)\
**Post date:** [March 22, 2016, 2:03am UTC](https://discourse.hanakai.org/t/why-are-entities-and-repositories-put-on-global-module/211/2 "2016-03-22T02:03:23Z")

</div>

My thoughts regarding this issue is simple. Your container application should be concerned about layers for dispatch, authorization and validation (exactly about namespace for MyApp). After that, we’ve layers for business logic and persistence.

Those last layers aren’t coupled and this is really good. The `hanami-model` gem isn’t coupled with the first layers that I said. And what I said is what makes sense to me.

But, I really want to know what are the thoughts of the core team.
