# Can I put and expose ports in a separate module?

**URL:** <https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670>\
**Category:** Learn\
**Created:** [February 19, 2024, 1:44pm UTC](https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670 "2024-02-19T13:44:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlotm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/carlotm/32/4785_2.png) [@carlotm](https://discourse.elm-lang.org/u/carlotm)\
**Post date:** [February 19, 2024, 1:44pm UTC](https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670/1 "2024-02-19T13:44:01Z")

</div>

Hi all,

can I put and expose ports in a separate module?  
I have several apps wthat will share the same ports.

I have just tried but the compiler is complaining that in my ports module I don’t have a main.

Is there an example of such a layout in the wild?

Cheers!

---

<div class="post-metadata">

**Author:** ![Lucas\_Payr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/lucas_payr/32/4993_2.png) [@Lucas\_Payr](https://discourse.elm-lang.org/u/Lucas_Payr)\
**Post date:** [February 19, 2024, 3:34pm UTC](https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670/2 "2024-02-19T15:34:26Z")

</div>

Yes that should be possible. 🤔

Could you maybe share some example?

Also, unrelated but perhaps [elm-ts-interop](https://elm-ts-interop.com/) might be of interest to you.

---

<div class="post-metadata">

**Author:** ![carlotm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/carlotm/32/4785_2.png) [@carlotm](https://discourse.elm-lang.org/u/carlotm)\
**Post date:** [February 19, 2024, 3:48pm UTC](https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670/3 "2024-02-19T15:48:40Z")

</div>

It was indeed my build process that was wrong.  
I was mistakenly building the module with elm make

/me feels embarassed.

Sorry for the noise

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [February 29, 2024, 3:49pm UTC](https://discourse.elm-lang.org/t/can-i-put-and-expose-ports-in-a-separate-module/9670/4 "2024-02-29T15:49:23Z")

</div>

Closed on February 29, 2024, 3:49pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
