Importance of unique phoenix and OTP app names?

I’m working developing a couple new microservices in Phoenix using a new command like this:
mix my-microservice --module App --app app --no-html

Coming from the land of PHP frameworks, it’s a bit easier for me and colleagues to follow the code when the Phoenix app is simply named “App” (and the OTP app is simply named “app”). That helps avoid confusion between the application and a schema that it interfaces with.

I’m wondering if this approach has any downsides… like… do things trainwreck if multiple microservices somehow need to live side-by-side? Is there any danger when they all might use the same “App” module? I’m planning on deploying each microservice to its own container with its own IP.

Thanks for any tips.

You can’t have different apps with the same name in connected VMs.

And it has never been easy for anyone in any language to have a plentora of projects that all share the same name, so I do not understand the PHP remark.

1 Like

In PHP, one cannot not mix apps in the same way, so when you start a new Laravel project (for example), the default namespace is simply “App”; the apps are never wired together, so there’s no chance of namespace collisions. There’s no reason why a PHP app couldn’t work with that default namespace, but sometimes it gets changed for clarity.

To be clear, the elixir/phoenix PROJECTS would not share the same name or git repo. I’m just trying to figure out a workflow that makes more sense for those devs (myself included) far more familiar with other languages and frameworks and I’m trying to avoid the painful explosions that seem to accompany any attempts to change the app or module names after creation. At best, it’s not trivial, and in practice, my IDE missed so many names that it rendered the project unusable.

If you want to use Elixir, you probably should do it the Elixir way :wink:
I don’t think one could make a convincing case for naming all apps simply :app.

Figuring out what that means is more a journey than a destination.

In php you cannot install two composer packages using the same classnames as well, which is the reason namespaces were added to the language in the first place. The same stands true in elixir with unique names for otp applications. The difference being that you’ve way more meaningful ways to not only use stateless (3rd party) libraries as dependencies in elixir, but also stateful dependencies and a higher likelyhood that some might be developed by yourself as well. Even a single project might include multiple first-party otp applications (see the umbrella structure in elixir). So why go the way of naming all your apps the same, which might turn out as a bad idea later? I mean you named your example project my-microservice, why not let the otp app have that name as well.