> For the complete documentation index, see [llms.txt](https://elchemist.gitbook.io/tinh-tinh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://elchemist.gitbook.io/tinh-tinh/core-fundamental/module.md).

# Module

<figure><img src="https://2541580492-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtKnxvxRflr41Wbs7ajzp%2Fuploads%2FJDcOBZIhJeqa71TYfejE%2FTinhTinh-Modular.drawio.png?alt=media&amp;token=65effba6-b0f6-4b09-8283-9d4813e2a892" alt=""><figcaption></figcaption></figure>

Each application has a least one module, a **root module.** The root module is the starting point to build the application. Have a different in root module with sub module.

Syntax for create root module in Tinh Tinh:

```go
package app

import "github.com/tinh-tinh/tinhtinh/core"

func Module() *core.DynamicModule {
    module := core.NewModule(core.NewModuleOptions{})
    
    return module
}
```

Create child module:

```go
package sub

import "github.com/tinh-tinh/tinhtinh/core"

func Module(module *core.DynamicModule) *core.DynamicModule {
    subModule := module.New(core.NewModuleOptions{})
    
    return subModule 
}
```

Although have different syntax for create root module and sub module, but it will receive same options.

Options among:

* **Scope**: Have two type scopes, Global and Request.
* **Imports**: Array of function will return value as `DynamicModule`
* **Controllers**: Array of function will return value as `DynamicController`
* **Providers**: Array of function will return value as `DynamicProvider`
* **Exports**: Array of function will return value as `DynamicProvider`
