# Create a reusable module

Source: https://zotonic.com/cookbook/1576/create-a-reusable-module

URI: https://zotonic.com/id/1576

Language: en

Create apps_user/zotonic_mod_garden with the following files. This example adds a discoverable module without starting an extra process.

Create `apps_user/zotonic_mod_garden` with the following files. This example adds a discoverable module without starting an extra process.

`rebar.config`:

```erlang
{erl_opts, [debug_info]}.
```

`src/zotonic_mod_garden.app.src`:

```erlang
{application, zotonic_mod_garden, [
    {description, "Community garden features"},
    {vsn, "0.1.0"},
    {registered, []},
    {applications, [kernel, stdlib, zotonic_core]},
    {env, []},
    {modules, []}
]}.
```

`src/mod_garden.erl`:

```erlang
-module(mod_garden).
-mod_title("Garden").
-mod_description("Community garden features.").
-mod_prio(500).
```

Run `make` from the Zotonic workspace root. On the running development node, use `bin/zotonic update` to refresh discovery. Open module management in the site's admin and activate Garden.

Check that the module is active. Add the model from [Expose data through a model](/id/2960) for a first data lookup, and put templates in `priv/templates`. Keep installation hooks and observers in the main module; move domain logic into models or support modules.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1576?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1576?language=en>)
