# Running erlang distributed application using rebar3

**URL:** <https://erlangforums.com/t/running-erlang-distributed-application-using-rebar3/3902>\
**Category:** Questions / Help\
**Tags:** rebar3, erlang\
**Created:** [August 10, 2024, 8:36pm UTC](https://erlangforums.com/t/running-erlang-distributed-application-using-rebar3/3902 "2024-08-10T20:36:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![falsal](https://erlangforums.com/letter_avatar_proxy/v4/letter/f/6bbea6/32.png) [@falsal](https://erlangforums.com/u/falsal)\
**Post date:** [August 10, 2024, 8:36pm UTC](https://erlangforums.com/t/running-erlang-distributed-application-using-rebar3/3902/1 "2024-08-10T20:36:00Z")

</div>

I have created a simple distributed chat application using erlang and want to build it using rebar3. The application consists of some modules such as `server.erl`, `client.erl`, `chatroom.erl`. I build the applcation using below command

```erlang
rebar3 new app chat

```

I can run the server using

```erlang
 rebar3 shell --sname server

```

the `server.erl` is run when the application starts. Now, I want a client to create a server node and connect to the server and send some messages. For example:  
`client:login(name).` How to do this please? shall I navigate to the client.beam file or there is another short way ?

---

<div class="post-metadata">

**Author:** ![LoisSotoLopez](https://erlangforums.com/user_avatar/erlangforums.com/loissotolopez/32/2416_2.png) [@LoisSotoLopez](https://erlangforums.com/u/LoisSotoLopez)\
**Post date:** [September 17, 2024, 4:29pm UTC](https://erlangforums.com/t/running-erlang-distributed-application-using-rebar3/3902/2 "2024-09-17T16:29:57Z")

</div>

Well, the first place to start reading might be [here](https://www.erlang.org/docs/26/reference_manual/distributed).

You can start by running the application in two different Erlang nodes by doing  
`rebar3 shell --sname server`  
and  
`rebar3 shell --sname client`  
on one terminal shell each.

Then you can do `net_adm:names()` to verify on both nodes to check that nodes _see each other_. If they don’t you might want to set the same cookie for both started nodes (check out the link above).

Even if they see each other you might want to issue a `net_adm:ping` from one to the other. If `nodes()` on each of them lists the other you will be in the right path.

Then it’s a matter of properly registering the “server”. You might want to use the `global` module to register the server instead of just doing `erlang:register/2`.

As a tip, be sure to test node communication between two shells before trying to make your logic work between two nodes 😉
